compiling rhdisp on Solaris with gcc?

Hi!
  
While I am trying to get the solaris build ready, I have one problem here
with
Radiance 3.5, GCC 3.2.2 and Solaris 9: the function disp_wait in rhdisp.c
gives
me an error:

gcc -I../common -L../lib -O3 -mcpu=v9 -mtune=v9 -m32 -DSPEED=200
-ffast-math -Dlinux -L/usr/openwin/lib -I/usr/openwin/include -DNOSTEREO
-DBIGMEM -c rhdisp.c
rhdisp.c: In function `disp_wait':
rhdisp.c:164: structure has no member named `_IO_read_end'
rhdisp.c:164: structure has no member named `_IO_read_ptr'
rhdisp.c:166: structure has no member named `_IO_read_end'
rhdisp.c:166: structure has no member named `_IO_read_ptr'
*** Error code 1

Does anybody have an idea why I get this on Solaris? In fact, I have done
all
gcc-compiles of Radiance 3.5 on 2.9.x-releases, and now I am using gcc3...

All the rest compiles quite fine. (And I really want to get this new code
onto our
ultrasparc machines :wink:

CU Lars.

···

--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte l�cheln! Fotogalerie online mit GMX ohne eigene Homepage!

Lars Grobe < [email protected]> writes:

While I am trying to get the solaris build ready, I have one problem here with
Radiance 3.5, GCC 3.2.2 and Solaris 9: the function disp_wait in rhdisp.c gives
me an error:

gcc -I../common -L../lib -O3 -mcpu=v9 -mtune=v9 -m32 -DSPEED=200
-ffast-math -Dlinux -L/usr/openwin/lib -I/usr/openwin/include -DNOSTEREO
-DBIGMEM -c rhdisp.c
rhdisp.c: In function `disp_wait':
rhdisp.c:164: structure has no member named `_IO_read_end'
rhdisp.c:164: structure has no member named `_IO_read_ptr'
rhdisp.c:166: structure has no member named `_IO_read_end'
rhdisp.c:166: structure has no member named `_IO_read_ptr'
*** Error code 1

This is a nasty little bit of code that unfortunately is very difficult to find a portable solution for. At the top of rhdisp.c there is a macro called "fbufcnt(f)" that is supposed to return the number of unread bytes in a FILE f's input buffer. There is no standard (or even conventional) way to do this, so I have a few different hacks in there that work on a few different systems. If this macro isn't operational, rholo could lock up in interactive mode. The way around using such a macro would be a lot of really ugly code, which is why I've done like this.

The easist solution for solaris is to find the definition of the FILE struct, which can be difficult to locate through the typical maze of #ifdef's that proliferated since the inception of 3 or more so-called "standard" UNIX's. I usually get the output of the C preprocessor and scan it for the FILE struct that is brought in with stdio.h. I then have to make an educated guess as to how the pointers in this struct are used, and define the fbufcnt() macro accordingly. It's a real tragedy they never standardized such a function, as it's invaluable for operations involving multiple input streams.

-Greg