Trying to port OpenCASCADE X11 undefined symbol problem.

nyholku

Registered
Hi,

I've been trying to port OpenCASCADE to MacOS. Moderate success with litle modifications most things seem to compile and link, but a sample application DRAWEXE fails to link. Looking at what is happening it looks as if the X11 libraries are not picked up.

This is an attempt with the GNU type tool chaing using:

./configure --disable-shared CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" LDFLAGS="-arch i386" --with-gl-include=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --with-x --x-includes=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-libraries=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib --with-tcl=/usr/lib --with-tk=/usr/lib

make

This compiles quite a lot but in the end fails with:


/bin/sh ../../../libtool --mode=link g++ -DCSFDB -DNO_CXX_EXCEPTION -g -DDEB -D_DEBUG -arch i386 -o DRAWEXE DRAWEXE.o ../TKDraw/libTKDraw.la ../TKMesh/libTKMesh.la ../TKGeomAlgo/libTKGeomAlgo.la ../TKTopAlgo/libTKTopAlgo.la ../TKHLR/libTKHLR.la ../TKGeomBase/libTKGeomBase.la ../TKG2d/libTKG2d.la ../TKBRep/libTKBRep.la ../TKMath/libTKMath.la ../TKG3d/libTKG3d.la ../TKernel/libTKernel.la -framework Tcl -framework Tk -lpthread -framework CoreFoundation
g++ -DCSFDB -DNO_CXX_EXCEPTION -g -DDEB -D_DEBUG -arch i386 -o DRAWEXE DRAWEXE.o -framework Tcl -framework Tk -framework CoreFoundation ../TKDraw/.libs/libTKDraw.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKMesh/.libs/libTKMesh.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKHLR/.libs/libTKHLR.a ../TKMesh/.libs/libTKMesh.a ../TKGeomAlgo/.libs/libTKGeomAlgo.a ../TKTopAlgo/.libs/libTKTopAlgo.a ../TKHLR/.libs/libTKHLR.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKTopAlgo/.libs/libTKTopAlgo.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKGeomAlgo/.libs/libTKGeomAlgo.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKBRep/.libs/libTKBRep.a ../TKGeomBase/.libs/libTKGeomBase.a ../TKG2d/.libs/libTKG2d.a ../TKBRep/.libs/libTKBRep.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKGeomBase/.libs/libTKGeomBase.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKG3d/.libs/libTKG3d.a ../TKMath/.libs/libTKMath.a ../TKG3d/.libs/libTKG3d.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKG2d/.libs/libTKG2d.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKMath/.libs/libTKMath.a /Users/nyholku/occ/opencascade-6.1/ros/adm/make/TKernel/.libs/libTKernel.a ../TKernel/.libs/libTKernel.a -lpthread
/usr/bin/ld: Undefined symbols:
_XCreateWindow
_XDisplayName
_XDrawString
_XFlush
_XFree
_XGetWindowAttributes
_XLookupString
_XNextEvent
_XPending
_XSetPlaneMask
_XStoreName
_XSynchronize
collect2: ld returned 1 exit status
make[3]: *** [DRAWEXE] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


How should I debug this?

The config and make files are very very long and there are about a hundred of them. I can't realy figure out where the libraries should be picked up. My thinking is that since this reportedly builds on Linux the real problem is not in the make / configure files (although it could be ofcourse) but in the parameters I supply.

Any ideas on how to debug this further would be appreciated.

What information should I post to help the good people at the forum to help me?

Is this the best forum for this problem?


br Kusti
 
XFree etc. are part of the X11 library. Even if you said --with-x on config,
it seems that there is no reference to the library on the g++ call. I guess
you have to add
Code:
-lX
somehow there.
 
Artov,

thanks for the tip and observation, which was helpfull.

Debugging the build process I came to the conclusion that the DRAWEXE make file simply is not 'picking' up the X11 libraries, even when I specify them. So I modified that by adding '-L/usr/X11R6/lib -lX11' to the link definition in the make file. In the long run I should do this in the Makefile.in or Makefile.am, I guess.

What worries me is that this code (OpenCASCADE) supposedly compiles out of the box in Linux. So how come there is this need to add something to the Makefile? How does it know on Linux to link the approriate libraries?

In my experience, when we are talking about a popular and professional software, such as OpenCASCADE, it usually is the wrong approach to hack the source code / build process, usually the trouble is in bad configuration parameters. Not that I'm any expert on this.

Anyway, now I can compile and link everything 'succesfully', which is a step forward. However, as always, there is a new problem.

Now when I try to execute the DRAWEXE the following error is reported:

dyld: Library not loaded: /usr/local/lib/libTKMesh.0.dylib
Referenced from: /usr/local/bin/DRAWEXE
Reason: image not found
Trace/BPT trap

and indeed when I look at /usr/local/lib there is only:

lrwxr-xr-x 1 root wheel 18 Mar 11 08:12 libTKernel.0.0.0.dylib -> libTKernel.0.dylib
-rwxr-xr-x 1 root wheel 38487852 Mar 11 08:12 libTKernel.0.dylib
-rw-r--r-- 1 root wheel 44030556 Mar 11 08:12 libTKernel.a
lrwxr-xr-x 1 root wheel 18 Mar 11 08:12 libTKernel.dylib -> libTKernel.0.dylib
-rwxr-xr-x 1 root wheel 826 Mar 11 08:12 libTKernel.la


As the missing file is definately something that the build process should have produced there is obviously something still wrong with it. And indeed 'make install' complains a lot. I guess I need to dig deeper again. All pointers / suggestions are of course wellcome.

br Kusti
 
Back
Top