Compiling OpenCascade6.3.0 on Mac OS Snow Leopard Macbook Pro. How I did it

Hi, here is a short review what went wrong for me and how I solved
it. I have installed the "linux" tools from macports.

configured after doingexport CPPFLAGS=-I/opt/local/includegot error messages when compiling Draw_Window.cxx....
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I/System/Library/Frameworks/Tcl.framewor
k/Versions/8.5/Headers -I/System/Library/Frameworks/Tk.framework/Versions/8.5/He
aders -I../../../inc -I../../../drv/Draw -I../../../src/Draw -I../../../drv/DBRe
p -I../../../src/DBRep -I../../../drv/DrawTrSurf -I../../../src/DrawTrSurf -I/op
t/local/include -D_OCC64 -DNDEBUG -DNo_Exception -DCSFDB -DOCC_CONVERT_SIGNALS -
O2 -MT Draw_Window.lo -MD -MP -MF .deps/Draw_Window.Tpo -c ../../../src/Draw/Dra
w_Window.cxx -fno-common -DPIC -o Draw_Window.lo
../../../src/Draw/Draw_Window.cxx: In member function ‘void Draw_Window::Init(St
andard_Integer, Standard_Integer, Standard_Integer, Standard_Integer)’:
../../../src/Draw/Draw_Window.cxx:362: error: ‘XCreateWindow’ was not declared i
n this scope
../../../src/Draw/Draw_Window.cxx:364: error: ‘XSelectInput’ was not declared in
this scope
../../../src/Draw/Draw_Window.cxx:370: error: ‘XCreateGC’ was not declared in th
is scope

...

There was a problem with include statements for the preprocessor so the
order of where to find X11/Xlib.h was not good so the wrong one was taken

should have been: /opt/local/include/X11/Xlib.h

was

/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers/X11/Xlib.h

changed makefile in ./ros/adm/make/TKDraw, added -I/opt/local/include/
to DEFAULT_INCLUDES

after that it compiled until TKViewerTest, ...

g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I/System/Library/Frameworks/Tcl.framewor
k/Versions/8.5/Headers -I/System/Library/Frameworks/Tk.framework/Versions/8.5/He
aders -I../../../inc -I../../../drv/Viewer2dTest -I../../../src/Viewer2dTest -I.
./../../drv/ViewerTest -I../../../src/ViewerTest -I/opt/local/include -D_OCC64 -
DNDEBUG -DNo_Exception -DCSFDB -DOCC_CONVERT_SIGNALS -O2 -MT Viewer2dTest_Viewer
Commands.lo -MD -MP -MF .deps/Viewer2dTest_ViewerCommands.Tpo -c ../../../src/Vi
ewer2dTest/Viewer2dTest_ViewerCommands.cxx -fno-common -DPIC -o Viewer2dTest_Vi
ewerCommands.lo
../../../src/Viewer2dTest/Viewer2dTest_ViewerCommands.cxx: In function ‘int ViewerMainLoop2d(Standard_Integer, const char**)’:
../../../src/Viewer2dTest/Viewer2dTest_ViewerCommands.cxx:819: error: ‘XNextEvent’ was not declared in this scope
../../../src/Viewer2dTest/Viewer2dTest_ViewerCommands.cxx:870: error: ‘XCheckMaskEvent’ was not declared in this scope

...

Same problem same solution...

Couldn't run DRAWEXE

...

Solution:
make uninstall
make distclean
export CXXFLAGS=-I/Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/include
export LDFLAGS="-L/Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/lib -lX11"
configure --x-include=/Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/include/ --x-libraries=/Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/lib
make
make install

end then modify make files in

./amd/make/TKDraw/

and

./amd/make/TKViewerTest/

and it compiles and DRAWEXEC starts!!!

all that is left now is to see if it was worth the trouble I went
through (I had to look at the pre processor output to catch the
mistake with the include files;)

cheers

Joa

Jukka Aho's picture

Thanks for million times for this post. It saved me from a LOT of extra work. I had similar errors and managed them by commenting out

#CSF_TclLibs_INCLUDES = -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers
#CSF_TclTkLibs_INCLUDES = -I/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers

from makefiles.

Jukka