Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld: library not found for -lstdc++.6

After updating Xcode Version to 10.0 beta start getting "ld: library not found for -lstdc++.6" error. same code working fine in Xcode 9.2

Also updated macOS to 10.13.5

like image 902
vks Avatar asked Jun 27 '18 10:06

vks


People also ask

How do I fix libc So 6?

Just mount your root filesystem (which you can usually do with one click in the file browser, though you can use the mount command if you like). Then, in a terminal, use the mv or cp command to restore libc.

What package contains libc So 6?

The libc. so. 6 file is present in the libc6 package.

Where can I find libc?

As for the location, it's almost certainly going to be in /usr/lib/libc. a and / or /usr/lib/libc.so .

Where is Libstdc So 6?

so. 6 cannot be located. This happens even when the libstdc++ is installed and the file is available in /usr/local/lib/libstdc++.so. By default, the ds_agent looks for the required library in the /opt/ds_agent/lib folder.


Video Answer


2 Answers

You'll have this issue when targeting iOS App. It's stated in the Release note:

Deprecation Notices:

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)

Source: Release Notes of XCode Beta 2

Side Note:
You need to be logged to access the page.
Link might break in next beta release (URLs change), but it's in the part Developers/Download

XCode 10 being officially released with its release note, it's still as such:

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 macOS 10.9 or later, or 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 132
Larme Avatar answered Sep 21 '22 14:09

Larme


The quick solution is to copy all libstdc++.* file from old Xcode(9.4) to new Xcode(10.x)

For device :

cp /Applications/Xcode9.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/

For Simulator :

cp /Applications/Xcode9.4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.* /Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

like image 29
Shamsher Singh Avatar answered Sep 21 '22 14:09

Shamsher Singh