Open sindre-nistad opened 3 years ago
Disclaimer: the python packages do not see as much love and care as they should; that is unfortunate since "everyone" agrees having good Python packages is a good thing - but time is limited and so on.
I noticed there are only precompiled binaries for linux,
Yes - that is the case. If people contribute binary wheels for macOS that is all the rage, but it not something we will do as we speak. opm-common as a whole does not build on Windows (I think ...) although the necessary changes are probably very small.
and no source distribution
Well - I guess that is possible, but again competance and time ....
I tried compiling it manually, but ran into some problems.
Please provide more details here - this we should be able to assist you with.
opm-common as a whole does not build on Windows (I think ...) although the necessary changes are probably very small.
True, but these days there is WSL (windows subsystem for linux), which installs/compiles all repo's including opm-simulators and python-bindings natively on windows. Hence, the need for explicitly supporting the microsoft compiler toolchain is debatable.
Thanks for getting back to me,
The first issue I was having was that the option -fopenmp
in the generated setup.py
caused the compilation to fail; it was unable to find OpenMP, and I was unable to figure out how I could specify it (the path from brew --prefix libomp
).
for reference, the commands I ran:
brew install boost libomp
git clone git@github.com:OPM/opm-common.git
cd opm-common
cmake \
-DPYTHON_EXECUTABLE=$(which python) \
-DOPM_ENABLE_PYTHON=ON \
-DBOOST_INCLUDEDIR=$(brew --prefix boost)/include \
-DBOOST_LIBRARYDIR=$(brew --prefix boost)/lib \
.
make -j 4
This failed with clang: error: unsupported option '-fopenmp'
If I remove -fopenmp
from setup.py
(e.g. sed -i '' s/-fopenmp//g python/setup.py
), and then run make -j4
again, I get another error
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
The logs are slightly redacted, to hide some paths
About the OpenMP issue. For some reason, Apple disables -fopenmp in the clang they provide. There are workarounds, but they may vary with version.
If I try running the generated setup-build.sh
script, I get this error message
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
#include_next <string.h>
^~~~~~~~~~
1 error generated.
After searching a git, I found that that problem can be solved by including -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
"somewhere". By adding that path, prepending it with /usr/include
(or the result from xcrun --show-sdk-path
) to include_dirs
in setup.py
, I get another error again;
Thanks, I am using macOS Monterey (12.0.1)
OK - this was a lot of error messages. Before we go further with the Python. Please check and verify that you can build the c++ library. Many of the warnings are for them tests - for a start I would configure cmake to build without tests.
The error messages you report seem to come from pybind11 itself - a bit surprising?
I tried compiled the library itself, and that seemed to work;
mkdir release.build
cd release.build
cmake ..
make -j4
Most of the test cases seemed to work as expected, but some of them failed.
Hi, I tried installing the
opm
Python package, but it wasn't found on macOS. I noticed there are only precompiled binaries for linux, and no source distribution. Would it be possible to create binaries (wheels) for macOS and Windows and/or include a source distribution, os that other platforms may compile it from source?I tried compiling it manually, but ran into some problems.