-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cmake install #3228
Fix cmake install #3228
Conversation
Codecov Report
@@ Coverage Diff @@
## 4.1 #3228 +/- ##
=====================================
Coverage 85% 85%
=====================================
Files 530 530
Lines 26025 26025
=====================================
Hits 22157 22157
Misses 3868 3868 Continue to review full report at Codecov.
|
Needs cherry pick into master branch too. |
The merge seems to work as well. |
Ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please edit the original post to explain what this PR is achieving.
"${PROJECT_VERSION}") | ||
if(NOT ${SOVERSION} MATCHES "^[1-9]+$") | ||
message(FATAL_ERROR "Could not determine SOVERSION from ${PROJECT_VERSION}") | ||
endif(NOT ${SOVERSION} MATCHES "^[1-9]+$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is SOVERSION not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All libraries get to installed in the python site-packages directory and in there so versioning isn’t required anymore. Plus half of the new library miss it anyhow.
@@ -1,3 +1,4 @@ | |||
add_library(mpiio SHARED mpiio.cpp) | |||
target_include_directories(mpiio PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | |||
target_link_libraries(mpiio PRIVATE EspressoConfig EspressoCore MPI::MPI_CXX) | |||
install(TARGETS mpiio LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of the new install()
line here and in the other submodules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These libraries were missing from the installation and hence made the espressomd module unusable.
@junghans Thanks for reporting this issue. I will add a test to detect this type of regression. @mkuron While trying to reproduce the issue on Ubuntu, I found another flaw in the build system: the # with DESTDIR and no CMAKE_INSTALL_PREFIX, PATH is right but RPATH is wrong
cmake ..
make -j$(nproc)
make install DESTDIR="/tmp/espresso-1"
# with no DESTDIR and CMAKE_INSTALL_PREFIX, PATH is right and RPATH is right
cmake .. -DCMAKE_INSTALL_PREFIX="/tmp/espresso-2"
make -j$(nproc)
make install
# with DESTDIR and CMAKE_INSTALL_PREFIX, PATH is wrong and RPATH is wrong
cmake .. -DCMAKE_INSTALL_PREFIX="/tmp/espresso-3"
make -j$(nproc)
make install DESTDIR="/tmp/espresso-4"
When RPATH is wrong, we get the following error message:
|
I have written most of the logic for the new test, however I can't install 4.1.1rc with or without this PR: cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/espresso-unit-tests
make -j$(nproc)
make install
./pypresso -c 'from espressomd.cluster_analysis import ClusterStructure;print("ok1")'
/tmp/espresso-unit-tests/bin/pypresso -c 'import espressomd;from espressomd.cluster_analysis import ClusterStructure;print("ok2")'
The @KaiSzuttor could this be a regression of our efforts to restructure the core folders? |
Just get rid of |
Installing ESPResSo with `make install DESTDIR="/path/to/es"` will install files in the wrong folder and set an incorrect runtime path in Cython shared objects, causing import errors. See full report: espressomd#3228 (comment)
When installing ESPResSo, the C++ shared objects and Cython shared objects are stored in the same folder. Since they have the same .so extension, when importing espressomd.cluster_analysis, the file cluster_analysis.py is loaded and the file cluster_analysis.so is automatically considered a Cython shared object, and Python fails to find the Cython-specific symbol PyInit_cluster_analysis. This is remediated by giving a different name to the C++ shared object.
6d09834
to
475fa1a
Compare
I would replace |
Nice feature! But this seems to be CMake 3.15-specific, which has been released very recently. We still support 3.4, and consider bumping to 3.10 in the next release. |
01ca3c8
to
357eee7
Compare
Install the files in a different directory and check the python and tutorials/samples tests can still run with the installed files. Please note that pypresso will experience a major slowdown in CI when located outside the build directory, hence the 3h timeout. This job is meant to be run only during releases and in PRs that add new core modules.
Then if clause it depending on the CMale version, in CMake-3.4 you could at least use |
Takes more than 1 hour to run in CI when pypresso is located outside the build directory.
Installing ESPResSo with `make install DESTDIR="/path/to/es"` will install files in the wrong folder and set an incorrect runtime path in Cython shared objects, causing import errors. See full report: espressomd#3228 (comment)
3248: Fix cmake install on dev branch r=KaiSzuttor a=jngrad Porting #3228 to the dev branch Description of changes: - fix the CMake build system to include libraries in the list of installed files and test it in a dedicated CI job - fix the versioning of Cython .so shared objects - simplify the CMake tests 3251: Particle data r=jngrad a=fweik Fixes #3157. Description of changes: - Split definition of `struct Particle` from rest of particle data. Co-authored-by: Christoph Junghans <[email protected]> Co-authored-by: Jean-Noël Grad <[email protected]> Co-authored-by: Florian Weik <[email protected]>
The installed files only exist if the Python bindings are enabled.
The clang:6.0 job fails due to undefined ASAN symbols. The logic to fix that error is in the pypresso wrapper.
3228: Fix cmake install Description of changes: - fix the CMake build system to include libraries in the list of installed files and test it in a dedicated CI job - fix the versioning of Cython .so shared objects - simplify the CMake tests
This PR was merged into the open PR for the 4.1.1 release candidate. |
Supersedes #3226
Description of changes: