Guys,
I just upgraded to OS Sierra and am having some link issues. I was able to compile, using the flags : -std=c++14 -stdlib=libc++ , architecture x86_64 , deploying to OS 10.12 . The OpenMM tests pass. The problem is that when I link libOpenMM.dylib to my code, it tells me that the computeNeighborListVoxelHash function (the only one I actually use) is not defined in that library.
I used nm -g to inspect the symbols and found the one I need:
00000000000db010 T __ZN6OpenMM28computeNeighborListVoxelHashERNSt3__16vectorINS0_4pairIjjEENS0_9allocatorIS3_EEEEiRKNS1_INS_4Vec3ENS4_IS8_EEEERKNS1_INS0_3setIiNS0_4lessIiEENS4_IiEEEENS4_ISH_EEEEPKS8_bddb
.. however this does not confirm that the signature is right, unless that is somehow encoded in the incomprehensible suffix.
I imagine my problem is not with OpenMM but rather with some simple compile/link setting. My code was compiling fine prior to the OS upgrade. Any ideas are welcome.
Thanks
Sam
[ 4%] Linking CXX shared library libMMBlib.dylib
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/MMBlib.dir/link.txt --verbose=1
/usr/bin/g++ -std=c++14 -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -dynamiclib -Wl,-headerpad_max_install_names -o libMMBlib.dylib -install_name libMMBlib.dylib CMakeFiles/MMBlib.dir/src/Utils.cpp.o CMakeFiles/MMBlib.dir/src/BiopolymerClass.cpp.o CMakeFiles/MMBlib.dir/src/AtomSpringContainer.cpp.o CMakeFiles/MMBlib.dir/src/DisplacementContainer.cpp.o CMakeFiles/MMBlib.dir/src/MobilizerContainer.cpp.o CMakeFiles/MMBlib.dir/src/MoleculeContainer.cpp.o CMakeFiles/MMBlib.dir/src/DensityContainer.cpp.o CMakeFiles/MMBlib.dir/src/BasePairContainer.cpp.o CMakeFiles/MMBlib.dir/src/ContactContainer.cpp.o CMakeFiles/MMBlib.dir/src/ConstraintContainer.cpp.o CMakeFiles/MMBlib.dir/src/Repel.cpp.o CMakeFiles/MMBlib.dir/src/MonoAtoms.cpp.o CMakeFiles/MMBlib.dir/src/ParameterReader.cpp.o CMakeFiles/MMBlib.dir/src/BaseInteractionParameterReader.cpp.o CMakeFiles/MMBlib.dir/src/TetherForce.cpp.o CMakeFiles/MMBlib.dir/src/BiopolymerClassTwoTransformForces.cpp.o CMakeFiles/MMBlib.dir/src/WaterDroplet.cpp.o CMakeFiles/MMBlib.dir/src/DensityMap.cpp.o CMakeFiles/MMBlib.dir/src/DensityForce.cpp.o CMakeFiles/MMBlib.dir/src/ElectrostaticPotentialGridForce.cpp.o CMakeFiles/MMBlib.dir/src/ErrorManager.cpp.o CMakeFiles/MMBlib.dir/src/PeriodicPdbAndEnergyWriter.cpp.o -L/usr/local/SimTK/lib -L/Users/Sam/svn/RNAToolbox/trunk/build -L/usr/local/openmm/lib -lSimTKmolmodel /usr/local/SimTK/lib/libSimTKsimbody.3.6.dylib /usr/local/SimTK/lib/libSimTKmath.3.6.dylib /usr/local/SimTK/lib/libSimTKcommon.3.6.dylib -lOpenMM -llapack -lblas -framework Accelerate -lpthread -ldl -lm
Undefined symbols for architecture x86_64:
"OpenMM::computeNeighborListVoxelHash(std::__1::vector<std::__1::pair<unsigned int, unsigned int>, std::__1::allocator<std::__1::pair<unsigned int, unsigned int> > >&, int, std::__1::vector<OpenMM::Vec3, std::__1::allocator<OpenMM::Vec3> > const&, std::__1::vector<std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> >, std::__1::allocator<std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> > > > const&, OpenMM::Vec3 const*, bool, double, double, bool)", referenced from:
InterfaceContainer::retrieveCloseContactPairs(std::__1::vector<MMBAtomInfo, std::__1::allocator<MMBAtomInfo> >&) in Utils.cpp.o
BiopolymerClassContainer::getNeighborList(std::__1::vector<MMBAtomInfo, std::__1::allocator<MMBAtomInfo> > const&, double) in BiopolymerClass.cpp.o
ResidueStretchContainer<SingleResidue>::addIntraChainInterfaceResidues(double, SimTK::String, BiopolymerClassContainer&) in BiopolymerClass.cpp.o
BiopolymerClassContainer::createDisulphideBridges(std::__1::basic_ofstream<char, std::__1::char_traits<char> >&) in BiopolymerClass.cpp.o
BiopolymerClassContainer::createDisulphideBridges() in BiopolymerClass.cpp.o
std::__1::vector<SingleResidue, std::__1::allocator<SingleResidue> > BiopolymerClassContainer::findBiopolymerResiduesWithinRadius<MobilizerWithin>(MobilizerWithin const&, SimTK::State) in BiopolymerClass.cpp.o
std::__1::vector<SingleResidue, std::__1::allocator<SingleResidue> > BiopolymerClassContainer::findBiopolymerResiduesWithinRadius<AllResiduesWithin>(AllResiduesWithin const&, SimTK::State) in BiopolymerClass.cpp.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libMMBlib.dylib] Error 1
make[1]: *** [CMakeFiles/MMBlib.dir/all] Error 2
problem with undefined symbol
- Peter Eastman
- Posts: 2564
- Joined: Thu Aug 09, 2007 1:25 pm
Re: problem with undefined symbol
That probably means you're compiling OpenMM and your own code with inconsistent options. Is it possible you've really compiled one with libstdc++ and the other with libc++? Check to make sure all other compiler flags also match.