Page 1 of 1

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

Posted: Thu Feb 07, 2013 12:49 pm
by kazutaka
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!

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

Posted: Thu Feb 07, 2013 4:15 pm
by sherm
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