rdkit / homebrew-rdkit

Homebrew formula for rdkit
44 stars 19 forks source link

Problem with linker while compiling #88

Closed liyiyuian closed 4 years ago

liyiyuian commented 4 years ago

Hi, I just use your homebrew-rdkit method to install rdkit cpp library. While installing, the brew shows a warning in this message:

==> Downloading https://github.com/rdkit/rdkit/archive/Release_2019_09_1.tar.gz
Already downloaded: /Users/liyiyuian/Library/Caches/Homebrew/downloads/dbc78c6529381ce39a1c4765d1b16ec83572d3c1ad3cfde3d65efc15a6bfc66f--rdkit-Release_2019_09_1.tar.gz
==> cmake -DRDK_INSTALL_INTREE=OFF -DRDK_BUILD_CPP_TESTS=OFF -DRDK_INSTALL_STATIC_LIBS=OFF -DBoost_NO_BOOST_CMAKE=ON -DPYTHON_EXECUTABLE='/usr/local/opt/python@3.8/bin/python3' -DPYTHON
==> make -j16
==> make install
Warning: rdkit/rdkit/rdkit dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
==> Caveats
      You may need to add RDBASE to your environment variables.
      For Bash, put something like this in your $HOME/.bashrc:
        export RDBASE=/usr/local/share/RDKit
==> Summary
🍺  /usr/local/Cellar/rdkit/2019.09.1: 1,561 files, 58MB, built in 4 minutes 45 seconds

I included the header but the g++ cannot find it, so I use the following command instead: $ g++ -std=c++14 -I/usr/local/include/rdkit sample.cpp -o sample

And then it gives the following error:

Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.15.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name seq2RiPP.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=10.15 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -ggnu-pubnames -target-linker-version 512.4 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/11.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I /usr/local/include/rdkit -I/usr/local/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 -Wno-framework-include-private-from-public -Wno-atimport-in-framework-header -Wno-extra-semi-stmt -Wno-quoted-include-in-framework-header -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /Users/liyiyuian/Documents/seq2ripp/orf2RiPP/code -ferror-limit 19 -fmessage-length 185 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.15.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/sr/sm8963pd4q5gwnv8gy0f5z4h0000gn/T/seq2RiPP-8fe82d.o -x c++ seq2RiPP.cpp
clang -cc1 version 11.0.0 (clang-1100.0.33.8) default target x86_64-apple-darwin19.3.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/rdkit
 /usr/local/include
 /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.15.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o seq2RiPP /var/folders/sr/sm8963pd4q5gwnv8gy0f5z4h0000gn/T/seq2RiPP-8fe82d.o -L/usr/local/lib -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "RDKit::SmilesToMol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, RDKit::SmilesParserParams const&)", referenced from:
      RDKit::SmilesToMol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >*) in seq2RiPP-8fe82d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could anyone please help me with this? Thank you!

UnixJunkie commented 4 years ago

Just ignore the warning and see if things work.

python3
import rdkit
liyiyuian commented 4 years ago

Hi, thank you for immediate response. Yes, this command works. I installed RDkit with anaconda before, but I wasn't in any anaconda environment while testing the command you provided nor the homebrew.

UnixJunkie commented 4 years ago

Note that if you install via brew on a Mac, you don't need a conda environment for rdkit to work.

liyiyuian commented 4 years ago

Hi, but I am not using the python version of the rdkit, I have the problem while using rdkit libraries on c++, as the error message shown in the original post. Thanks.

UnixJunkie commented 4 years ago

Ask for some help on the rdkit mailing-list, or open an issue there: https://github.com/rdkit/rdkit/issues Your problem does not seem related to the brew rdkit installer.