For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

OCC 6.2 on Mac OSX patches and build scripts

Torsten Sadowski's picture

Hi,

I updated my patches to OpenCASCADE 6.2. As usual you need a Linux install first from which you can copy.

I came across 2 special problems:

In the file Standard_ErrorHandler.cxx I had to use a C type cast:

return (Standard_Integer)pthread_self();

The return value is a pointer to a struct so casting might or might not be dangerous. So far I did not try multithreading.

MMGT_OPT is disabled for __APPLE__ in Standard.cxx. I reenabled it and it seems that mmap()ed memory management is working.

Cheers, Torsten

jacob's picture

Hi,

is there a universal build for Mac OX version for opencacade.

Jacob.

Torsten Sadowski's picture

Hi Jacob,

why do you need a universal build for a source package?

Cheers, Torsten

Sylvain Marie's picture

Hi,

I also need the universal build of OCC 6.2 :-) Some of our clients are still PPC based and other switched on I386 already.

BTW Torsten thank you for the patches ! :-) They work well if the exotic Comp build from OCC is used (but create only i386 binaries).

I tried to use "configure" on the patched src tree, with the parameters mentioned on the apple tech note (http://developer.apple.com/technotes/tn2005/tn2137.html) to create universal binaries, but for some reason only the i386 architecture is created.

Any hint ?

Thank you in advance.
Sylvain

Torsten Sadowski's picture

Hello Sylvain,

which binary is created depends on the build machine. But, could you try to add " -arch i386 -arch ppc" to the sed lines in OpenCASCADE_darwin.sh and try out what happens?

Cheers, Torsten

P.S. What are you doing with OCC?

Sylvain Marie's picture

Hi Torsten,

[ Sorry for the late answer. It seems that the automatic notification system didn't work :-/ ]

Thanks for the tip, I now get fat binaries ! :-)

However, I now must find a way to set their "install_name" property to something like @executable_path/../Frameworks/... instead of the current /var/tmp//cc7IslRW.out

As my last experience with sed and reg exps was a long time ago, I need to refresh my skills before sending you the updated OpenCASCADE_darwin.sh with proper install names :-)

OCC 6.2 is used to port the HumanCAD software on Macs (http://www.nexgenergo.com/ergonomics/humancad.html)

Sylvain

Torsten Sadowski's picture

Hello Sylvain,

do you get this strange install_name when you run my scripts? If this is the case you need to run the install_name_tool right after linking the libraries. The later libraries take the install names from the libraries they are linked against. To make this a bit more clear:

g++ -o libTKernel.dylib .....
install_name_tool -id @executable_path/../Frameworks/libTKernel.dylib
g++ -o libTKMath.dylib ... -lTKernel ...
install_name_tool -id ...

Cheers, Torsten

P.S. sed is tough but its the only tool I know to do the job

Sylvain Marie's picture

Hi Torsten,

After quite a few trials, I got sed to patch the makefile to set the install_path :-)

The modified file is OpenCASCADE_darwin.sh.
I can't find a way to attach a file on this forum, so I'm pasting the modified file here.
Please feel free to update your distribution on your webpage (if you're pleased with the touch up, of course)

----------------------------------------------------------------------------------------------------------------
#!/bin/sh

mkdir -p $CASROOT/adm/`uname`/

mkdir -p $CASROOT/Darwin/lib
ln -s $CASROOT/Darwin/lib/ $CASROOT/Darwin/Frameworks

cd $CASROOT/adm/Linux/

for text_file in *
do
echo "Editing file $text_file"
sed -e 's/Linux/Darwin/g' -e 's/COMP/XCOMP/g' \
-e 's/-DLININTEL/-gdwarf-2 -arch i386 -arch ppc/g' \
-e 's/-DLIN//g' \
-e 's?-I${JAVAHOME}/include/linux?-I${JAVAHOME}/Headers -I${X11_INCLUDE} ?g' \
-e 's/-shared/-dynamiclib -Wl,-single_module -arch i386 -arch ppc/g' \
-e 's/\.so /\.dylib /g' \
-e 's?-L/usr/X11R6/lib?-L/usr/X11R6/lib -lX11?g' \
-e 's/-MD//g' \
-e 's/[a-zA-Z0-9]*\.dylib/& -install_name @executable_path\/\.\.\/Frameworks\/& -Wl,-executable_path \${CASROOT}\/Darwin\/lib/g' \
$text_file > ../`uname`/$text_file
# mv -f temp $text_file
done

cd ../Darwin

sed -e 's/-ldl/-ldl -L${X11_LIB} -lX11/g' TKDraw.lnk > temp
mv temp TKDraw.lnk
sed -e 's/-ldl/-ldl -L${X11_LIB} -lX11/g' DRAWEXE.lnk > temp
mv temp DRAWEXE.lnk

cd ../../..

----------------------------------------------------------------------------------------------------------------

Michael Rice's picture

Hi Torsten -

Could you please let me know where I can download your patches for Mac? I'd like to get OCC 6.2 built on Leopard.

Thanks.
Michael

Torsten Sadowski's picture

Hi Michael,

sorry for the late reply.

The patches are found here:

http://keepcool.kup.tu-berlin.de/public/mitarbeiter/sadowski/OCC62_Mac_Install.tar.gz

I have not yet had time to add the universal build changes.

Cheers, Torsten