Skip to content

Fix OS X build when CMAKE_BUILD_WITH_INSTALL_RPATH is enabled#97

Closed
msmolens wants to merge 1 commit into
python-cmake-buildsystem:masterfrom
msmolens:fix-macosx-build-with-cmake_build_with_install_rpath-enabled
Closed

Fix OS X build when CMAKE_BUILD_WITH_INSTALL_RPATH is enabled#97
msmolens wants to merge 1 commit into
python-cmake-buildsystem:masterfrom
msmolens:fix-macosx-build-with-cmake_build_with_install_rpath-enabled

Conversation

@msmolens

@msmolens msmolens commented Sep 3, 2015

Copy link
Copy Markdown
Contributor

When building Python 2.7.4+, python is run from the build tree as part of the
build process. When BUILD_SHARED and CMAKE_BUILD_WITH_INSTALL_RPATH are enabled
the python executable is unable to find the shared library. The build fails
with an error like:

[100%] Relocate _sysconfigdata.py and update pybuilddir.txt
dyld: Library not loaded: /path/to/python-install/lib/libpython2.7.dylib
  Referenced from: /path/to/python-build/bin/python
  Reason: image not found
/bin/sh: line 1: 12570 Trace/BPT trap          /path/to/python-build/bin/python -E -S -m sysconfig --generate-posix-vars
make[2]: *** [bin/pybuilddir.txt] Error 133
make[1]: *** [CMakeBuild/python/CMakeFiles/update_sysconfig.dir/all] Error 2
make: *** [all] Error 2

The same error shows when running the tests.

This commit sets the DYLD_LIBRARY_PATH so that the executable finds the shared
library when building and when running the tests.

jcfr added a commit to jcfr/python-cmake-buildsystem that referenced this pull request Sep 3, 2015
…all_rpath

THIS COMMIT SHOUD NOT BE INTEGRATED INTO MASTER

The role of the commit is to confirm the build fail and will be effectively
fixed by PR python-cmake-buildsystem#97.

It also test the feature introduced in 0f8541e teaching the driver
script how to extract additional CMake configuration arguments from the
commit message. This new feature provides a simple way to test some
options without having to explicitly change the CI build matrix.

This is special awesome comment:

[cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON]
@jcfr

jcfr commented Sep 3, 2015

Copy link
Copy Markdown
Contributor

@msmolens there is now a new feature allowing to check the proposed changes will work as expected. Could you update the commit message adding [cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DBUILD_SHARED=ON] at the end ?

The idea is to add a comment of the form [cmake <ARGUMENT>] as it was done in #98 to check the build was effectively failing without the changes.

When building Python 2.7.4+, python is run from the build tree as part of the
build process.  When BUILD_SHARED and CMAKE_BUILD_WITH_INSTALL_RPATH are enabled
the python executable is unable to find the shared library.  The build fails
with an error like:

    [100%] Relocate _sysconfigdata.py and update pybuilddir.txt
    dyld: Library not loaded: /path/to/python-install/lib/libpython2.7.dylib
      Referenced from: /path/to/python-build/bin/python
      Reason: image not found
    /bin/sh: line 1: 12570 Trace/BPT trap          /path/to/python-build/bin/python -E -S -m sysconfig --generate-posix-vars
    make[2]: *** [bin/pybuilddir.txt] Error 133
    make[1]: *** [CMakeBuild/python/CMakeFiles/update_sysconfig.dir/all] Error 2
    make: *** [all] Error 2

The same error shows when running the tests.

This commit sets the DYLD_LIBRARY_PATH so that the executable finds the shared
library when building and when running the tests.

[cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DBUILD_SHARED=ON]
@msmolens msmolens force-pushed the fix-macosx-build-with-cmake_build_with_install_rpath-enabled branch from 572097e to 3f42f88 Compare September 3, 2015 18:25
jcfr added a commit to jcfr/python-cmake-buildsystem that referenced this pull request Sep 4, 2015
…all_rpath

THIS COMMIT SHOUD NOT BE INTEGRATED INTO MASTER

The role of the commit is to confirm the build fail and will be effectively
fixed by PR python-cmake-buildsystem#97.

It also test the feature introduced in 0f8541e teaching the driver
script how to extract additional CMake configuration arguments from the
commit message. This new feature provides a simple way to test some
options without having to explicitly change the CI build matrix.

This is special awesome comment:

[cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON]
@jcfr

jcfr commented Sep 4, 2015

Copy link
Copy Markdown
Contributor

Fixed in a604801

@jcfr jcfr closed this Sep 4, 2015
@msmolens msmolens deleted the fix-macosx-build-with-cmake_build_with_install_rpath-enabled branch September 4, 2015 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants