Re: [Rdkit-discuss] order of libraries in static linking
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2015-01-17 02:52:36
|
Hi, A good place to check for things like this is the link order for the tests in the RDKit source tree. For examples, here's the order for the ChemTransforms tests ( https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/ChemTransforms/CMakeLists.txt#L14 ): rdkit_test(testChemTransforms testChemTransforms.cpp LINK_LIBRARIES ChemTransforms FileParsers SmilesParse SubstructMatch GraphMol RDGeometryLib RDGeneral ${RDKit_THREAD_LIBS}) -greg On Fri, Jan 16, 2015 at 7:37 PM, E. Prabhu Raman < pr...@ou...> wrote: > I am trying to compile a test program by linking statically against > RDKit. I am able to do dynamic linking and the program works fine. But > static linking results in errors (pls see below) > > Here is the test program test.cpp: > #include <RDGeneral/Invariant.h> > #include <RDGeneral/RDLog.h> > #include <RDGeneral/FileParseException.h> > #include <RDGeneral/BadFileException.h> > #include <GraphMol/RDKitBase.h> > #include <GraphMol/FileParsers/FileParsers.h> > #include <GraphMol/SmilesParse/SmilesWrite.h> > #include <GraphMol/FileParsers/MolWriters.h> > using namespace std; > int main(int argc,char **argv) > { > string fName = argv[1]; > RDKit::ROMol *m = RDKit::Mol2FileToMol(fName,true,false); > cout<<m->getNumAtoms()<<endl; > string outfile="out.mol2"; > RDKit::SDWriter *writer = new RDKit::SDWriter(outfile); > writer->write(*m); > writer->close(); > delete writer; > } > > RDBASE=rdkit-Release_2014_09_2 (This is the version I compiled) > > Here is what I do to compile with dynamic linking (with success): > g++ -g test.cpp -I${RDBASE}/Code -L/${RDBASE}/lib -lFileParsers > -lRDGeneral -lSmilesParse -lDepictor -lRDGeometryLib -lDataStructs > -lGraphMol > > Here is what I do to compile with static linking (with failure) > g++ -g test.cpp -I${RDBASE}/Code \ > ${RDBASE}/lib/libFileParsers_static.a \ > ${RDBASE}/lib/libRDGeneral_static.a \ > ${RDBASE}/lib/libSmilesParse_static.a \ > ${RDBASE}/lib/libDepictor_static.a \ > ${RDBASE}/lib/libRDGeometryLib_static.a \ > ${RDBASE}/lib/libDataStructs_static.a \ > ${RDBASE}/lib/libGraphMol_static.a > > > I get errors like this: > ${RDBASE}/lib/libGraphMol_static.a(QueryOps.cpp.o): In function > `RDKit::queryAtomBondProduct(RDKit::Atom const*)': > QueryOps.cpp:(.text+0x4e2): undefined reference to > `RDKit::firstThousandPrimes' > ${RDBASE}/lib/libGraphMol_static.a(QueryOps.cpp.o): In function > `RDKit::queryAtomAllBondProduct(RDKit::Atom const*)': > QueryOps.cpp:(.text+0x5e4): undefined reference to > `RDKit::firstThousandPrimes' > QueryOps.cpp:(.text+0x6a3): undefined reference to > `RDKit::firstThousandPrimes' > ${RDBASE}/lib/libGraphMol_static.a(AddHs.cpp.o): In function > `RDKit::(anonymous namespace)::setHydrogenCoords(RDKit::ROMol*, unsigned > int, unsigned int)': > AddHs.cpp:(.text+0x3291): undefined reference to > `RDGeom::Transform3D::SetRotation(double, RDGeom::Point3D const&)' > AddHs.cpp:(.text+0x32a6): undefined reference to > `operator*(RDGeom::Transform3D const&, RDGeom::Point3D const&)' > AddHs.cpp:(.text+0x34a5): undefined reference to > `RDGeom::Transform3D::SetRotation(double, RDGeom::Point3D const&)' > AddHs.cpp:(.text+0x34ba): undefined reference to > `operator*(RDGeom::Transform3D const&, RDGeom::Point3D const&)' > AddHs.cpp:(.text+0x3b29): undefined reference to > `RDGeom::Transform3D::SetRotation(double, RDGeom::Point3D const&)' > AddHs.cpp:(.text+0x3b3c): undefined reference to > `operator*(RDGeom::Transform3D const&, RDGeom::Point3D const&)' > > If I change the order of libraries while statically linking, I get > different errors. A similar issue seems to have been visited previously: > > http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg03832.html > > So I was wondering if there exists a recommended order of libraries by > which we should link against RDKit while compiling statically. > > Thank you. > > > > ------------------------------------------------------------------------------ > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > |