Mac Compile Help

Having trouble installing or compiling FreeCAD? Get help here.
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 4:44 pm

I'm trying to follow the wiki instructions for Mac and mixing in some of the instructions from Unix. I've tried to follow a couple of the other threads on Mac compiling, but they're pretty long with information spread all over the place. If I can get this to work I'll summarize and post the information so the wiki can be updated.

My attempts so far are using Macports.

I'm able to compile OpenCascade just fine.

Running autogen.sh I get a bunch of errors like this
src/Mod/Robot/App/Makefile.am:17: warning: source file 'kdl_cp/velocityprofile_traphalf.cpp' is in a subdirectory,
src/Mod/Robot/App/Makefile.am:17: but option 'subdir-objects' is disabled
The sample configure command on the wiki has a path to Qt
/usr/local/Trolltech/Qt-4.8.0
but mine is
/usr/local/Qt4.8
so I updated the configre command accordingly, but when I run configure, here are a few errors I'm getting
checking for eigen3... checking for /usr/include/eigen3/Eigen... no
checking for /usr/local/include/eigen3... no
checking Eigen/Eigenvalues usability... no
checking Eigen/Eigenvalues presence... no
checking for Eigen/Eigenvalues... no
configure: WARNING:
**** Cannot find eigen3 devel files.
Modules that depend on this library cannot be built. ****
I have eigen3 installed via macports and also downloaded from the website and copied the Eigen directory as stated in the wiki
checking whether Qt is installed as framework... yes
checking whether QtWebKit is available... yes
checking for Qt >= 4.3... configure: error: Cannot find Qt meta object compiler (moc), bye...
I have qt4-mac installed via macports and also tried downloading and installing Qt


I also gave it a shot using cmake as in the Unix instructions
-- prefix: /usr/local
-- datadir: data
-- docdir: doc
-- includedir: include
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- regex
-- signals
-- system
-- thread
-- Found Xerces-C: /opt/local/lib/libxerces-c.dylib
-- PyCXX found:
-- Headers: /Users/james/Documents/Source/FreeCAD/src
-- Sources: /Users/james/Documents/Source/FreeCAD/src/CXX
-- OpenCASCADE Community Edition has been found.
-- Could NOT find Spnav (missing: SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
matplotlib not found, Plot module will not available until matplotlib is installed!
-- Platform is 64-bit, set -D_OCC64
-- DEBUG: -g -DFC_DEBUG
git
/Users/james/Documents/Source/FreeCAD/src/Build/Version.h written
-- The Fortran compiler identification is GNU
*** Unable to open 'pyhead.swg'
*** Unable to open 'pyerrors.swg'
*** Unable to open 'pythreads.swg'
*** Unable to open 'pyapi.swg'
*** Unable to open 'pyrun.swg'
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/james/Documents/Source/FreeCAD
I tried to add Spnav, but when I went to compile it, it says not supported on Darwin.

Sorry for the long post. Hope someone can help.
ickby
Posts: 2980
Joined: Wed Oct 05, 2011 7:36 am

Re: Mac Compile Help

Postby ickby » Wed Jul 31, 2013 4:56 pm

autotools are not supported anymore, you will not be able to compile freeCAD with them. Use cmake. And I belive you dont need spacenav, you will just miss that feature. Cmake did genererate the build files, so everything seems ok. The missing python files are strange, do you have swig installed? maybe thats the reason, not sure... Just try compiling and see where it fails :)
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Re: Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 5:29 pm

I do have swig installed via macports.

running make produces these errors
[ 0%] Built target coin
[ 1%] Building CXX object src/3rdParty/Pivy-0.5/CMakeFiles/soqt.dir/soqt_wrap.cpp.o
/Users/james/Documents/Source/FreeCAD/src/3rdParty/Pivy-0.5/soqt_wrap.cpp:3284:10: fatal error:
'Inventor/Qt/devices/SoQtDevice.h' file not found
#include <Inventor/Qt/devices/SoQtDevice.h>
^
1 error generated.
make[2]: *** [src/3rdParty/Pivy-0.5/CMakeFiles/soqt.dir/soqt_wrap.cpp.o] Error 1
make[1]: *** [src/3rdParty/Pivy-0.5/CMakeFiles/soqt.dir/all] Error 2
make: *** [all] Error 2
ickby
Posts: 2980
Joined: Wed Oct 05, 2011 7:36 am

Re: Mac Compile Help

Postby ickby » Wed Jul 31, 2013 5:58 pm

hm coin3d is missing. strange, cmake should have detected that. you need to install it and set the path.
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Re: Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 6:26 pm

Confirmed Coin is already installed via macports.
ickby
Posts: 2980
Joined: Wed Oct 05, 2011 7:36 am

Re: Mac Compile Help

Postby ickby » Wed Jul 31, 2013 6:55 pm

than make sure that the cmake variable points to the right include dir. I dont know the exact name right now, should be something like COIN§D_INCLUDE_DIR (and COIN3D_LIBRARY_DIR for linking)
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Re: Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 8:26 pm

I downloaded Coin and SoQT and compiled manually. Now I'm getting a little farther in make. I'm not clear what this error is telling me.
[ 0%] Built target coin
[ 1%] Built target soqt
[ 1%] Built target Driver
[ 2%] Built target SMDS
[ 2%] Built target DriverDAT
[ 3%] Built target DriverSTL
[ 4%] Built target SMESHDS
[ 4%] Built target DriverUNV
Linking CXX shared library ../../../lib/MEFISTO2.so
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/MEFISTO2.so] Error 1
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/MEFISTO2.dir/all] Error 2
make: *** [all] Error 2
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Re: Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 8:28 pm

I downloaded Coin and SoQT and compiled manually. Now I'm getting a little farther in make. I'm not clear what this error is telling me.
[ 0%] Built target coin
[ 1%] Built target soqt
[ 1%] Built target Driver
[ 2%] Built target SMDS
[ 2%] Built target DriverDAT
[ 3%] Built target DriverSTL
[ 4%] Built target SMESHDS
[ 4%] Built target DriverUNV
Linking CXX shared library ../../../lib/MEFISTO2.so
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/MEFISTO2.so] Error 1
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/MEFISTO2.dir/all] Error 2
make: *** [all] Error 2
ickby
Posts: 2980
Joined: Wed Oct 05, 2011 7:36 am

Re: Mac Compile Help

Postby ickby » Wed Jul 31, 2013 8:37 pm

the gnu fortran library can not be found by the linker. Make sure it's in the system path.
jamesl73
Posts: 20
Joined: Sun Jun 23, 2013 10:07 pm

Re: Mac Compile Help

Postby jamesl73 » Wed Jul 31, 2013 9:49 pm

I was using g95 for fortran, but couldn't find gfortran. I installed gcc46 to get gfortran, cleaned out the build folder and reran cmake and make and still get the error.
[ 0%] Built target coin
[ 1%] Built target soqt
[ 1%] Built target Driver
[ 2%] Built target SMDS
[ 2%] Built target DriverDAT
[ 3%] Built target DriverSTL
[ 4%] Built target SMESHDS
[ 4%] Built target DriverUNV
Linking CXX shared library ../../../lib/MEFISTO2.so
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/MEFISTO2.so] Error 1
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/MEFISTO2.dir/all] Error 2
make: *** [all] Error 2

which gfortran
/opt/local/bin/gfortran