Last active
February 28, 2018 05:34
-
-
Save michalfapso/9abdbd5669bfdc4cd1a2179824d299e9 to your computer and use it in GitHub Desktop.
After upgrading to XCode 8 and MacOS to 10.12.2, I was getting a linker error when linking with macport's GCC 6: "ld: unexpected token: !tapi-tbd-v2", so this script creates a lybrary symlink for every .tbd file in a given MacOSX SDK path, so that the linker doesn't need the .tbd file at all.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 MACOSX_SDK_PATH" | |
echo "Example: $0 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" | |
exit 1 | |
fi | |
for tbd in $(find -L "$1" -name '*.tbd'); do | |
dylib="$(cat $tbd | grep '^install-name:' | sed 's/^install-name:[[:space:]]*\(.*\)/\1/')" | |
dylib_symlink="$(dirname $tbd)/$(basename $dylib)" | |
if [ -e "$dylib_symlink" ]; then | |
echo "DYLIB exists: $dylib_symlink" | |
if [ ! -z "$(file "$dylib_symlink" | grep 'Mach-O.*library')" ]; then | |
echo " IS DYLIB" | |
else | |
echo " NOT DYLIB" | |
fi | |
else | |
ln -s "$dylib" "$(dirname $tbd)/" | |
echo "Creating symlink $dylib_symlink" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment