MADEAPPS / newton-dynamics

Newton Dynamics is an integrated solution for real time simulation of physics environments.
http://www.newtondynamics.com
Other
928 stars 183 forks source link

MacOS build encounter ld undefined referenced symbol #326

Closed endysonx closed 4 months ago

endysonx commented 6 months ago

When build in MacOS sonoma Version 14.2.1 (23C71), I encounted a ld problem :

ld: Undefined symbols: ndThreadYield(), referenced from: void ndThreadPool::ParallelExecute<ndFunction<ndDynamicsUpdateAvx2::DetermineSleepStates()::$_0>>(ndFunction<ndDynamicsUpdateAvx2::DetermineSleepStates()::$_0> const&) in ndDynamicsUpdateAvx2.cpp.o void ndThreadPool:: ...

Which is caused by Apple clang try to link all when compiling. Modifying the following code in the newton-4.00/CMakeLists.txt file fixed the problem.

if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions")

Add this line

set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") endif(APPLE)

JulioJerez commented 5 months ago

alright done. sorry for the long delay, I was not available. Thanks