Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 10 (iOS 12) does not contain libstdc++6.0.9

Tags:

ios

xcode10

ios12

I download the newest Xcode from Apple, but I found I cannot search the library named "libstdc++6.0.9". cant search libstdc++

like image 539
CoderAzreal Avatar asked Jun 05 '18 07:06

CoderAzreal


4 Answers

libstdc++ was deprecated 5 years ago. Apple's more recent platforms (tvOS and watchOS) don't support it.

Support was removed from the iOS 12.0 Simulator runtime, but it remains in the iOS 12.0 (device) runtime for binary compatibility with shipping apps.

You should update your project to use libc++ rather than libstdc++ by setting the CLANG_CXX_LIBRARY build setting ("C++ Standard Library") to libc++.

If you have any static libraries that depend on libstdc++.tbd, you can workaround it for now by copying the file from the SDKs in Xcode 9.4 (and libstdc++.*.dylib in the iOS simulator runtime), but that is not a long term solution. You should contact the provider of those libraries and request versions built using libc++.

like image 154
Jeremy Huddleston Sequoia Avatar answered Nov 19 '22 17:11

Jeremy Huddleston Sequoia


You may copy it from old Xcode(9.4). It should work.

cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/

cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
like image 38
Antigp Avatar answered Nov 19 '22 17:11

Antigp


libstdc++ is removed in iOS 12.

I wish I had a better source than an Apple engineer on Twitter, but that's all I have.

@jeremyhu PSA: libstdc++ is gone from the iOS 12.0 SDK (it is present in the runtime for binary compatibility). It's days are numbered on macOS as well. Migrate over to libc++ if you haven't already. #WWDC2018 #cplusplus

Edit: Here's a better source, Xcode 10 patch notes

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)

like image 18
Oscar Apeland Avatar answered Nov 19 '22 18:11

Oscar Apeland


Xcode 10 cancels the libstdc++ library with built-in the lib so we should copy the file to the lib by hand.

copy the file: (libstdc++.6.0.9.tbd) and (libstdc++.6.tbd) to :

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib

and

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib 

(Please note the distinction "iPhoneOS" and "iPhoneSimulator")

clean xcode and rebuild it.

Here is the file.

like image 14
刘俊利 Avatar answered Nov 19 '22 18:11

刘俊利