Search code examples
c++macosdylibinstall-name-tool

install_name_tool errors on arm64


I have c++ app that has multiple dependencies that takes the form of dynamic libraries. install_name_tool works fine to change the paths of those libraries in relation to the main executable, but the problem is that some of those libraries have dependencies themselves.

For x64, running install_name_tool again on those dependencies works fine, but for arm64, it errors with ‘warning: changes being made to the file will invalidate the code signature’.

Running ‘codesign -v /path/to/dylib’ returns ‘invalid signature (code or signature have been modified)’.

Trying to run the executable crashes with a segfault.

How can I fix this?


Solution

  • Figured it out!

    Since Big Sur, codesigning for arm64 is much more strict than it is for x64.

    So, I needed to run codesign --force -s - /path/to/dylib on every dylib