0

otool -L二进制文件的依赖项:

$ otool -L libeditorlib.dylib 
libeditorlib.dylib:
    libeditorlib.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    @rpath/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libnlopt.0.dylib (compatibility version 0.0.0, current version 0.10.0)
    /usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib (compatibility version 8.0.0, current version 8.0.1)
    /usr/local/opt/ilmbase/lib/libHalf-2_5.25.dylib (compatibility version 25.0.0, current version 25.0.4)
    /usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
    /usr/local/opt/mpfr/lib/libmpfr.6.dylib (compatibility version 8.0.0, current version 8.0.0)
    @rpath/QtQuickControls2.framework/Versions/5/QtQuickControls2 (compatibility version 5.12.0, current version 5.12.4)

一些依赖项位于/usr/local/opt/. 我想更改它们以便@rpath/搜索它们。

我将不得不像这样一个接一个地更改它们:

$ install_name_tool -change /usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib  @rpath/libopenvdb.8.0.dylib libeditorlib.dylib

有没有方便的方法将所有更改/user/local/opt/...@rpath

4

1 回答 1

0

I had to change the install_name for each library one-by-one. I wish I could find an easier way to do so:

install_name_tool -add_rpath @executable_path/../Frameworks/.  libeditorlib.dylib
install_name_tool -change /usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib   @rpath/libopenvdb.8.0.dylib     libeditorlib.dylib
install_name_tool -change /usr/local/opt/ilmbase/lib/libHalf-2_5.25.dylib   @rpath/libHalf-2_5.25.dylib     libeditorlib.dylib
install_name_tool -change /usr/local/opt/gmp/lib/libgmp.10.dylib        @rpath/libgmp.10.dylib      libeditorlib.dylib
install_name_tool -change /usr/local/opt/mpfr/lib/libmpfr.6.dylib           @rpath/libmpfr.6.dylib      libeditorlib.dylib
于 2021-05-01T05:31:24.620 回答