Mac OS X/Dylib

From sigrok
Jump to: navigation, search

Mac OS X uses Dylib for shared libraries so we need to repair the executable(s) to match the relative Dylib path with otool.

$ otool -L sigrok-cli
$ install_name_tool -change /Users/jerry/sigrok/lib/libsigrok.0.dylib @executable_path/../Frameworks/libSigrok.dylib sigrok-cli
$ install_name_tool -change /Users/jerry/sigrok/lib/libsigrokdecode.0.dylib @executable_path/../Frameworks/libSigrokDecode.dylib sigrok-cli

Stitching the libSigrok.dylib with the @executable_path instead of absolute hardcoded path:

$ libtool -dynamic -flat_namespace -install_name @executable_path/../Frameworks/libSigrok.dylib -lSystem \
  -compatibility_version 1.0 -current_version 1.0.0 -o libSigrok.dylib -undefined suppress libsigrok/*.o \
  libsigrok/hardware/*/*.o libsigrok/input/*.o libsigrok/output/*.o libsigrok/output/text/*.o

Stitching the libSigrokDecode.dylib with the @executable_path instead of absolute hardcoded path:

$ libtool -dynamic -flat_namespace -install_name @executable_path/../Frameworks/libSigrokDecode.dylib -lSystem \
  -compatibility_version 1.0 -current_version 1.0.0 -o libSigrokDecode.dylib -undefined suppress libsigrokdecode/*.o

Resources