Page 1 of 1
Build a C++ example using XCode
Posted: Tue Feb 18, 2020 9:56 am
by dc547
Hi there,
I am trying to build, compile, and run the first OpenSIm example. I am following this instructions:
https://simtk-confluence.stanford.edu/p ... d=29165309
However when I try to build it using cmake (version 3.17.0), and compile using Xcode (version 11.3.1) I get the following error:
- Screenshot 2020-02-18 at 16.51.20.png (156.68 KiB) Viewed 1449 times
If I try to specify the compiler I get this error:
- Screenshot 2020-02-18 at 16.52.09.png (204.58 KiB) Viewed 1449 times
If I try t compile using Unix MakeFiles, I get this warning:
- Screenshot 2020-02-18 at 16.43.20.png (200.62 KiB) Viewed 1449 times
Not sure what I doing wrong, but I am certainly forgetting to do something!
Many thanks for your help.
Cheers
Dario
Re: Build a C++ example using XCode
Posted: Tue Feb 18, 2020 10:17 am
by chrisdembia
Dario, maybe you could proceed with Unix Makefiles, because that generated only a warning, which you can hopefully ignore.
Re: Build a C++ example using XCode
Posted: Wed Feb 19, 2020 4:08 pm
by dc547
Hi Chris,
I managed to resolve the compiler error when using Xcode by typing this:
Apparently it is something you need to do after using homebrew.
However I now face another error in Xcode:
Code: Select all
clang: error: no such file or directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Accelerate.framework'
This is because ...SDKs/MacOSX10.14.sdk/... should be ...SDKs/MacOSX10.15.sdk/...
Not sure how to change this though.
Hope it helps.
Cheers
Dario
Re: Build a C++ example using XCode
Posted: Thu Feb 20, 2020 1:56 pm
by aymanh
Hi Dario,
Check the CMake variable CMake_OSX_SYSROOT
and let us know,
-Ayman
Re: Build a C++ example using XCode
Posted: Tue Feb 25, 2020 3:13 pm
by dc547
Hi Ayman,
Thanks for this. I did check that variable and it refers to the right path.
However I have noticed that the file XCODE_DEPEND_HELPER.make still includes the old path (i.e. MACOS_10.14.sdk).
Code: Select all
# DO NOT EDIT
# This makefile makes sure all linkable targets are
# up-to-date with anything they link to
default:
echo "Do not invoke directly"
# Rules to remove targets that are older than anything to which they
# link. This forces Xcode to relink the targets from scratch. It
# does not seem to check these dependencies itself.
PostBuild.exampleMain.Debug:
/Users/dc547/Documents/OpenSim/4.0/Code/CPP/ExampleMain/build/Debug/exampleMain:\
/Applications/OpenSim\ 4.0/sdk/lib/libosimTools.dylib\
/Applications/OpenSim\ 4.0/sdk/lib/libosimAnalyses.dylib\
/Applications/OpenSim\ 4.0/sdk/lib/libosimActuators.dylib\
/Applications/OpenSim\ 4.0/sdk/lib/libosimSimulation.dylib\
/Applications/OpenSim\ 4.0/sdk/lib/libosimCommon.dylib\
/Applications/OpenSim\ 4.0/sdk/Simbody/lib/libSimTKsimbody.3.6.dylib\
/Applications/OpenSim\ 4.0/sdk/Simbody/lib/libSimTKmath.3.6.dylib\
/Applications/OpenSim\ 4.0/sdk/Simbody/lib/libSimTKcommon.3.6.dylib\
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Accelerate.framework\
/Applications/OpenSim\ 4.0/sdk/lib/libosimLepton.dylib
/bin/rm -f /Users/dc547/Documents/OpenSim/4.0/Code/CPP/ExampleMain/build/Debug/exampleMain
Thanks for your help.
Dario
Re: Build a C++ example using XCode
Posted: Tue Feb 25, 2020 4:39 pm
by aymanh
Hi Dario,
You may need to delete the cache and rerun CMake to get a fresh XCODE_DEPEND_HELPER.cmake though I found online help that suggested this file is not used anymore (since XCode 5). Not sure since we typically do not use XCode to build on OSX.
Please let me know how it goes,
-Ayman
Re: Build a C++ example using XCode
Posted: Fri Jul 31, 2020 10:53 am
by hendrikreimann
I had the same issue and spent a very frustrating weekend trying to solve it, so putting this here for others.
My problem was that I had an older standard install of OpenSim in the usual place (Applications/OpenSim...), which I had installed a while ago, and I had updated the OS in the meantime. When generating the XCode project, CMake used this pre-installed version of OpenSim, rather than the newer version I had built from source code more recently, and the linker complained with the above error. Pointing CMake to the right locations fixed it:
- Screen Shot 2020-07-31 at 7.44.09 PM copy.jpg (206.27 KiB) Viewed 1330 times