Home > Enterprise >  Binary doesn't appear to find linked .dylib library
Binary doesn't appear to find linked .dylib library

Time:03-06

I have a github action for macos that needs to download a dmg archive, extract binaries and re-configure binaries so that they can run and link to the downloaded .dylib library. Below is the script I am using. Unfortunately, when I run the binary (kdu_expand) I get an error

/Users/runner/work/_temp/92b88adb-5bec-4d13-a51d-85fdf4e84e8d.sh: line 16:  1603 Killed: 9               ./kdu_expand -version
Error: Process completed with exit code 137.

Is this the correct way of re-configuring the binary to link to the dynamic library ?

wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
mkdir kdu && mv KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip kdu && cd kdu
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg 2>/dev/null || true
7z e Payload~ 2>/dev/null || true
chmod  x kdu_expand
chmod  x kdu_compress
install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
echo "${{ github.workspace }}/kdu" >> $GITHUB_PATH
./kdu_expand -version

CodePudding user response:

Killed: 9 more often than not hints at a codesigning error.
That is, by changing install names you modified the binaries, thus invalidating their code signatures (and in my case, install_name_tool warns me about this).

To fix it, run the following command against each binary you modified:

codesign -s - -f path/to/binary
  • Related