Page 1 of 1

Building 3.0 Source code on Mac OSX 10.7

Posted: Tue Jul 09, 2013 7:21 am
by capogros
Good day to all, I've tried to build the source code of OpenSim for Mac following the guide, I didn't encounter any problem in building the Simbody, altough I had to build the 3.1 because the 3.0 was not compiling.
However during the process I found on the guide the following Statement:
If you are building Simbody on OS X 10.7 (Lion) you will need to use the SDK 10.6 instead of 10.5, and SimTKlapack must be used rather than the Mac native lapack. This is done by changing your cmake configuration as follows:
Set CMAKE_OSX_DEPLOYMENT_TARGET to "10.6", and CMAKE_OSX_SYSROOT to /Developer/SDKs/MacOSX10.6.sdk"
Set BUILD_USING_OTHER_LAPACK to "SimTKlapack", and add the Simbody build directory to my DYLD_LIBRARY_PATH
Now, as far as I understood SimTKlapack is not supported for Mac, so I built Simbody with normal lapack;blas configuration,

However apparently there is some error that prevent me to compile the code, here what I have:

Code: Select all

inking CXX shared library ../../libosimCommon.dylib
ld: warning: ignoring file /usr/local/SimTK/lib/libSimTKcommon.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file /usr/local/SimTK/lib/libSimTKmath.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386
It seems like the libraries have not been compiled correctly for Mac, but it's strange, because the simbody was compiled correctly and all the tests passed (during the make test step), so for some reason the 3.0 code is not woriking.
Do you have hints? should I use the 3.1 beta source code?

Thanks for the infos
Marco

Re: Building 3.0 Source code on Mac OSX 10.7

Posted: Wed Jul 10, 2013 9:55 am
by apoorvar
Hi Marco,

I've gotten this error before too. Before you compile Simbody and OpenSim, you need to explicitly specify in CMake whether you want to build for 32-bit or 64-bit. Otherwise, one of them defaults to 32-bit and the other to 64-bit which is why the libraries are not compatible. (I forget which one defaults to which.)

To specify the build-type in CMake, enter either "i386" (32-bit) or "x86_64" (64-bit) in the "CMAKE_OSX_ARCHITECTURES" field. Do this for both simbody and opensim. I think this should fix your error. I use the native Mac lapack;blas, not SimTKlapack and haven't had a problem with that.

Hope this helps!
Apoorva

Re: Building 3.0 Source code on Mac OSX 10.7

Posted: Fri Jul 12, 2013 9:02 am
by sherm
Hi Marco. We verified that building Simbody 3.1 and OpenSim 3.1 on OSX 10.8 works fine with all the default settings. We haven't been able to locate a 10.7 system to try. Using 3.1 is probably the easiest solution. If you try it on 10.7 please let us know whether that works. Otherwise you might consider upgrading to 10.8 if you can.

Regards,
Sherm

Re: Building 3.0 Source code on Mac OSX 10.7

Posted: Fri Aug 02, 2013 1:11 am
by capogros
Hi To All!
So it worked on 10.7 building Symnody with the architecture "i386" Then the OpenSim building process worked with the attached configuration.

Thank you very much for all your help


Marco

Code: Select all

 
BUILD_BINARY_DIR                 /Users/marcocapogrosso/OpenSim               
 BUILD_PLATFORM                   Mac:x64                                      
 BUILD_TESTING                    ON                                           
 BUILD_USING_NAMESPACE                                                         
 BUILD_USING_OTHER_LAPACK         lapack;blas                                  
 CMAKE_BUILD_TYPE                 Release                                      
 CMAKE_DEBUG_POSTFIX              _d                                           
 CMAKE_INSTALL_PREFIX             /usr/local/OpenSim                           
 CMAKE_OSX_ARCHITECTURES                                                       
 CMAKE_OSX_DEPLOYMENT_TARGET      10.7                                         
 CMAKE_OSX_SYSROOT                /Developer/SDKs/MacOSX10.7.sdk               
 LAPACK_BEING_USED                lapack;blas                                  
 SimTK_INSTALL_DIR                /usr/local/SimTK                             


Re: Building 3.0 Source code on Mac OSX 10.7

Posted: Tue Aug 06, 2013 3:21 am
by capogros
Hi to all,
I've successfully installed both the 3.0 and 3.1 On 10.7 without encountering any particular problem beside the fact that I had to specify for the OpenSim 3.1 the Architecture as i386
The big problem now is that I'm not able to run the example, in the ExampleMain for instance, the program does not compile for several reasons: if I use the "make" command I have the following error

Code: Select all

 [100%] Building CXX object CMakeFiles/exampleMain.dir/TugOfWar1_CreateModel.cpp.o
/Users/marcocapogrosso/Desktop/ExampleMain/TugOfWar1_CreateModel.cpp:35:29: error: OpenSim/OpenSim.h: No such file or directory
Even if I specify the location of the OpenSim install folder either manually in the CMakeList or using the "ccmake", and set all the possible directories in the $PATH variable.

So I've decided to go brute force and link the folder of the OpenSim and SimTK libraries by hands:

Code: Select all

 g++ -I/usr/local/OpenSim/sdk/include/ -I/usr/local/OpenSim/sdk/include/SimTK/include TugOfWar1_CreateModel.cpp 
Undefined symbols for architecture x86_64:
  "OpenSim::Model::Model()", referenced from:
      _main in ccEK7cnd.o
  "OpenSim::Object::setName(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in ccEK7cnd.o
  "OpenSim::Model::~Model()", referenced from:
      _main in ccEK7cnd.o
  "OpenSim::Exception::getMessage() const", referenced from:
      _main in ccEK7cnd.o
  "typeinfo for OpenSim::Exception", referenced from:
      anon in ccEK7cnd.o
  "_RegisterTypes_osimCommon", referenced from:
      osimInstantiator::osimInstantiator()in ccEK7cnd.o
  "_RegisterTypes_osimSimulation", referenced from:
      osimInstantiator::osimInstantiator()in ccEK7cnd.o
  "_RegisterTypes_osimActuators", referenced from:
      osimInstantiator::osimInstantiator()in ccEK7cnd.o
  "_RegisterTypes_osimAnalyses", referenced from:
      osimInstantiator::osimInstantiator()in ccEK7cnd.o
  "_RegisterTypes_osimTools", referenced from:
      osimInstantiator::osimInstantiator()in ccEK7cnd.o
  "vtable for OpenSim::Exception", referenced from:
      OpenSim::Exception::Exception(OpenSim::Exception const&)in ccEK7cnd.o
      OpenSim::Exception::~Exception()in ccEK7cnd.o
ld: symbol(s) not found for architecture x86_64
Now I really don't know any more what to do if not contact you because I've tried any possible combination of installation of simbody/OpenSim in i386/x86_64/default

Do you have some idea????
Thanks again

Marco

Re: Building 3.0 Source code on Mac OSX 10.7

Posted: Mon Aug 12, 2013 3:24 pm
by kevinxu
Hi Marco,

Can you post your ccmake configuration screenshot for both building 3.1 & building ExampleMain?


Thanks,
Kevin