Dear all:
So I did a little more testing and I found the solution.
I used exactly the same version of gcc and g++ compilers as Greg did.
Also, I needed to remove the
'add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")' line in the CMakeLists.txt
file.
Now the compilation and the compiled test program work like charm 😄.
All the best,
Markus

On Wed, Oct 13, 2021 at 2:28 PM Markus Metz <metm...@gmail.com> wrote:

> Dear all:
> I would like to repeat Greg's example here:
>
> https://greglandrum.github.io/rdkit-blog/tutorial/technical/2021/07/24/setting-up-a-cxx-dev-env.html
>
> Working on Centos 7.6 and the 2021.03.5 rdkit release
> I followed all the steps and used the exact same input files.
>
> I have set the env variable as:
> export RDBASE=/.../anaconda3/envs/rdkit_dev
> export PYTHONPATH=$RDBASE
>
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:
> .../anaconda3/envs/rdkit_dev/include
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../anaconda3/envs/rdkit_dev/lib
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: .../anaconda3/lib
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: .../anaconda3/include
>
> I then set the g++ and gcc compilers with the CXX and CC env variables:
> export CXX=/usr/local/bin/g++
> export CC=/usr/local/bin/gcc
>
> The cmake step seems to work. Here is the output:
> -- The C compiler identification is GNU 8.3.0
> -- The CXX compiler identification is GNU 8.3.0
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working C compiler: /usr/local/bin/gcc - skipped
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working CXX compiler: /usr/local/bin/g++ - skipped
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Looking for pthread.h
> -- Looking for pthread.h - found
> -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
> -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
> -- Looking for pthread_create in pthreads
> -- Looking for pthread_create in pthreads - not found
> -- Looking for pthread_create in pthread
> -- Looking for pthread_create in pthread - found
> -- Found Threads: TRUE
> -- Found Boost: ...
> anaconda3/envs/rdkit_dev/lib/cmake/Boost-1.74.0/BoostConfig.cmake (found
> suitable version "1.74.0", minimum required is "1.74.0")
> -- Found Boost: ...
> /anaconda3/envs/rdkit_dev/lib/cmake/Boost-1.74.0/BoostConfig.cmake (found
> version "1.74.0") found components: timer system
> -- Configuring done
> -- Generating done
> -- Build files have been written to: ... /c++/rdkit/example/build
>
> But the next step, the linking process, throws me errors:
>
> [ 50%] Building CXX object CMakeFiles/tautomer_hash.dir/tautomer_hash.cpp.o
> [100%] Linking CXX executable tautomer_hash
> CMakeFiles/tautomer_hash.dir/tautomer_hash.cpp.o: In function
> `readmols(std::string, unsigned int,
> std::vector<boost::shared_ptr<RDKit::RWMol>,
> std::allocator<boost::shared_ptr<RDKit::RWMol> > >&)':
> tautomer_hash.cpp:(.text+0x7f): undefined reference to
> `RDKit::SmilesMolSupplier::SmilesMolSupplier(std::string const&,
> std::string const&, int, int, bool, bool)'
> CMakeFiles/tautomer_hash.dir/tautomer_hash.cpp.o: In function
> `generatehashes(std::vector<boost::shared_ptr<RDKit::RWMol>,
> std::allocator<boost::shared_ptr<RDKit::RWMol> > > const&)':
> tautomer_hash.cpp:(.text+0x29f): undefined reference to
> `RDKit::MolHash::MolHash(RDKit::RWMol*, RDKit::MolHash::HashFunction)'
> /home/mmetz/anaconda3/envs/rdkit_dev/lib/libRDKitGraphMol.so.1.2021.03.5:
> undefined reference to `std::__cxx11::basic_istringstream<char,
> std::char_traits<char>, std::allocator<char>
> >::basic_istringstream()@GLIBCXX_3.4.26'
> /home/mmetz/anaconda3/envs/rdkit_dev/lib/libRDKitFileParsers.so.1.2021.03.5:
> undefined reference to `std::__cxx11::basic_ostringstream<char,
> std::char_traits<char>, std::allocator<char>
> >::basic_ostringstream()@GLIBCXX_3.4.26'
> /home/mmetz/anaconda3/envs/rdkit_dev/lib/libRDKitFileParsers.so.1.2021.03.5:
> undefined reference to `std::__cxx11::basic_stringstream<char,
> std::char_traits<char>, std::allocator<char>
> >::basic_stringstream()@GLIBCXX_3.4.26'
> collect2: error: ld returned 1 exit status
> make[3]: *** [tautomer_hash] Error 1
> make[2]: *** [CMakeFiles/tautomer_hash.dir/all] Error 2
> make[1]: *** [CMakeFiles/tautomer_hash.dir/rule] Error 2
> make: *** [tautomer_hash] Error 2
>
> I checked around on the web and could find some info on 'std::__cxx11:'
> which seems to indicate ... 'to link together object files that were
> compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro'
>
> And I used Paolo's suggestion
> 'add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")' in the CMakefile.txt. No
> change.
>
> Does anybody know what is going on?
> Thank you very much in advance.
> Best,
> Markus
>
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to