Missing library libsystem_darwin after Xcode 9

I am trying to link against xml2 by getting the flags from `xml2-config`.

$ xml2-config --libs

-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm


In this directory I see corresponding .tbd files for each of the libraries, but some .tbd files refer to `/usr/lib/system/libsystem_darwin.dylib` in their re-exports section. The problem is that this file is missing in /usr/lib/system.


If I match the files in /usr/lib/system/ and the system/ directory inside the above directory, I see libcorecrypto_trace.dylib missing as well.


Does anyone what is happening here?

Accepted Reply

Looks like the answer should have been obvious to me. The clue is in the path:

.../SDKs/MacOSX10.13.sdk/...


Xcode 9 has SDK for only 10.13 which is not released yet. The solution is to go back to Xcode 8.3.3 or to upgrade to 10.13 when it is released (on Sep 25, 2017).

Replies

Same here after Xcode 9 😢


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

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Same here after Xcode9 installation. Trying to install uwsgi python package, pip install uwsgi, triggers the fault. Stresses me out a bit, I need this to work and I do not know what to do. Any workarounds?

Looks like the answer should have been obvious to me. The clue is in the path:

.../SDKs/MacOSX10.13.sdk/...


Xcode 9 has SDK for only 10.13 which is not released yet. The solution is to go back to Xcode 8.3.3 or to upgrade to 10.13 when it is released (on Sep 25, 2017).

This is clearly (to me anyway!) a bug in Xcode. I traced it to a bogus reference to /usr/lib/system/libsystem_darwin.dylib in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib/libSystem.B.tbd


If you edit that file (I made a cp first) and remove the reference to libsystem_darwin.dylib, you should be able to compile lxml just fine. I also tested a clean build of CPython's git master and didn't have any problems after editing that file, so AFAICT there are no ill side-effects.


For anyone at Apple, my bugreport.apple.com issue is #34655752 - please reopen and fix.

The issue is the project is use -L to point to /usr/lib in the SDK. The correct usage is no -L and instead use -isysroot pointing to the SDK. Ex:


-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk


What is happening is that libSystem.B.dylib in the SDK depends on /usr/lib/system/libsystem_darwin.dylib. If -isysroot is specified, the linker finds it. But since libsystem_darwin.dylib is not in the -L paths specified, it is not found.

THIS is the correct answer. Thank you.