How to build OpenCASCADE on MAC (Mountain Lion)

3.3k views Asked by At

I am trying to build OpenCASCADE on Mac, but I am not having any luck.

I downloaded it from Github in tar.gz, but I am really new to Mac and I am stuck.

Can anybody explain what should be my next step?

(I found some terminal commands what I should use, but I am not familiar with them. So if it is the right way to build OpenCASCADE on Mac please write down the terminal commands with details. Thank you!)

EDIT:

I understood the command line commands now from the link below. I understood it before too, but I was mistaken, because my main problem was, that I didn't had gcc installed (XCode does not installs gcc automatically...). So anyways, now finally I can run the cmake command. It starts but it ends with this:

CMake Error at /Applications/CMake 2.8-9.app/Contents/share/cmake-2.8/Modules/FindX11.cmake:420 (MESSAGE): Could not find X11 Call Stack (most recent call first): CMakeLists.txt:313 (FIND_PACKAGE)

Anybody have any idea what to do? I tryed to search this too here, and google...and I found some "solutions" but those didn't work for me.

EDIT EDIT:

The solution for the last edit is that Mountain Lion doesn't install X11. So open up an app that uses X11 or Xquartz and it will install automatically.

Unfortunetly it still doesn't work. My next error message is the following after the make command in terminal:

In file included from /Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/src/AlienImage/AlienImage_X11XWDAlienData.cxx:14: /Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/inc/Aspect_XWD.hxx:5:12: fatal error: 'X11/XWDFile.h' file not found # include ^ 1 error generated. make[2]: * [adm/cmake/TKService/CMakeFiles/TKService.dir/_/_/__/src/AlienImage/AlienImage_X11XWDAlienData.cxx.o] Error 1 make1: [adm/cmake/TKService/CMakeFiles/TKService.dir/all] Error 2 make: ** [all] Error 2

Any ideas how to fix this?

3

There are 3 answers

2
Silex On BEST ANSWER

I spent a little time on this and I think I have it. Here is what I did step by step:

Preparation phase:

  • Installing Xcode (with command line tools) = Apple developer site // If Xcode doesn't install gcc, than you can still download it from the developer site as Command Line Tools for Xcode.

  • Installing Cmake (with command line tools) = Google // You can download it from the official site with a .dmg/.pkg file extension. Easy install.

  • X11 under Mountain Lion "changed" to Xquartz. Probably it is not installed by default, but it is easy to check it. Just go to the folder "Application" and start the X11 app. If X11/Xquartz is not installed than it will install automatically!

  • Installing FTGL = MacPorts = Google // Download MacPorts from their official site, install it with the installer, than write this to the terminal:

sudo port install ftgl

Installing phase:

I. Open Terminal.

II. Run this command // This will set the proper PATH.

ln -s /opt/X11/include/X11 /usr/local/include/X11

III. Than from the Terminal go to the directory where you extracted the OCE file (the original extracted file name should be: tpaviot-oce-6c9a06a).

IV. Than write these commands: // You make a build directory to the extracted OCE folder.

mkdir build 
cd build

V. After this you give out the cmake command:

cmake -DOCE_INSTALL_PREFIX:PATH=$HOME/OCE  \
    -DOCE_WITH_FREEIMAGE:BOOL=ON \
    -DOCE_WITH_GL2PS:BOOL=ON \
    -DOCE_DRAW:BOOL=ON \
    ..

VI. And at the end the make commands:

make
make install/strip

If you did everything exactly like this, than it should work!

3
Jelle On

Give OCE a try. Compiling for osx is a walk in the park

2
stefkeB On

Ensure that, together with XCode, you also install the X11 support from Apple's Devtools. Your error message is indicating that it is missing.

FWIW, I have written a blog post about OCC and PythonOCC on Mac some time ago. Maybe you'll find some detailed info there.

http://cad-3d.blogspot.com/2011/10/pythonocc-open-source-interactive-cad.html

In this post, I still talk about using the binary installer, but recent updates to the OCE edition compile usually without problems out-of-the-box, also on OSX (that is NOT the case with the official OpenCASCADE release).