Error compiling opencascade 6.3 in FreeBSD 64bits (amd64)

Hi. Only to inform that I get an error trying to compile the port opencascade 6.3 in 7.1-RELEASE amd64. I am using the stock gcc (4.2.1).

"uname -a" output:
FreeBSD bsd64.local 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24
UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
amd64

I got this error:

if /bin/sh /usr/local/bin/libtool --mode=compile
c++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/StepAP214
-I../../../src/StepAP214 -I../../../drv/RWStepAP214 -I../../../src/RWStepAP214
-I../../../drv/StepAP203 -I../../../src/StepAP203 -I../../../drv/RWStepAP203
-I../../../src/RWStepAP203 -I../../../drv/STEPConstruct -I../../../src/STEPConstruct
-I../../../drv/STEPEdit -I../../../src/STEPEdit -I../../../drv/GeomToStep
-I../../../src/GeomToStep -I../../../drv/StepToGeom -I../../../src/StepToGeom
-I../../../drv/StepToTopoDS -I../../../src/StepToTopoDS -I../../../drv/TopoDSToStep
-I../../../src/TopoDSToStep -I../../../drv/STEPControl -I../../../src/STEPControl
-I../../../drv/STEPSelections -I../../../src/STEPSelections -I../../../drv/StepAP209
-I../../../src/StepAP209 -O2 -fno-strict-aliasing -pipe -I/usr/local/include
-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4 -I/usr/local/diablo-jdk1.6.0/include
-I/usr/local/diablo-jdk1.6.0/include/freebsd -D_OCC64 -DNDEBUG -DNo_Exception
-O2 -fno-strict-aliasing -pipe -DCSFDB -DOCC_CONVERT_SIGNALS -DFREEBSD -Damd64
-D_GNU_SOURCE=1 -O2 -MT STEPConstruct_AP203Context.lo -MD -MP -MF
".deps/STEPConstruct_AP203Context.Tpo" -c -o STEPConstruct_AP203Context.lo
`test -f '../../../src/STEPConstruct/STEPConstruct_AP203Context.cxx' || echo
'./'`../../../src/STEPConstruct/STEPConstruct_AP203Context.cxx; then mv
".deps/STEPConstruct_AP203Context.Tpo"
".deps/STEPConstruct_AP203Context.Plo"; else rm -f
".deps/STEPConstruct_AP203Context.Tpo"; exit 1; fi
c++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/StepAP214
-I../../../src/StepAP214 -I../../../drv/RWStepAP214 -I../../../src/RWStepAP214
-I../../../drv/StepAP203 -I../../../src/StepAP203 -I../../../drv/RWStepAP203
-I../../../src/RWStepAP203 -I../../../drv/STEPConstruct -I../../../src/STEPConstruct
-I../../../drv/STEPEdit -I../../../src/STEPEdit -I../../../drv/GeomToStep -I../../../src/GeomToStep
-I../../../drv/StepToGeom -I../../../src/StepToGeom -I../../../drv/StepToTopoDS
-I../../../src/StepToTopoDS -I../../../drv/TopoDSToStep -I../../../src/TopoDSToStep
-I../../../drv/STEPControl -I../../../src/STEPControl -I../../../drv/STEPSelections
-I../../../src/STEPSelections -I../../../drv/StepAP209 -I../../../src/StepAP209
-O2 -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/local/include/tcl8.4
-I/usr/local/include/tk8.4 -I/usr/local/diablo-jdk1.6.0/include -I/usr/local/diablo-jdk1.6.0/include/freebsd
-D_OCC64 -DNDEBUG -DNo_Exception -O2 -fno-strict-aliasing -pipe -DCSFDB -DOCC_CONVERT_SIGNALS
-DFREEBSD -Damd64 -D_GNU_SOURCE=1 -O2 -MT
STEPConstruct_AP203Context.lo -MD -MP -MF
.deps/STEPConstruct_AP203Context.Tpo -c
../../../src/STEPConstruct/STEPConstruct_AP203Context.cxx -fPIC -DPIC -o
.libs/STEPConstruct_AP203Context.o
../../../src/STEPConstruct/STEPConstruct_AP203Context.cxx: In member
function 'Handle_StepBasic_DateAndTime
STEPConstruct_AP203Context::DefaultDateAndTime()':
../../../src/STEPConstruct/STEPConstruct_AP203Context.cxx:106: error: cast
from 'char* (*)(int, int)' to 'Standard_Integer' loses precision
*** Error code 1

regards,
John Dottor

Andrey Betenev's picture

Line 106 of STEPConstruct_AP203Context.cxx is:

Standard_Integer shift = Standard_Integer(timezone);

Here timezone is expected to be global integer variable; GNU C library defines it "for compatibility with System V Unix", see
http://www.gnu.org/software/libtool/manual/libc/Time-Zone-Functions.html...

It looks like if in your case timezone were not a variable but a pointer to a function... Might it happen that new version of gnu/c has different definition of this symbol?

Check where and how this symbol is defined; if it is defined differently in your version of gcc/c library, you will likely have to use conditional compilation to work-around this problem.

jdottor's picture

That's right. Thanks for the great help.

regards,
John Dottor

jdottor's picture

To evade this error, I did edited the file "./ros/src/STEPConstruct/STEPConstruct_AP203Context.cxx" and made the following change:

-Standard_Integer shift = Standard_Integer(timezone);
+Standard_Integer shift = Standard_Integer((long long)timezone);

After this, the compilation process worked fine until the end.