Hi *, When trying to build RDKit for Windows with the MINGW toolchain, the build dies during linking:
[ 49%] Building CXX object Code/GraphMol/FileParsers/CMakeFiles/FileParsers.dir/MultithreadedSmilesMolSupplier.cpp.obj [ 49%] Building CXX object Code/GraphMol/FileParsers/CMakeFiles/FileParsers.dir/MultithreadedSDMolSupplier.cpp.obj [ 49%] Linking CXX shared library ../../../bin/libRDKitFileParsers.dll /usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/FileParsers.dir/objects.a(MolFileWriter.cpp.obj):MolFileWriter.cpp:(.text+0xe3ba): undefined reference to `RDDepict::compute2DCoords(RDKit::ROMol&, std::map<int, RDGeom::Point2D, std::less<int>, std::allocator<std::pair<int const, RDGeom::Point2D> > > const*, bool, bool, unsigned int, unsigned int, int, bool, bool)' collect2: error: ld returned 1 exit status make[2]: *** [Code/GraphMol/FileParsers/CMakeFiles/FileParsers.dir/build.make:557: bin/libRDKitFileParsers.dll] Error 1 make[1]: *** [CMakeFiles/Makefile2:3249: Code/GraphMol/FileParsers/CMakeFiles/FileParsers.dir/all] Error 2 make: *** [Makefile:171: all] Error 2 I’m using the following cmake options: cmake -DRDK_BUILD_THREADSAFE_SSS=OFF \ -DCMAKE_BUILD_TYPE=Release -DRDK_BUILD_AVALON_SUPPORT=ON -DRDK_BUILD_INCHI_SUPPORT=ON \ -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_SWIG_WRAPPERS=ON -DRDK_BUILD_SWIG_CSHARP_WRAPPER=ON -DRDK_BUILD_SWIG_JAVA_WRAPPER=OFF \ -DRDK_USE_BOOST_IOSTREAMS=ON -DRDK_USE_BOOST_SERIALIZATION=ON -DRDK_USE_BOOST_STACKTRACE=OFF \ -DBUILD_TESTING=OFF -DRDK_BUILD_CPP_TESTS=OFF \ -DRDK_INSTALL_INTREE=OFF -DCMAKE_INSTALL_PREFIX=/image/rdk/win .. When looking a bit into it, the symbol is in the obj file: /src/rdkit-Release_2021_03_3/buildw# nm Code/GraphMol/Depictor/CMakeFiles/Depictor_static.dir/RDDepictor.cpp.obj | grep compute2DCo 00000000000030d0 T _ZN8RDDepict15compute2DCoordsERN5RDKit5ROMolEPKSt3mapIiN6RDGeom7Point2DESt4lessIiESaISt4pairIKiS5_EEEbbjjibb The symbol is in the DLL bin/libRDKitDepictor.dll 000000006f204470 T _ZN8RDDepict15compute2DCoordsERN5RDKit5ROMolEPKSt3mapIiN6RDGeom7Point2DESt4lessIiESaISt4pairIKiS5_EEEbbjjibb The symbol in in the tree in libRDKitDepictor_static.a nm libRDKitDepictor_static.a | grep compute2DC 00000000000030d0 T _ZN8RDDepict15compute2DCoordsERN5RDKit5ROMolEPKSt3mapIiN6RDGeom7Point2DESt4lessIiESaISt4pairIKiS5_EEEbbjjibb But the symbol is missing in lib/libRDKitDepictor.dll.a The build works for linux and osx, so it seems to be specific to windows. I tried to compile all releases from 2021 and the bug is there since 2021_03_1. I also tried crosscompile which has the same behavior as the native windows build (with two different versions of the toolchain for two different Ubuntu release) so it seems its not related to a specific gcc version/mingw version. (cross compile cmake was cmake -DCMAKE_CROSSCOMPILING=ON -DCMAKE_TOOLCHAIN_FILE=../win-x64.cmake -DMSVC_RUNTIME_DLL=/work/mingw/msvcr110.dll – DRDK_BUILD_THREADSAFE_SSS=OFF \ -DCMAKE_BUILD_TYPE=Release -DRDK_BUILD_AVALON_SUPPORT=ON -DRDK_BUILD_INCHI_SUPPORT=ON \ -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_SWIG_WRAPPERS=ON -DRDK_BUILD_SWIG_CSHARP_WRAPPER=ON -DRDK_BUILD_SWIG_JAVA_WRAPPER=OFF \ -DRDK_USE_BOOST_IOSTREAMS=ON -DRDK_USE_BOOST_SERIALIZATION=ON -DRDK_USE_BOOST_STACKTRACE=OFF \ -DBUILD_TESTING=OFF -DRDK_BUILD_CPP_TESTS=OFF \ -DBOOST_ROOT=/work/mingw/mingw64 -DRDK_INSTALL_INTREE=OFF -DCMAKE_INSTALL_PREFIX=/image/rdk/win .. ) I attach a Dockerfile where you can easily reproduce the issue. Best, Thomas p.s.: Also there was a minimal patch required to allow compiling of some explicit template instantiations, pls find attached
fix_template.patch
Description: fix_template.patch
win-x64.cmake
Description: win-x64.cmake
Dockerfile
Description: Dockerfile
_______________________________________________ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel