Succesfull compile of OCC 6.2 on MacOS 10.4.9 but having problems running DRAWEXE

Hi List,

I've built, succesfully I think, OpenCASCADE on my Mac OS X 10.4.9 Dual Core Intel.
Having problems running the supplied demo application DRAWEXE.
It crashes with EXC_BAD_ACCESS
This demo application uses, I think, Tcl, Tk and X11.
I can run X11 applications, like InkScape, no problem.
I've been able to run it with the Xcode debugger (gdb) and single step to the offending statement.

The application starts and runs until 'XSynchronize' statement is reached (see code sample below).
If I comment that out the application runs untill it reaches 'XFlush' statement, see crash report below.

My presumption is that the application code is OK, after all it is part of a huge open source project OpenCASCADE
and I've not seen any reports on this sort of problem from people running it on Linuxes, Solaris or Windows.

So my thinking is that there is something wrong in my configuration or enviroment, or the way I link the Tcl,Tk&X11
libs to the application, or the way this code accesses them.

What I find strange is that the 'Draw_WindowDisplay' parameters that is passed to the crashing function 'XSyncronize'
has been returned from ' Tk_Display' a few line above, and looking with the debugger it looks like a bona fide address
AFAIU (0x2DA808). Moreover, the next function 'XSetInputFocus' seems to be totally happy with that pointer. If I
comment out the 'XSyncronize' the crash happens much later.

I'm lost here since my experience with X11 is limited, to say the least, though I've got some +25 years of C/C++/Java under my belt.

One hunch that I have is that somehow or other the code is using accessing wrong X11 libs from /usr/.... (there propably
are something there because I've used Fink to install some other packages) instead of the Apple Framework stuff.
Just a thought, don't realy understand how this is supposed to work.

The OpenCASCADE is a huge project (took 5 hours to compile on 2 GHZ dual core with 2 GB RAM) but amazingly
I had to do very minor adjustments to make it compile and link. Removed some malloc.h refs, fixed a wrong type
for 'pthread_t' and thats about it.

I also used the apple supplied glibtool and the linking and library building part all went smoothly.

So I expect I'm doing something right...;-)

Any ideas on what to check on my enviroment, installation, where to look for more information, how to debug, what to test?

br Kusti

// The configuration I used for building OpenCASCADE *********************************************

./configure 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 --x-includes=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-libraries=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib --with-x --with-tcl=/System/Library/Frameworks/Tcl.framework --with-tk=/System/Library/Frameworks/Tk.framework

// CODE SAMPLE FOLLOWS *****************************************************

Standard_Boolean Init_Appli()
{
theCommands.Init();
interp = theCommands.Interp();

Tcl_Init(interp) ;
try {
OCC_CATCH_SIGNALS
Tk_Init(interp) ;
} catch (Standard_Failure) {
cout }

Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);

mainWindow =
Tk_MainWindow(interp) ;
if (mainWindow == NULL) {
fprintf(stderr, "%s\n", interp->result);
exit(1);
}
Tk_Name(mainWindow) =
Tk_GetUid(Tk_SetAppName(mainWindow,
"Draw")) ;

Tk_GeometryRequest(mainWindow, 200, 200);

if (Draw_WindowDisplay == NULL) {
Draw_WindowDisplay = Tk_Display(mainWindow) ;
}
if (Draw_WindowDisplay == NULL) {
cout cout return Standard_False;
}
//
// synchronize the display server : could be done within Tk_Init
//

********* EXECPTION HAPPENS ON THE NEXT LINE *************
XSynchronize(Draw_WindowDisplay, True);

XSetInputFocus(Draw_WindowDisplay,
PointerRoot,
RevertToPointerRoot,
CurrentTime);

Draw_WindowScreen = DefaultScreen(Draw_WindowDisplay);
Draw_WindowColorMap = DefaultColormap(Draw_WindowDisplay,
Draw_WindowScreen);
tty = isatty(0);

// CRASH REPORT FOLLOWS *****************************************************************************
Date/Time: 2007-03-26 10:15:46.957 +0300
OS Version: 10.4.9 (Build 8P2137)
Report Version: 4

Command: DRAWEXE
Path: /usr/local/bin/DRAWEXE
Parent: bash [16286]

Version: ??? (???)

PID: 16287
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x5c637273

Thread 0 Crashed:
0 libX11.6.dylib 0x9cdcfd04 XFlush + 23
1 libTKDraw.0.dylib 0x01040fde Draw_Window::Flush() + 28 (Draw_Window.cxx:593)
2 libTKDraw.0.dylib 0x0103b797 Draw_Viewer::Flush() + 31 (Draw_Viewer.cxx:1123)
3 libTKDraw.0.dylib 0x01020294 Draw_Interprete(char*) + 370 (Draw.cxx:360)
4 libTKDraw.0.dylib 0x010203ba ReadInitFile(char*) + 98 (Draw.cxx:113)
5 libTKDraw.0.dylib 0x0102071d Draw_Appli(int, char**, void (*)(Draw_Interpretor&)) + 843 (Draw.cxx:248)
6 libTKDraw.0.dylib 0x0102e93e main_(int, char**, void (*)(Draw_Interpretor&)) + 44 (Draw_Main.cxx:179)
7 DRAWEXE 0x00002dfa main + 40 (DRAWEXE.cxx:23)
8 DRAWEXE 0x00002736 _start + 216
9 DRAWEXE 0x0000265d start + 41

Thread 1:
0 libSystem.B.dylib 0x9001a0ec select + 12
1 libSystem.B.dylib 0x90024147 _pthread_body + 84

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x5c637273 ebx: 0x01040fce ecx: 0x0000001d edx: 0x010373e0
edi: 0x15e23e29 esi: 0x002cd808 ebp: 0xbffff978 esp: 0xbffff960
ss: 0x0000001f efl: 0x00010202 eip: 0x9cdcfd04 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037

Binary Images Description:
0x1000 - 0x2fff DRAWEXE /usr/local/bin/DRAWEXE
0x1008000 - 0x1088fff libTKDraw.0.dylib /usr/local/lib/libTKDraw.0.dylib
0x1b1e000 - 0x1bc0fff libTKMesh.0.dylib /usr/local/lib/libTKMesh.0.dylib
0x274d000 - 0x2859fff libTKHLR.0.dylib /usr/local/lib/libTKHLR.0.dylib
0x41d5000 - 0x4704fff libTKGeomAlgo.0.dylib /usr/local/lib/libTKGeomAlgo.0.dylib
0x923d000 - 0x940efff libTKTopAlgo.0.dylib /usr/local/lib/libTKTopAlgo.0.dylib
0xb77b000 - 0xb819fff libTKBRep.0.dylib /usr/local/lib/libTKBRep.0.dylib
0xca1e000 - 0xce35fff libTKGeomBase.0.dylib /usr/local/lib/libTKGeomBase.0.dylib
0x105d6000 - 0x10640fff libTKG2d.0.dylib /usr/local/lib/libTKG2d.0.dylib
0x10f24000 - 0x11029fff libTKG3d.0.dylib /usr/local/lib/libTKG3d.0.dylib
0x121f5000 - 0x1236cfff libTKMath.0.dylib /usr/local/lib/libTKMath.0.dylib
0x1399a000 - 0x13b13fff libTKernel.0.dylib /usr/local/lib/libTKernel.0.dylib
0x8fe00000 - 0x8fe4afff dyld 46.12 /usr/lib/dyld
0x90000000 - 0x90172fff libSystem.B.dylib /usr/lib/libSystem.B.dylib

TRUNCATED BECAUSE OF mailing list limitations...

Gerd28's picture

Hi Kustaa,

I really don't have any idea about X11-programming, but you used the libs in the SDK to link against:

"-with-gl-include=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-includes=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-libraries=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib..."

this libs are not fully functional libs, like this post on Apple's mailing list says:

http://lists.apple.com/archives/x11-users/2007/Mar/msg00047.html

From what I know the 'isysroot'-flag does the same like choosing the SDK in the Xcode project settings, so that should do no harm. But even there you have to import the used framework from either '/Library/Frameworks' or '/System/Library/Frameworks' to build a working executable.

I have no idea, if that will fix your problem, but it's worth a try.

It would be very nice to have a way to compile OCC without the '.comp'-files on the mac. If you could make your changes available, I would like to test, if they work on my G5.

Best Regards,
Gerd

Kustaa Nyholm's picture

Hi Gerd,

sorry I haven't been able to respond earlier. I'm happy to share my build process, please try it and share your experiences.

Annoted Notes on Porting OpenCASCADE 6.2 to Mac OS X 10.4.9 on Dual Core Intel
=============================================================================

This is realy not a 'how to' instructions on porting OpenCASCADE to Mac OS X,
rather this is a quick web page of my notes on how I was able to do it. Porting something like OpenCASCADE
is not for the faint harted or newbies. At this point in time, I'm able to compile, link, start and debug
the example applications but have not yet succesfully actually run the DRAWEXE test harness.
And it has taken me four weeks of sparetime to get here! And this is a mature software package
that presumably compiles without problems on many systems.

I'm sharing this in the hope that:
a) someone else can benefit from these
b) that someone tests these and provides feedback
c) someday the standard distribution will work out-of-the-box on Mac as it should

My system is:
MacBook Pro Dual Core 2 GHz / 2 GB / 160 GB
Mac OS X 10.4.9
Xcode 2.4.1
BSDSDK.pkg
X11SDK.pkg

I've installed the BSD.pkg
X11.pkg
OpenCASCADE source code is from the Linux distribution

I don't think it is necessary, but I've copied the following files to the 'ros' directory overwriting those that
came with the OpenCASCADE distribution.

/usr/share/libtool/config.sub
/usr/share/libtool/config.guess

Step 1: apply the patches at the end of these notes
---------------------------------------------------

Nothing major, minor tweaks to 'configure', fixed a bad path reference to Java headers,
removed a couple of redundant 'malloc.h' refs from some source files, fixed the type of 'GetThreadID()' to pthread_t.
Haven't tested if these break things on Linux/Windows, but this should be trivial to fix if it
happens. I also think that these are things that 'ought' to be be incorporated into the standard
distribution, as malloc.h is obsolete anyway, GetCurrentThreadId() return 'pthread_t', not integer, so this
plainly wrong although obviously int/Standard_Integer works on Linux/Windows. The Java header path problem in
the configure file maybe something that is different in Mac OS but I doubt it, Apple people seem to be
pretty pedantic in following standards.

Step 2: configure as follows
----------------------------

./configure CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" LDFLAGS="-arch i386" --with-gl-include=/usr/X11R6/include --x-includes=/usr/X11R6/lib/include --x-libraries=/usr/X11R6/lib --with-x --with-tcl=/System/Library/Frameworks/Tcl.framework --with-tk=/System/Library/Frameworks/Tk.framework --with-java-include=/System/Library/Frameworks/JavaVM.framework

Step 3: fix libtool as follows
------------------------------

in the 'ros' directory type:

rm libtool
ln -s `which glibtool` ./libtool

glibtool expects the following, so I added it in ~/.profile

export MACOSX_DEPLOYMENT_TARGET=10.4

Step 4: make and install as usual
---------------------------------

in the 'ros' directory type:

make
sudo make install

Note that the 'make' alone takes about 5 hours on 2 GHz machine and the make install some 20 minutes!

At the end of this you hopefully have the a buch of files on your system as follows:

ls /usr/local/bin
DRAWEXE env_DRAW.sh wokprocess woksh

ls /usr/local/lib

libBinLPlugin.0.0.0.dylib libTKBinXCAF.dylib libTKFillet.0.dylib libTKOffset.la libTKShapeSchema.a libTKXCAFSchema.0.0.0.dylib libXmlLPlugin.dylib
libBinLPlugin.0.dylib libTKBinXCAF.la libTKFillet.a libTKOpenGl.0.0.0.dylib libTKShapeSchema.dylib libTKXCAFSchema.0.dylib libXmlLPlugin.la
libBinLPlugin.a libTKBool.0.0.0.dylib libTKFillet.dylib libTKOpenGl.0.dylib libTKShapeSchema.la libTKXCAFSchema.a libXmlPlugin.0.0.0.dylib
libBinLPlugin.dylib libTKBool.0.dylib libTKFillet.la libTKOpenGl.a libTKStdLSchema.0.0.0.dylib libTKXCAFSchema.dylib libXmlPlugin.0.dylib
libBinLPlugin.la libTKBool.a libTKG2d.0.0.0.dylib libTKOpenGl.dylib libTKStdLSchema.0.dylib libTKXCAFSchema.la libXmlPlugin.a
libBinPlugin.0.0.0.dylib libTKBool.dylib libTKG2d.0.dylib libTKOpenGl.la libTKStdLSchema.a libTKXDEDRAW.0.0.0.dylib libXmlPlugin.dylib
libBinPlugin.0.dylib libTKBool.la libTKG2d.a libTKPCAF.0.0.0.dylib libTKStdLSchema.dylib libTKXDEDRAW.0.dylib libXmlPlugin.la
libBinPlugin.a libTKCAF.0.0.0.dylib libTKG2d.dylib libTKPCAF.0.dylib libTKStdLSchema.la libTKXDEDRAW.a libXmlXCAFPlugin.0.0.0.dylib
libBinPlugin.dylib libTKCAF.0.dylib libTKG2d.la libTKPCAF.a libTKStdSchema.0.0.0.dylib libTKXDEDRAW.dylib libXmlXCAFPlugin.0.dylib
libBinPlugin.la libTKCAF.a libTKG3d.0.0.0.dylib libTKPCAF.dylib libTKStdSchema.0.dylib libTKXDEDRAW.la libXmlXCAFPlugin.a
libBinXCAFPlugin.0.0.0.dylib libTKCAF.dylib libTKG3d.0.dylib libTKPCAF.la libTKStdSchema.a libTKXDEIGES.0.0.0.dylib libXmlXCAFPlugin.dylib
libBinXCAFPlugin.0.dylib libTKCAF.la libTKG3d.a libTKPLCAF.0.0.0.dylib libTKStdSchema.dylib libTKXDEIGES.0.dylib libXmlXCAFPlugin.la
libBinXCAFPlugin.a libTKCDF.0.0.0.dylib libTKG3d.dylib libTKPLCAF.0.dylib libTKStdSchema.la libTKXDEIGES.a libmscmd.0.0.0.dylib
libBinXCAFPlugin.dylib libTKCDF.0.dylib libTKG3d.la libTKPLCAF.a libTKTCPPExt.0.0.0.dylib libTKXDEIGES.dylib libmscmd.0.dylib
libBinXCAFPlugin.la libTKCDF.a libTKGeomAlgo.0.0.0.dylib libTKPLCAF.dylib libTKTCPPExt.0.dylib libTKXDEIGES.la libmscmd.a
libFWOSPlugin.0.0.0.dylib libTKCDF.dylib libTKGeomAlgo.0.dylib libTKPLCAF.la libTKTCPPExt.a libTKXDESTEP.0.0.0.dylib libmscmd.dylib
libFWOSPlugin.0.dylib libTKCDF.la libTKGeomAlgo.a libTKPShape.0.0.0.dylib libTKTCPPExt.dylib libTKXDESTEP.0.dylib libmscmd.la
libFWOSPlugin.a libTKCDLFront.0.0.0.dylib libTKGeomAlgo.dylib libTKPShape.0.dylib libTKTCPPExt.la libTKXDESTEP.a libwokcmd.0.0.0.dylib
libFWOSPlugin.dylib libTKCDLFront.0.dylib libTKGeomAlgo.la libTKPShape.a libTKTopAlgo.0.0.0.dylib libTKXDESTEP.dylib libwokcmd.0.dylib
libFWOSPlugin.la libTKCDLFront.a libTKGeomBase.0.0.0.dylib libTKPShape.dylib libTKTopAlgo.0.dylib libTKXDESTEP.la libwokcmd.a
libPTKernel.0.0.0.dylib libTKCDLFront.dylib libTKGeomBase.0.dylib libTKPShape.la libTKTopAlgo.a libTKXSBase.0.0.0.dylib libwokcmd.dylib
libPTKernel.0.dylib libTKCDLFront.la libTKGeomBase.a libTKPrim.0.0.0.dylib libTKTopAlgo.dylib libTKXSBase.0.dylib libwokcmd.la
libPTKernel.a libTKCPPClient.0.0.0.dylib libTKGeomBase.dylib libTKPrim.0.dylib libTKTopAlgo.la libTKXSBase.a libwokdeliverysteps.0.0.0.dylib
libPTKernel.dylib libTKCPPClient.0.dylib libTKGeomBase.la libTKPrim.a libTKTopTest.0.0.0.dylib libTKXSBase.dylib libwokdeliverysteps.0.dylib
libPTKernel.la libTKCPPClient.a libTKHLR.0.0.0.dylib libTKPrim.dylib libTKTopTest.0.dylib libTKXSBase.la libwokdeliverysteps.a
libStdLPlugin.0.0.0.dylib libTKCPPClient.dylib libTKHLR.0.dylib libTKPrim.la libTKTopTest.a libTKXSDRAW.0.0.0.dylib libwokdeliverysteps.dylib
libStdLPlugin.0.dylib libTKCPPClient.la libTKHLR.a libTKSTEP.0.0.0.dylib libTKTopTest.dylib libTKXSDRAW.0.dylib libwokdeliverysteps.la
libStdLPlugin.a libTKCPPExt.0.0.0.dylib libTKHLR.dylib libTKSTEP.0.dylib libTKTopTest.la libTKXSDRAW.a libwokdfltsteps.0.0.0.dylib
libStdLPlugin.dylib libTKCPPExt.0.dylib libTKHLR.la libTKSTEP.a libTKV2d.0.0.0.dylib libTKXSDRAW.dylib libwokdfltsteps.0.dylib
libStdLPlugin.la libTKCPPExt.a libTKIDLFront.0.0.0.dylib libTKSTEP.dylib libTKV2d.0.dylib libTKXSDRAW.la libwokdfltsteps.a
libStdPlugin.0.0.0.dylib libTKCPPExt.dylib libTKIDLFront.0.dylib libTKSTEP.la libTKV2d.a libTKXml.0.0.0.dylib libwokdfltsteps.dylib
libStdPlugin.0.dylib libTKCPPExt.la libTKIDLFront.a libTKSTEP209.0.0.0.dylib libTKV2d.dylib libTKXml.0.dylib libwokdfltsteps.la
libStdPlugin.a libTKCPPIntExt.0.0.0.dylib libTKIDLFront.dylib libTKSTEP209.0.dylib libTKV2d.la libTKXml.a libwokobjssteps.0.0.0.dylib
libStdPlugin.dylib libTKCPPIntExt.0.dylib libTKIDLFront.la libTKSTEP209.a libTKV3d.0.0.0.dylib libTKXml.dylib libwokobjssteps.0.dylib
libStdPlugin.la libTKCPPIntExt.a libTKIGES.0.0.0.dylib libTKSTEP209.dylib libTKV3d.0.dylib libTKXml.la libwokobjssteps.a
libTKAdvTools.0.0.0.dylib libTKCPPIntExt.dylib libTKIGES.0.dylib libTKSTEP209.la libTKV3d.a libTKXmlL.0.0.0.dylib libwokobjssteps.dylib
libTKAdvTools.0.dylib libTKCPPIntExt.la libTKIGES.a libTKSTEPAttr.0.0.0.dylib libTKV3d.dylib libTKXmlL.0.dylib libwokobjssteps.la
libTKAdvTools.a libTKCPPJini.0.0.0.dylib libTKIGES.dylib libTKSTEPAttr.0.dylib libTKV3d.la libTKXmlL.a libwokorbixsteps.0.0.0.dylib
libTKAdvTools.dylib libTKCPPJini.0.dylib libTKIGES.la libTKSTEPAttr.a libTKVRML.0.0.0.dylib libTKXmlL.dylib libwokorbixsteps.0.dylib
libTKAdvTools.la libTKCPPJini.a libTKLCAF.0.0.0.dylib libTKSTEPAttr.dylib libTKVRML.0.dylib libTKXmlL.la libwokorbixsteps.a
libTKBO.0.0.0.dylib libTKCPPJini.dylib libTKLCAF.0.dylib libTKSTEPAttr.la libTKVRML.a libTKXmlXCAF.0.0.0.dylib libwokorbixsteps.dylib
libTKBO.0.dylib libTKCPPJini.la libTKLCAF.a libTKSTEPBase.0.0.0.dylib libTKVRML.dylib libTKXmlXCAF.0.dylib libwokorbixsteps.la
libTKBO.a libTKCSFDBSchema.0.0.0.dylib libTKLCAF.dylib libTKSTEPBase.0.dylib libTKVRML.la libTKXmlXCAF.a libwoksteps.0.0.0.dylib
libTKBO.dylib libTKCSFDBSchema.0.dylib libTKLCAF.la libTKSTEPBase.a libTKViewerTest.0.0.0.dylib libTKXmlXCAF.dylib libwoksteps.0.dylib
libTKBO.la libTKCSFDBSchema.a libTKMath.0.0.0.dylib libTKSTEPBase.dylib libTKViewerTest.0.dylib libTKXmlXCAF.la libwoksteps.a
libTKBRep.0.0.0.dylib libTKCSFDBSchema.dylib libTKMath.0.dylib libTKSTEPBase.la libTKViewerTest.a libTKernel.0.0.0.dylib libwoksteps.dylib
libTKBRep.0.dylib libTKCSFDBSchema.la libTKMath.a libTKSTL.0.0.0.dylib libTKViewerTest.dylib libTKernel.0.dylib libwoksteps.la
libTKBRep.a libTKDCAF.0.0.0.dylib libTKMath.dylib libTKSTL.0.dylib libTKViewerTest.la libTKernel.a libwoktoolscmd.0.0.0.dylib
libTKBRep.dylib libTKDCAF.0.dylib libTKMath.la libTKSTL.a libTKWOK.0.0.0.dylib libTKernel.dylib libwoktoolscmd.0.dylib
libTKBRep.la libTKDCAF.a libTKMesh.0.0.0.dylib libTKSTL.dylib libTKWOK.0.dylib libTKernel.la libwoktoolscmd.a
libTKBin.0.0.0.dylib libTKDCAF.dylib libTKMesh.0.dylib libTKSTL.la libTKWOK.a libTKjcas.0.0.0.dylib libwoktoolscmd.dylib
libTKBin.0.dylib libTKDCAF.la libTKMesh.a libTKService.0.0.0.dylib libTKWOK.dylib libTKjcas.0.dylib libwoktoolscmd.la
libTKBin.a libTKDraw.0.0.0.dylib libTKMesh.dylib libTKService.0.dylib libTKWOK.la libTKjcas.a libwokutilscmd.0.0.0.dylib
libTKBin.dylib libTKDraw.0.dylib libTKMesh.la libTKService.a libTKWOKTcl.0.0.0.dylib libTKjcas.dylib libwokutilscmd.0.dylib
libTKBin.la libTKDraw.a libTKMeshVS.0.0.0.dylib libTKService.dylib libTKWOKTcl.0.dylib libTKjcas.la libwokutilscmd.a
libTKBinL.0.0.0.dylib libTKDraw.dylib libTKMeshVS.0.dylib libTKService.la libTKWOKTcl.a libXCAFPlugin.0.0.0.dylib libwokutilscmd.dylib
libTKBinL.0.dylib libTKDraw.la libTKMeshVS.a libTKShHealing.0.0.0.dylib libTKWOKTcl.dylib libXCAFPlugin.0.dylib libwokutilscmd.la
libTKBinL.a libTKFeat.0.0.0.dylib libTKMeshVS.dylib libTKShHealing.0.dylib libTKWOKTcl.la libXCAFPlugin.a
libTKBinL.dylib libTKFeat.0.dylib libTKMeshVS.la libTKShHealing.a libTKXCAF.0.0.0.dylib libXCAFPlugin.dylib
libTKBinL.la libTKFeat.a libTKOffset.0.0.0.dylib libTKShHealing.dylib libTKXCAF.0.dylib libXCAFPlugin.la
libTKBinXCAF.0.0.0.dylib libTKFeat.dylib libTKOffset.0.dylib libTKShHealing.la libTKXCAF.a libXmlLPlugin.0.0.0.dylib
libTKBinXCAF.0.dylib libTKFeat.la libTKOffset.a libTKShapeSchema.0.0.0.dylib libTKXCAF.dylib libXmlLPlugin.0.dylib
libTKBinXCAF.a libTKFillet.0.0.0.dylib libTKOffset.dylib libTKShapeSchema.0.dylib libTKXCAF.la libXmlLPlugin.a

Step 5: try itk, doesn't work for me yet
----------------------------------------

The mmap fails for some reason so I configure occ not to use it.

Some settings are essential, or so I think, so I modified my ~/.profile to include:

export MMGT_MMAP=0
export CASROOT=/Users/nyholku/OpenCASCADE_Linux/Linux/ros

I believe the above is essential but I also included the following:

OS_NAME=`uname`
export CSF_MDTVFontDirectory=$CASROOT/src/FontMFT
export CSF_LANGUAGE=us
export MMGT_CLEAR=1
export CSF_EXCEPTION_PROMPT=1
export CSF_SHMessage=$CASROOT/src/SHMessage
export CSF_MDTVTexturesDirectory=$CASROOT/src/Textures
export CSF_XSMessage=$CASROOT/src/XSMessage
export CSF_StandardDefaults=$CASROOT/src/StdResource
export CSF_PluginDefaults=$CASROOT/src/StdResource
export CSF_XCAFDefaults=$CASROOT/src/StdResource
export CSF_StandardLiteDefaults=$CASROOT/src/StdResource
export CSF_GraphicShr=$CASROOT/$OS_NAME/lib/libTKOpenGl.so
export CSF_UnitsLexicon=$CASROOT/src/UnitsAPI/Lexi_Expr.dat
export CSF_UnitsDefinition=$CASROOT/src/UnitsAPI/Units.dat
export CSF_IGESDefaults=$CASROOT/src/XSTEPResource
export CSF_STEPDefaults=$CASROOT/src/XSTEPResource
export CSF_XmlOcafResource=$CASROOT/src/XmlOcafResource

That's about it. The /usr/local/bin/DRAWEXE on my machine starts by fails on the first call to XSyncronize,
or if I comment that out, in the first call to XFlush. Other X11 applications work fine
so at the moment I do not know how to proceed. I can single step / break point the DRAWEXE
with Xcode so I see what is going on but so far have not figured out what is the problem.

br Kusti

// configure diff / patch -------------------------------------------------------------
--- OpenCASCADE_Linux2/Linux/ros/configure 2007-03-25 09:23:24.000000000 +0300
+++ OpenCASCADE_Linux/Linux/ros/configure 2007-03-28 17:45:14.000000000 +0300
@@ -9611,7 +9611,8 @@
X_INCLUDE="-I$ac_x_includes"
fi
if test "x$ac_x_libraries" = "x"; then
- X_LIBS="-lXt -lX11"
+ #KUSTI: tässä oli -lXt -lX11, mutta ei toimi macissä
+ X_LIBS="-L/usr/X11R6/lib -lX11"
else
X_LIBS="-L$ac_x_libraries -lXt -lX11"
fi
@@ -13886,7 +13887,8 @@

else
echo "No --with-gl-library=DIR was specified"
-CSF_OpenGlLibs_LIB="-lGLU -lGL"
+#KUSTI: Tässä oli '-lGLU -lGL' ei toimi mäkissä
+CSF_OpenGlLibs_LIB=""
fi;

ac_ext=c
@@ -13970,7 +13972,7 @@
JAVA_INCLUDE=`(cd ${with_java_include}; pwd)`
JAVA_INCLUDE_PLAT=`(find ${with_java_include} -name jni_md.h | sed 's/\.\///' | sed 's/\/jni_md.h//')`
if test x"$JAVA_INCLUDE_PLAT" != x"" ; then
- JAVA_INCLUDE="-I${JAVA_INCLUDE} -I${JAVA_INCLUDE_PLAT}"
+ JAVA_INCLUDE="-I${JAVA_INCLUDE} -I${JAVA_INCLUDE}/Headers"
else
echo "Assuming Java headers are in the compiler's search path..."
fi

// source diff / patch ------------------------------------------------------------------

diff -Naur OpenCASCADE_Linux2/Linux/ros/src/OpenGl/OpenGl_togl_begin_layer_mode.c OpenCASCADE_Linux/Linux/ros/src/OpenGl/OpenGl_togl_begin_layer_mode.c
--- OpenCASCADE_Linux2/Linux/ros/src/OpenGl/OpenGl_togl_begin_layer_mode.c 2007-03-25 09:22:56.000000000 +0300
+++ OpenCASCADE_Linux/Linux/ros/src/OpenGl/OpenGl_togl_begin_layer_mode.c 2007-03-24 17:52:40.000000000 +0200
@@ -19,7 +19,6 @@
* Includes
*/

-#include

#include

diff -Naur OpenCASCADE_Linux2/Linux/ros/src/OpenGl/OpenGl_togl_markercontextgroup.c OpenCASCADE_Linux/Linux/ros/src/OpenGl/OpenGl_togl_markercontextgroup.c
--- OpenCASCADE_Linux2/Linux/ros/src/OpenGl/OpenGl_togl_markercontextgroup.c 2007-03-25 09:22:56.000000000 +0300
+++ OpenCASCADE_Linux/Linux/ros/src/OpenGl/OpenGl_togl_markercontextgroup.c 2007-03-24 17:55:41.000000000 +0200
@@ -39,7 +39,6 @@

#include
#include
-#include

typedef struct
{
diff -Naur OpenCASCADE_Linux2/Linux/ros/src/Standard/Standard_ErrorHandler.cxx OpenCASCADE_Linux/Linux/ros/src/Standard/Standard_ErrorHandler.cxx
--- OpenCASCADE_Linux2/Linux/ros/src/Standard/Standard_ErrorHandler.cxx 2007-03-25 09:23:00.000000000 +0300
+++ OpenCASCADE_Linux/Linux/ros/src/Standard/Standard_ErrorHandler.cxx 2007-03-24 09:09:07.000000000 +0200
@@ -30,7 +30,7 @@
// would register mutex as callback in the current exception handler
static Standard_Mutex theMutex;

-static inline Standard_Integer GetThreadID()
+static inline pthread_t GetThreadID()
{
#ifndef WNT
return pthread_self();
@@ -212,7 +212,7 @@
Standard_ErrorHandler* aCurrent = Top;
Standard_ErrorHandler* anActive = 0;
Standard_Boolean aStop = Standard_False;
- Standard_Integer aTreadId = GetThreadID();
+ pthread_t aTreadId = GetThreadID();

// searching an exception with correct ID number
// which is not processed for the moment

Torsten Sadowski's picture

Hello Kustaa,

I have not yet had time to test 6.2 (I only saw it was out today).

It is possible that DRAWEXE does not work because Tk.framework is not a X11 Tk. Its just a guess but I'm using Fink's Tk and it works for me.

As for MMap I just did realize I did not use it :-) but I had it in 5.2. I have to dig up the sources again.

You could have mailed me directly. Depending on my workload I can't follow this Forum all the time.

Cheers, Torsten

Kustaa Nyholm's picture

Hi Thorsten,

thanks for you reply and tip about Tk. As my goal is to use OCC from Java and I've managed to get the jCae occjava bindings
to compile and work on Mac OS I'm pursuing this path at the moment. DRAWEXE and the issues with it were just a 'side effect' for me.
See:
http://sourceforge.net/forum/forum.php?thread_id=1707823&forum_id=253752

If you know of any other usable Java binding I would be interested.

I've tried the package refererred in the end of this thread:

http://www.opencascade.org/org/forum/thread_10003/

which I can compile and link, but when trying to run the Java code I get UnsatisfiedLinkError,

which I have not been able to solve as explained in this thread:

http://lists.apple.com/archives/java-dev/2007/Apr/msg00016.html

br Kusti

Torsten Sadowski's picture

Hi Kustaa,

sorry, I don't know of more java bindings. If you want a native interface on the Mac jcae might be your only option because the OCC java sample displays the X11! OpenGL window in a java canvas. I had those UnsatisfiedLinkError problems with another program on Linux and there a -Djava.library.path= in the command line solved the problem.

Cheers, Torsten

Gerd28's picture

Hi Kustaa,

sorry for me replying so late, but the 'Notify me about new messages in this thread'-function of the forum didn't work right, and then I was very busy fixing my main project the last weeks.

So here is what I experienced:

The diffs didn't work so well - there is something of the formatting lost, I guess. So I applied them manually.
I had to fix 2 things: There was a illegal comparison between Standard_Integer and Pointer in Standard_ErrorHandler.cxx. I fixed it "somehow" (my C++ is not much better than being able to write hello world), so it would be best, if others should run into that too, if a real programmer would fix that.
The other thing was linking DRAWEXE: It didn't get the X11-lib, I fixed that in the makefile(DRAWEXE_LDFLAGS = -L/usr/X11R6/lib -lX11).

Here comes the good news: It is pretty easy to fix the problem with crashing DRAWEXE. All you need is the Tcl and Tk from fink, like Torsten said. While in /usr/local/bin you just do:

sudo install_name_tool -change /System/Library/Frameworks/Tcl.framework/Versions/8.4/Tcl /sw/lib/libtcl8.4.dylib DRAWEXE
sudo install_name_tool -change /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk /sw/lib/libtk8.4.dylib DRAWEXE

To launch it, you have to launch X11.App first and do: "export DISPLAY=":0.0" (otherwise I get 'this isn't a Tk application').

It still does not work right on my Mac, I get the menues, but can't select them - but that is the same with Torstens version, too. I guess it's something with the environment still not right. Oh, I forgot to mention, that I didn't get the env_DRAW.sh either way.

My disk got pretty full with all the OCC versions, when I have deleted some of that, I will build our app against your libs and post later, if that works.

Cheers,
Gerd

Adam OHern's picture

I'm a faint-hearted Newbie. Is there any hope for me to use OpenCascade on my dual core iMac?