rdkit / homebrew-rdkit

Homebrew formula for rdkit
44 stars 19 forks source link

cmake fail to build: Error 2 #43

Closed lesterpjy closed 6 years ago

lesterpjy commented 7 years ago

The following is the run code. Somehow after downloading, cmake is unable to build. I thought it is a python version issue with the directories, but the documentation says that it is automatically installed under the python 2.

172-0-2-103:~ lesteryang$ brew install rdkit
==> Installing rdkit from rdkit/rdkit
==> Downloading https://github.com/rdkit/rdkit/archive/Release_2017_03_3.tar.gz
Already downloaded: /Users/lesteryang/Library/Caches/Homebrew/rdkit-2017.03.3.tar.gz
==> cmake -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/rdkit/2017.03.3 -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEW
==> make
Last 15 lines from /Users/lesteryang/Library/Logs/Homebrew/rdkit/02.make:
[ 14%] Building CXX object Code/Geometry/CMakeFiles/RDGeometryLib.dir/UniformGrid3D.cpp.o
cd /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry && /usr/local/Homebrew/Library/Homebrew/shims/super/clang++  -DRDGeometryLib_EXPORTS -DRDK_64BIT_BUILD -DRDK_BUILD_DESCRIPTORS3D -DRDK_HAS_EIGEN3 -DRDK_TEST_MULTITHREADED -DRDK_USE_STRICT_ROTOR_DEFINITION -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -isystem /usr/local/include -I/tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code -I/usr/local/include/eigen3  -mpopcnt -std=c++11 -stdlib=libc++ -Wall -Wextra -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -fPIC -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -fPIC   -DRDK_THREADSAFE_SSS -DBOOST_ALL_NO_LIB -o CMakeFiles/RDGeometryLib.dir/UniformGrid3D.cpp.o -c /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry/UniformGrid3D.cpp
[ 14%] Building CXX object Code/Geometry/CMakeFiles/RDGeometryLib.dir/GridUtils.cpp.o
cd /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry && /usr/local/Homebrew/Library/Homebrew/shims/super/clang++  -DRDGeometryLib_EXPORTS -DRDK_64BIT_BUILD -DRDK_BUILD_DESCRIPTORS3D -DRDK_HAS_EIGEN3 -DRDK_TEST_MULTITHREADED -DRDK_USE_STRICT_ROTOR_DEFINITION -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -isystem /usr/local/include -I/tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code -I/usr/local/include/eigen3  -mpopcnt -std=c++11 -stdlib=libc++ -Wall -Wextra -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -fPIC -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -fPIC   -DRDK_THREADSAFE_SSS -DBOOST_ALL_NO_LIB -o CMakeFiles/RDGeometryLib.dir/GridUtils.cpp.o -c /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry/GridUtils.cpp
[ 14%] Linking CXX shared module ../../../rdkit/rdBase.so
cd /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/RDBoost/Wrap && /usr/local/Cellar/cmake/3.9.2/bin/cmake -E cmake_link_script CMakeFiles/rdBase.dir/link.txt --verbose=1
/usr/local/Homebrew/Library/Homebrew/shims/super/clang++  -mpopcnt -std=c++11 -stdlib=libc++ -Wall -Wextra -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -fPIC -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -bundle -Wl,-headerpad_max_install_names  -o ../../../rdkit/rdBase.so CMakeFiles/rdBase.dir/RDBase.cpp.o ../../../lib/libRDKitRDBoost.2017.03.3.dylib /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/lib/libboost_python-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_serialization-mt.dylib ../../../lib/libRDKitRDGeneral.2017.03.3.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib 
[ 14%] Built target rdBase
[ 14%] Linking CXX shared library ../../lib/libRDKitRDGeometryLib.dylib
cd /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry && /usr/local/Cellar/cmake/3.9.2/bin/cmake -E cmake_link_script CMakeFiles/RDGeometryLib.dir/link.txt --verbose=1
/usr/local/Homebrew/Library/Homebrew/shims/super/clang++  -mpopcnt -std=c++11 -stdlib=libc++ -Wall -Wextra -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -fPIC -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 1.0.0 -current_version 2017.3.3 -o ../../lib/libRDKitRDGeometryLib.2017.03.3.dylib -install_name /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/lib/libRDKitRDGeometryLib.1.dylib CMakeFiles/RDGeometryLib.dir/point.cpp.o CMakeFiles/RDGeometryLib.dir/Transform2D.cpp.o CMakeFiles/RDGeometryLib.dir/Transform3D.cpp.o CMakeFiles/RDGeometryLib.dir/UniformGrid3D.cpp.o CMakeFiles/RDGeometryLib.dir/GridUtils.cpp.o ../../lib/libRDKitDataStructs.2017.03.3.dylib ../../lib/libRDKitRDGeneral.2017.03.3.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib 
cd /tmp/rdkit-20170910-67701-adxb4v/rdkit-Release_2017_03_3/Code/Geometry && /usr/local/Cellar/cmake/3.9.2/bin/cmake -E cmake_symlink_library ../../lib/libRDKitRDGeometryLib.2017.03.3.dylib ../../lib/libRDKitRDGeometryLib.1.dylib ../../lib/libRDKitRDGeometryLib.dylib
[ 14%] Built target RDGeometryLib
make[1]: *** [Code/DataStructs/Wrap/CMakeFiles/cDataStructs.dir/all] Error 2
make: *** [all] Error 2
ManvithaPonnapati commented 6 years ago

Adding to this _ I ran the brew install with the debug flag


[ 14%] Built target RDGeometryLib
make[1]: *** [Code/DataStructs/Wrap/CMakeFiles/cDataStructs.dir/all] Error 2
make: *** [all] Error 2
/usr/local/Homebrew/Library/Homebrew/debrew.rb:11:in `raise'```
mcs07 commented 6 years ago

Installing with --verbose --debug gives the full error: 'boost/python/numeric.hpp' file not found.

In the release notes for boost 1.65.1 it says:

The boost::python::numeric API has been removed, as it is being obsoleted by boost::python::numpy.

So in the long term, it seems RDKit will have to be updated to handle both the numeric and the numpy API.

But for now, it would be nice to be able to force homebrew to use an older version of boost. I don't think it's possible to use the older versioned formulae that are kept around in homebrew-core (like boost@1.59) because they are "keg-only", i.e. they aren't linked into /usr/local/lib etc. so "boost" and "boost-python" are in two separate places and RDKit can't compile against them.

So the only way I can think of is to revert the main formulae to an older version. This means replacing the file at /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/boost.rb with https://github.com/Homebrew/homebrew-core/blob/3df9cdfc25f796ec8d3ffd0a0a12476cf6d413d5/Formula/boost.rb

And replacing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/boost-python.rb with https://github.com/Homebrew/homebrew-core/blob/d22f78c56a1c7d8e711a407c2dae5fc42f4ae6c2/Formula/boost-python.rb

Then, after you brew uninstall boost boost-python to get rid of the 1.65 versions, RDKit seems to install fine.

scbarton commented 6 years ago

I had previous versions of boost and boost-python installed, so this worked for me:

brew switch boost 1.63.0
brew switch boost-python 1.63.0
brew install rdkit --with-python3

You can find your installed versions using brew info boost boost-python

platinhom commented 6 years ago

I met the same bug and got the follow errors:

In file included from /usr/local/include/boost/python/detail/prefix.hpp:13:
/usr/local/include/boost/python/detail/wrap_python.hpp:50:11: fatal error: 'pyconfig.h' file not found
# include <pyconfig.h>
....

I also tried @mcs07 's method to replace boost to v1.64. But it show the same errors.

timjmiller1 commented 6 years ago

I have the same issue. Tried the manual fix proposed by mcs07 but the install helpfully overwrites with 1.65 so I'm back where I started!

hsiaoyi0504 commented 6 years ago

It works for boost 1.64.0_1 and 1.64.0 for me.

hsiaoyi0504 commented 6 years ago

@platinhom I think it's different issue. I think your issue should be your python installation.

hsiaoyi0504 commented 6 years ago

@timjmiller1 try this without updating those dependencies.

hsiaoyi0504 commented 6 years ago

For those who seek a answer of this issue. I have another answer:

brew uninstall boost boost-python # if you have already install boost and boost-python
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3df9cdfc25f796ec8d3ffd0a0a12476cf6d413d5/Formula/boost.rb # install boost
brew install https://gist.githubusercontent.com/hsiaoyi0504/cd136fb266f917a85261b946df2f4c6f/raw/89fa69777f7d3766886dcfe3abf9fa539a25e047/boost-python.rb --with-python3 # install boost-python
brew install https://gist.githubusercontent.com/hsiaoyi0504/cd136fb266f917a85261b946df2f4c6f/raw/081ab1509071d0f509ab996c4a67935fdfc79d2e/rdkit.rb --with-python3 --without-numpy" # install rdkit

It has been tested on travis-ci. This scripts I specified in brew install is almost the same the @mcs07 said. It's a great solution. However, as mentioned by @timjmiller1, homebrew will automatically install up-to-date dependencies. It need to remove some dependencies (that's what I did further based on @mcs07's answer) or disable such kind of functionality through this.

@greglandrum @mcs07 FYI and also I think it would be good to integrate travis to test the build based on homebrew in the future.

UnixJunkie commented 6 years ago

This issue should be reopened: the rdkit formula in brew doesn't work. The formula should be fixed. Can't a brew formula specify some version constraints on dependencies? I understand that we are incompatible with boost starting from boost-1.65. Or should everybody use: brew install rdkit --HEAD? Can't the formula say so if this is the case?

hsiaoyi0504 commented 6 years ago

@UnixJunkie Do you have further information on your claim ? Log message and detailed information are helpful on this. I can build the rdkit on Travis almost one month ago. https://travis-ci.org/hsiaoyi0504/homebrew-rdkit/builds/303879181

UnixJunkie commented 6 years ago

I had this same error:

Installing with --verbose --debug gives the full error: 'boost/python/numeric.hpp' file not found.
hsiaoyi0504 commented 6 years ago

@UnixJunkie Can you give me the output you will get through brew info boost and brew info boost-python? If you can describe how you install them more clearly , we can probably help you more sooner.

BastiaanBergman commented 6 years ago

brew automatically reinstalls boost 1.66, even if I had 1.59 installed. The trick described above does not seem to work for me:

$ HOMEBREW_NO_AUTO_UPDATE=1 brew install rdkit
==> Installing rdkit from rdkit/rdkit
==> Installing dependencies for rdkit/rdkit/rdkit: boost, boost-python
==> Installing rdkit/rdkit/rdkit dependency: boost
==> Downloading https://homebrew.bintray.com/bottles/boost-1.66.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/b/Library/Caches/Homebrew/boost-1.66.0.high_sierra.bottle.tar.gz
==> Pouring boost-1.66.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/boost/1.66.0: 13,101 files, 435.2MB
==> Installing rdkit/rdkit/rdkit dependency: boost-python
==> Downloading https://homebrew.bintray.com/bottles/boost-python-1.66.0_1.high_sierra.bottle.tar.gz
Already downloaded: /Users/b/Library/Caches/Homebrew/boost-python-1.66.0_1.high_sierra.bottle.tar.gz
==> Pouring boost-python-1.66.0_1.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/boost-python/1.66.0_1: 457 files, 17.3MB

Any ideas?

hsiaoyi0504 commented 6 years ago

@BastiaanBergman Can you give me your output of following two commands? brew info boost and brew search boost

BastiaanBergman commented 6 years ago

@hsiaoyi0504

brew info boost
boost: stable 1.66.0 (bottled), HEAD
Collection of portable C++ source libraries
https://www.boost.org/
/usr/local/Cellar/boost/1.66.0 (13,101 files, 435.2MB) *
  Poured from bottle on 2018-03-10 at 22:29:58
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/boost.rb
==> Dependencies
Optional: icu4c ✔
==> Options
--with-icu4c
    Build regexp engine with icu support
--without-single
    Disable building single-threading variant
--without-static
    Disable building static library variant
--HEAD
    Install HEAD version

brew search boost
==> Searching local taps...
boost ✔                 boost-python@1.59 ✔     boost-bcp               boost-mpi               boost@1.55              boost@1.60
boost-python ✔          boost@1.59 ✔            boost-build             boost-python3           boost@1.57
==> Searching taps on GitHub...
caskroom/cask/turbo-boost-switcher
==> Searching blacklisted, migrated and deleted formulae...

I manually changed the files at /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ as described by @mcs07.

The error goes away when not using --with-python3. But now I get a warning:

==> make install
Warning: Calling <<-EOS.undent is deprecated!
Use <<~EOS instead.
/usr/local/Homebrew/Library/Taps/rdkit/homebrew-rdkit/Formula/rdkit.rb:96:in `caveats'
Please report this to the rdkit/rdkit tap!

Warning: Calling <<-EOS.undent is deprecated!
Use <<~EOS instead.
/usr/local/Homebrew/Library/Taps/rdkit/homebrew-rdkit/Formula/rdkit.rb:96:in `caveats'
Please report this to the rdkit/rdkit tap!

And it still doesn't work:

$ python2
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from rdkit import Chem
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named rdkit

I did add export RDBASE="/usr/local/share/RDKit" to my profile and restarted the terminal.

Thanks for your help!

hsiaoyi0504 commented 6 years ago

Hmm.... it looks like you already installed the boost 1.66. I don't know how to debug this if you have already installed 1.66. My guess is that the boost 1.59 you mention above is boost@1.59 formula rather than boost formula itself with version 1.59. They are two different formulas. Therefore, when you install the rdkit, homebrew can't find boost and it install automatically. It's not installed by auto update, but it's installed due to missing dependency.

BastiaanBergman commented 6 years ago

@hsiaoyi0504

looks like you already installed the boost 1.66.

I did, then uninstalled,...

My guess is that the boost 1.59 you mention above is boost@1.59

It is, did I do it wrong? shall I uninstall that as well?

automatically. It's not installed by auto update, but it's installed due to missing dependency.

That makes sense,.. Any hints what to install if no boost@1.59?

hsiaoyi0504 commented 6 years ago

You can keep boost@1.59. It doesn't matter. Actually, I don't think you need to edit the formula. This is a closed issue. Just use the latest formula of rdkit.

To try to help you figure out the issue, can you also give me the output of following commands ? which python which python2 which python3

BastiaanBergman commented 6 years ago
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ which python2
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
$ which python3
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
hsiaoyi0504 commented 6 years ago

Sorry, I need one more information: brew info python.

BastiaanBergman commented 6 years ago
$  brew info python
python: stable 3.6.4 (bottled), devel 3.7.0b2, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.6.4_2 (3,593 files, 56.2MB)
  Poured from bottle on 2018-02-27 at 20:01:11
/usr/local/Cellar/python/3.6.4_4 (4,615 files, 97.4MB)
  Poured from bottle on 2018-03-10 at 14:42:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ✔, sphinx-doc ✘
Required: gdbm ✔, openssl ✔, readline ✔, sqlite ✔, xz ✔
Optional: tcl-tk ✘
==> Options
--with-tcl-tk
    Use Homebrew's Tk instead of macOS Tk (has optional Cocoa and threads support)
--devel
    Install development version 3.7.0b2
--HEAD
    Install HEAD version
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

Pip, setuptools, and wheel have been installed. To update them run
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
hsiaoyi0504 commented 6 years ago

OK, I think I find the problem. It's related to #55. I think current formula is really broken. You can't install rdkit by homebrew now ... We need to figure out how to fix this. Sorry to notify you this ...

BastiaanBergman commented 6 years ago

tnx for your help! I'll wait a couple of days, maybe someone gets it to work ;-).

hsiaoyi0504 commented 6 years ago

@BastiaanBergman Sorry for your inconvenience, maybe you should try install rdkit by conda. It's more standard way and more active support. That will add another layer of confusing, though.

UnixJunkie commented 6 years ago

the brew formula must work!

UnixJunkie commented 6 years ago

users have a right to install from sources and system-wide

UnixJunkie commented 6 years ago

At least a baseline brew formula should work. I.e. the assumption is that nothing is already installed for rdkit and the brew formula should install everything that is needed. I.e. in a freshly installed computer (as in many CI environments), brew install rdkit should just do the job!

BastiaanBergman commented 6 years ago

the brew formula must work!

I agree! but it didn't for me :-(

Btw, Conda also doesn't work for python 3.6: https://github.com/rdkit/rdkit/issues/1617

I did get rdkit to work on Anaconda2. Would still like to have a brew version as I have some packages installed outside of Anaconda.

I un-installed boost and boost-python and tried brew for both Python2 and Python3, but I could not get it to work. I'm welcome to any suggestions.

UnixJunkie commented 6 years ago

Since rdkit is packaged on many linux distributions, I don't understand how we cannot get an install from sources _justwork. So that people can get a recent version in just a snap.

imageslr commented 5 years ago

After having tried almost every solution I can find, I finally solved the problem that boost cannot build on macOS 10.14.3. Just uninstall brew and reinstall brew, everything works!

If you encounter this error message:

Error: You are using macOS 10.14.

We do not provide support for this pre-release version.You may encounter build failures or other breakages.Please create pull-requests instead of filing issues.

You can try:

# uninstall brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"