Closed gui1117 closed 6 years ago
Here is my libhogweed without changes: otool -L /usr/local/Cellar/nettle/2.7.1/lib/libhogweed.2.5.dylib /usr/local/Cellar/nettle/2.7.1/lib/libhogweed.2.5.dylib: /usr/local/lib/libhogweed.2.dylib (compatibility version 2.0.0, current version 2.5.0) /usr/local/Cellar/nettle/2.7.1/lib/libnettle.4.dylib (compatibility version 4.0.0, current version 4.7.0) /usr/local/lib/libgmp.10.dylib (compatibility version 13.0.0, current version 13.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
Here is my libhogweed with changes made by dylibbundler: /Users/user/Documents/libs/libhogweed.2.5.dylib: @executable_path/libs/libhogweed.2.5.dylib (compatibility version 2.0.0, current version 2.5.0) /usr/local/Cellar/nettle/2.7.1/lib/libnettle.4.dylib (compatibility version 4.0.0, current version 4.7.0) @executable_path/libs/libgmp.10.dylib (compatibility version 13.0.0, current version 13.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
My libnettle.4.dylib path is not changed also. Looking at the output of dylibbundler I saw a bunch of lines that didn't make sense to me. They are all making changes to libhogweed, but these paths are not even in the dylib:
cp -n /usr/local/Cellar/nettle/2.7.1/lib/libhogweed.2.5.dylib libs/libhogweed.2.5.dylib chmod +w libs/libhogweed.2.5.dylib install_name_tool -id @executable_path/libs/libhogweed.2.5.dylib libs/libhogweed.2.5.dylib
I found the dylibbundler's file Dependency.cpp had a bug in the Dependency::mergeIfSameAs() function that would add all the symbolic links to another symbolic links Dependency object instead of writing them to the dylib object.
If you download dylibbundler's source and replace the mergeIfSameAs() function with this one in the Dependency.cpp file, libhogweed's paths will be correctly set:
// Compares the given Dependency with this one. If both refer to the same file,
// it returns true and merges both entries into one.
bool Dependency::mergeIfSameAs(Dependency& dep2)
{
if(dep2.getOriginalFileName().compare(filename) == 0)
{
const int samount = getSymlinkAmount();
for(int n=0; n<samount; n++) {
dep2.addSymlink(getSymlink(n)); // FIXME - there may be duplicate symlinks
}
return true;
}
return false;
}
Fixed by pull request #25
after bundling qemu-img installed via homebrew libhogweed still point to
/usr/local/Cellar/nettle/3.3/lib/libnettle.6.dylib