16

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 --cflags` `xml2-config --libs`

...I get the following error message:

ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64

It doesn't matter what's in myapp.cc (mine is just a main routine that returns 0). The root problem seems to be that Apple removed /usr/lib/system/libsystem_symptoms.dylib in Xcode 8, but many of the .tbd files in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib still point to it. Has anyone else run into a problem like this?

  • I did a temp fix of symlinking /usr/lib/system/libsystem_symptoms.dylib to /usr/lib/libSystem.dylib and it looks like this allows the builds to work. It's not a right solution of course but a temp fix that will enable to build stuff until the real fix arrives. You'd need to disable SIP before (there's a lot of info online on how to do it). – StasM Sep 21 '16 at 05:08

7 Answers7

15

@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.

Raymond Naseef
  • 171
  • 1
  • 7
3

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.

mnencia
  • 3,298
  • 1
  • 23
  • 35
  • I tried this and go the following errors: grep: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib: No such file or directory sed: : No such file or directory. Any thoughts? The /usr/lib directory does exist (im running the same version of macOS) – Sanfly Sep 24 '16 at 05:17
  • maybe the sdk path is different. Try searching for .tbd files inside the /Applications/Xcode.app folder. – mnencia Sep 27 '16 at 08:57
  • This found all the right files, but the replace didn't work - the backup files were the same as the changed files. – John Naegle Sep 27 '16 at 16:16
  • If you run it twice, the 2nd backup will clobber the first one. If the backup doesn't contain any reference to `/usr/lib/system/libsystem_symptoms.dylib` that's probably what happened. – mnencia Sep 28 '16 at 07:34
  • Does this bug have a radar? – Arafangion Sep 28 '17 at 06:21
3

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')

Chris Hanning
  • 123
  • 1
  • 7
2

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.

1

@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

John Naegle
  • 8,077
  • 3
  • 38
  • 47
0

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!

Community
  • 1
  • 1
Weston C
  • 3,642
  • 2
  • 25
  • 31
0

The final update from geoHeil on https://github.com/igraph/rigraph/issues/173 helped me resolve this issue on OSX.

It was as simple as these two steps:

Terminal> brew uninstall suite-sparse --ignore-dependencies
R> install.packages("igraph")

ignore-dependencies was necessary because Octave had a dependency on suite-sparse.

Neil
  • 7,227
  • 5
  • 42
  • 43