Building Simbody3.0 for Opensim 3.0 on MacOSX(10.8.2)/Xcode

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Kazutaka Takahashi
Posts: 16
Joined: Tue Jan 29, 2008 4:48 pm

Building Simbody3.0 for Opensim 3.0 on MacOSX(10.8.2)/Xcode

Post by Kazutaka Takahashi » Thu Feb 07, 2013 12:49 pm

I got sources from simtk website and trying to install opensim 3.0, hence simbody 3.0 first on Mac OS X 10.8.2 with the latest Xcode.
I keep having the issues with searching/linking library:

[ 11%] Building CXX object SimTKcommon/sharedTarget/CMakeFiles/SimTKcommon_d.dir/__/Polynomial/src/rpoly.cpp.o
Linking CXX shared library ../../libSimTKcommon_d.dylib
ld: library not found for -lpthreadVC2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libSimTKcommon_d.dylib] Error 1
make[1]: *** [SimTKcommon/sharedTarget/CMakeFiles/SimTKcommon_d.dir/all] Error 2
make: *** [all] Error 2

Anyhow had a luck to build successfully on the same environment as mine? I am new to Mac as well, so there might be something about that, too. Thanks!

User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: Building Simbody3.0 for Opensim 3.0 on MacOSX(10.8.2)/Xc

Post by Michael Sherman » Thu Feb 07, 2013 4:15 pm

Hi, Kazutaka. This problem is due to the change of compiler name that Apple made for 10.8. The Simbody CMake file looks for compiler named "gcc" and if not found assumes it is on Windows. Apple's new compiler is just "cc". Look in the CMakeLists.txt file that is in the top-level Simbody directory for text that looks like this:

Code: Select all

IF(${CMAKE_C_COMPILER} MATCHES "gcc")
    IF(APPLE)
	    SET(REALTIME_LIB)
    ELSE()
	    SET(REALTIME_LIB rt)
    ENDIF()
    SET(MATH_LIBS_TO_USE    ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
    SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
ELSE(${CMAKE_C_COMPILER} MATCHES "gcc")
    ## Assume Microsoft Visual Studio
    SET(MATH_LIBS_TO_USE    ${LAPACK_BEING_USED} pthreadVC2)
    SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthreadVC2)
ENDIF(${CMAKE_C_COMPILER} MATCHES "gcc")
You can change "gcc" to just "cc" (in three places) and it should work. Or, if you are only building on Mac, just replace this code with how it should be there:

Code: Select all

SET(REALTIME_LIB)
SET(MATH_LIBS_TO_USE    ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
If you know how to work Subversion you can also grab the CMakeLists.txt file from Simbody's 3.0.1 branch where it has already been fixed for Mac 10.8.

Please post again to let us know if this works or if you have another problem.

Regards,
Sherm

POST REPLY