Alternative for the DYLD_LIBRARY_PATH-trick since Mac OS 10.11 El Capitan with System Integrity Protection

前端 未结 1 536
星月不相逢
星月不相逢 2021-01-05 12:50

Here is what I have:

  • Mac OS 10.11 El Capitan
  • python 2.7.12, installed from python.org under /Library/Frameworks/Python.framewor
相关标签:
1条回答
  • 2021-01-05 13:13

    After a long struggle, I was able to solve the last bit of my problem.

    By setting a fixed value for the RPATH Run-Path dependent Libraries of the installed binaries, my linking problems are gone.

    There are different possibilities to achieve this. I guess one option is to use install_name_tool. For me, the easiest was to build vtk with appropriate CMake flags. Here my updated call to cmake, where CMAKE_MACOSX_RPATH and CMAKE_INSTALL_RPATH make the difference:

        cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release \
                  -DVTK_WRAP_PYTHON=ON \
                  -DBUILD_EXAMPLES=OFF \
                  -DBUILD_SHARED_LIBS=ON \
                  -DBUILD_TESTING=OFF \
                  -DCMAKE_INSTALL_PREFIX="/opt/dev/versions/vtk/vtk-7.1.0-shared" \
                  -DCMAKE_MACOSX_RPATH=ON \
                  -DCMAKE_INSTALL_RPATH="/opt/dev/versions/vtk/vtk-7.1.0-shared/lib" \
                  -DPYTHON_INCLUDE_DIR="/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/" \
                  -DPYTHON_LIBRARY="/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib"
    

    Read here more about CMake's rpath handling. Note that otool -L vtkCommonCorePython.so (for an example) will still write @rpath in the output, but the value still is fixed.

    @rpath/libvtkCommonCorePython27D-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkWrappingPython27Core-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    /Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
    @rpath/libvtksys-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkCommonCore-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
    
    0 讨论(0)
提交回复
热议问题