[Radiance-dev] Radiance compiled with mingw gcc (windows)
Greg Ward
gregoryjward at gmail.com
Sun Sep 11 20:10:15 CEST 2005
Hi Francesco,
Thanks for giving this a try!
> From: "Francesco Anselmo" <francesco.anselmo at arup.com>
> Date: September 11, 2005 6:09:37 AM PDT
>
> I've finally started looking at rtcontrib to replace my own scripts to
> calculate daylight coefficients, and need to use it with windows
> (unfortunately!) and without cygwin, so I've been "forced" to try
> the mingw
> (http://www.mingw.org/) version of gcc to compile Radiance.
Is this the target compiler we had in mind? I don't know anything
about what's available under Windows, if schorsch (Georg Mischler)
meant for people to use the more common (and nasty) Visual C
standard. In other words, I'm not sure if by checking in these
changes if I'd actually be making matters worse. For that reason,
I'd prefer to leave Windows-related changes to schorsch, though I
know he's been busy on other projects lately.
> ...
> As for the source files:
>
> 1.
> I had to redefine kill() inside rad.c and ranimate.c
> using "RT_PID pid" instead of "int pid":
>
> int
> kill(RT_PID pid, int sig) /* win|unix_process.c should also wait
> and kill */
> {
> return 0;
> }
This seems a safe enough change, though rtprocess.h, where RT_PID is
defined, is not currently included in ranimate.c and will need to be
added.
> Also, inside win_process.c for the close_process() function:
> was -----------------> int win_kill(pid, 0);
> i've changed it to --> win_kill(pid, 0);
I don't know if this affects compatibility under other compilers, so
I'll leave it to schorsch.
> 2.
> The mingw version of signal.h doesn't have a definition for
> SIGALRM, so
> killpersist() inside mkillum.c needs to be changed:
> It is like this:
> if (fscanf(fp, "%*s %d", &pid) != 1 || kill(pid, SIGALRM) < 0)
> but I've used SIGTERM instead of SIGALRM, don't know if this make
> much sense ...
The only difference this will make is that the waiting rtrace process
will report an error instead of going quietly.
> 3.
> rtcontrib was calling rtrace with a wrong command line. It was
> something like
> this:
>
> c:\radiance\bin/rtrace.exe rtrace [args ...]
>
> After some little searching I used this quick workaround inside
> win_process.c
>
> cmdpath = getpath(av[0], getenv("PATH"), X_OK);
> added by me --> av[0] = "";
> cmdstr = quoted_cmdline(cmdpath, av);
>
> that may have broken something somewhere else, so probably
> a better solution would be to do some extra checks inside the
> _WIN32 section
> of getpath.c.
>
> I am interested only in rtcontrib right now, so I haven't checked
> if other programs that call open_process() are still working or not.
win_process.c is all schorsch's work, so he'll have to respond to
this one as well.
> 4.
> Mingw doesn't have fseeko(), and I replaced it with fseek() inside
> rtcontrib.c.
> This seems to have broken the file output, that is working well
> with both
> cygwin and linux. Is there an easy workaround for this? I don't
> have very
> much experience to figure it out myself. Output to stdout now works
> fine ...
The original call:
if (fseeko((FILE *)e->data, *(off_t *)p, SEEK_CUR) < 0) {
could be replaced by:
if (fseek((FILE *)e->data, *(off_t *)p, SEEK_CUR) < 0) {
or even -Dfseeko=fseek on the compile line and it should work for
files less than 2 GB in size. I assume that off_t is defined in your
system, otherwise you would have had other errors. If it isn't
defined as "long", then you might need another cast, like so:
if (fseek((FILE *)e->data, (long)*(off_t *)p, SEEK_CUR) < 0) {
Once we find a working substitute, we can add the appropriate macro
to platform.h.
-Greg
More information about the Radiance-dev
mailing list