auriamg / macdylibbundler

Utility to ease bundling libraries into executables for OSX
MIT License
561 stars 84 forks source link

Error fixing RPATH on universal binary dylib #68

Closed directmusic closed 2 years ago

directmusic commented 2 years ago

Hello,

I've recently run into an issue while fixing a dylib that is included in my application. When I build for Intel I have no issues, but I recently began working on a Universal build for Intel/M1 and ran into this issue. Every dylib included in the application is also built as a universal binary.

This is the command I am running: dylibbundler -of -cd -b -x ./MiniMeters.app/Contents/MacOS/MiniMeters -d ./MiniMeters.app/Contents/Frameworks -p @executable_path/../Frameworks/

Output: * Fixing dependencies on ./MiniMeters.app/Contents/Frameworks/libbrotlicommon.1.0.9.dylib install_name_tool -rpath "/opt/local/lib" "@executable_path/../Frameworks/" "./MiniMeters.app/Contents/Frameworks/libbrotlicommon.1.0.9.dylib" install_name_tool -rpath "/opt/local/lib" "@executable_path/../Frameworks/" "./MiniMeters.app/Contents/Frameworks/libbrotlicommon.1.0.9.dylib" error: install_name_tool: no LC_RPATH load command with path: /opt/local/lib found in: ./MiniMeters.app/Contents/Frameworks/libbrotlicommon.1.0.9.dylib (for architecture x86_64), required for specified option "-rpath /opt/local/lib @executable_path/../Frameworks/" error: install_name_tool: no LC_RPATH load command with path: /opt/local/lib found in: ./MiniMeters.app/Contents/Frameworks/libbrotlicommon.1.0.9.dylib (for architecture arm64), required for specified option "-rpath /opt/local/lib @executable_path/../Frameworks/"

I removed exit(1) on errors in fixRpathsOnFile() and recompiled. When I use otool -l to check the rpath of the offending dylib it appears to be fixed. And in testing the .app bundle produced works perfectly on fresh macOS installations.