Hi Sherm,
I'm sure the answer to this problem is staring me in the face, but I have hacked at it for a while without success. I am trying to write a little program that uses PdbStructure(std::istream&), among other molmodel functions. However at link time I am told that the corresponding symbol does not exist for this architecture. I can use other polymorphisms of PdbStructure without inducing this error. It is almost as though I were linking to an old binary that lacked this polymorphism, but my makefile is so simple as to make this almost impossible, plus I think this constructor has existed for a long time.
here is my only program file, generate-base-pair-transform.cpp :
1 #include <iostream>
2 #include <fstream>
3 #include "SimTKmolmodel.h"
4
5 using namespace std;
6 using namespace SimTK;
7
9 int main () {
10 std::filebuf fb;
11 fb.open ("1MSY.pdb",std::ios::in);
12 std::istream myPdbFile(&fb);
14 RNA myRNA ("AAA");
17 PdbStructure myPdbStructure( myPdbFile);
22 return 0;
23 }
And here is my Makefile:
generate-base-pair-transform.o : ../src/generate-base-pair-transform.cpp
g++ -o generate-base-pair-transform.o -c ../src/generate-base-pair-transform.cpp -I/usr/local/SimTK/include/molmodel/internal -I/usr/local/SimTK/
include -I/usr/local/SimTK/include/simbody/ -I/usr/include/c++/4.2.1 -arch x86_64
#-arch was i386
generate-base-pair-transform : generate-base-pair-transform.o
g++ -o generate-base-pair-transform generate-base-pair-transform.o -I/usr/local/SimTK/include/SimTKcommon/internal -I/usr/local/SimTK/include/molmodel/internal -I/usr/local/SimTK/include -L/usr/local/SimTK/lib -lSimTKcommon -lSimTKmolmodel -lSimTKsimbody -lSimTKmath -llapack -lblas -arch x86_64
Compiling generate-base-pair-transform.o goes fine. Here is what happens at link time:
samuelfressmbp3:build Sam$ make generate-base-pair-transform
g++ -o generate-base-pair-transform generate-base-pair-transform.o -I/usr/local/SimTK/include/SimTKcommon/internal -I/usr/local/SimTK/include/molmodel/internal -I/usr/local/SimTK/include -L/usr/local/SimTK/lib -lSimTKcommon -lSimTKmolmodel -lSimTKsimbody -lSimTKmath -llapack -lblas -arch x86_64
Undefined symbols for architecture x86_64:
"SimTK::PdbStructure::PdbStructure(std::istream&)", referenced from:
_main in generate-base-pair-transform.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: *** [generate-base-pair-transform] Error 1
Any ideas?
Many thanks
Sam
Error linking to molmodel
- Michael Sherman
- Posts: 806
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Error linking to molmodel
Hi, Sam. That's very mysterious. A few random ideas: (1) architecture mismatch: could the molmodel library you have been built with a different architecture, say 32 bit? You could try rebuilding the library and watching to make sure it is getting built with x86_64. Also make sure there are no other libmolmodels around that might be getting ahead on the search path -- you might want to use "find" right from / just to make sure.
(2) Some Unix linkers are touchy about library ordering. You might try adding another instance of -lSimTKmodlmodel at the end of the library list just to check that.
Regards,
Sherm
(2) Some Unix linkers are touchy about library ordering. You might try adding another instance of -lSimTKmodlmodel at the end of the library list just to check that.
Regards,
Sherm
- Samuel Flores
- Posts: 189
- Joined: Mon Apr 30, 2007 1:06 pm
Re: Error linking to molmodel
I posted a reply but deleted it accidentally somehow. The only possibility I didn't rule out is that of old binaries, though the makefile is so simple as to seemingly make that unlikely. In any case I compiled it perfectly on a linux cluster, so I guess that will do for now. I do feel frustrated at not solving such a simple link problem that seems likely to arise again, but I guess I'll look at it again when I have more time.
Thanks for your help
Sam
Thanks for your help
Sam