I just updated to Xcode 8, and I can no longer build xml2-based applications. If I build a simple file and try to build it as follows:
c++ myapp.cc `xml2-config
For anyone uncomfortable with stripping out references to libsystem_symptoms.dylib
from various locations, I came up with another solution that's the opposite of removing references -- adding a fake empty libsystem_symptoms.dylib
in /usr/lib/system
!
mkdir ~/src/libempty
cd ~/src/libempty
touch empty.c
cc -dynamiclib empty.c -o libempty.dylib
sudo cp libempty.dylib /usr/local/lib/libempty.dylib
cd /usr/lib/system
sudo ln -s /usr/local/lib/libempty.dylib libsystem_symptoms.dylib
Except... that last step doesn't work because of OS X/macOS System Integrity Protection.
There's apparently more than one way of getting around that; you can disable it using csrutil
and rebooting (see the question Operation Not Permitted when on root El capitan). I don't really want to disable it (or forget to turn it back on), so I booted into recovery mode, and then opened a terminal window and finished the job this way:
cd /Volumes
cd MyHardDrive
cd usr/lib/system
ln -s ../../local/lib/libempty.dylib libsystem_symptoms.dylib
Before doing this, I was trying to build PostgreSQL 9.6 on El Capitan, and was getting that linker error ("ld: file not found: /usr/lib/system/libsystem_symptoms.dylib"
) at the configure
step when it checked for the readline or zlib libraries. After doing this, PostgreSQL configured and built smoothly!
@mnencia's answer almost worked for me, but the sed command didn't replace anything in the TLB files - the backups were the same as the modified files.
I ran this part of his command:
grep -ril /usr/lib/system/libsystem_symptoms.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
Which identified the files referencing the removed library and modified them by hand.
YMMV
One "fix" that I've used, which avoids any use of sudo, is simply to filter out the -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib flag. In a GNU makefile, this can be done with the filter-out command. So if I build a LINK_LIBS variable, which includes $(shell xml2-config --libs), then I can filter LINK_LIBS with the following command:
LINK_LIBS := $(filter-out -L$(shell xcrun --show-sdk-path)/usr/lib, $(LINK_LIBS))
If I'm just using xml2-config, I can also just add a "--exec-prefix=/usr" argument when calling it:
c++ myapp.cc `xml2-config --cflags` `xml2-config --exec-prefix=/usr --libs`
I don't know what potential side effects of removing the SDK path from the library search string might be, but for now, these solutions seem to work for all of my applications.
@mnencia answer works removing references to libsystem_symptomps.dylib, but failed for me using OS X. Change the following should allow it to work on OS X:
sudo /usr/bin/sed -i.backup -E -e 's@/usr/lib/system/libsystem_symptoms.dylib(, )?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
Hope this helps Mac developers.
This is an XCode 8 bug.
While waiting for a proper fix from Apple, the following command removes the reference to the missing library from the tbd files.
sudo /usr/bin/sed -i.backup 's@/usr/lib/system/libsystem_symptoms.dylib\(, \)\?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
I don't know if it will works for every kind of build, but it fixed everything was not working for me.
Until Xcode8 stabilizes, I retain Xcode7.3, renamed as
/Applications/Xcode7.3.app/
Generally I use Xcode8 which is in
/Applications/Xcode.app/
but when encountering errors such as this, I have the option to
sudo xcode-select -switch /Applications/Xcode7.3.app/
This cured the error
ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64
for me, when attempting to install an R package:
> install.packages('clickstream')