azizib
azizib

Reputation: 33

Error in using static library in xamarin: ERROR: Native linking error: library not found for -lgcc_eh

I have a binding of a static library (arm64) and added it as a reference to my single view iOS project in xamarin studio but get an error related to clang++. I've tried different stuff on my additional mtouch argument (final one):

--gcc_flags "-lstdc++ -dead_strip" -v -v -v -v

but I have an error:

Native linking error: library not found for -lgcc_eh

I don't have any clue what is missing on my computer , do I need to update anything? I can run the native code on XCode without problem.

Additional info:
sdk version 9.3
linker behaviour: Link ALL
disabled incremental builds

Partial log:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -framework UIKit -framework Foundation -framework CoreGraphics -weak_framework CFNetwork /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/libsmma_combo.a /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/libsmma.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/testface.exe.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/System.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/bind1.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/registrar.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/main.arm64.o -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libapp.a -licucore -lstdc++.6.0.9 -lgcc_eh -Wl,-pie -arch arm64 -miphoneos-version-min=9.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -lz -o /Users/bam/Projects/bind1/testface/bin/iPhone/Debug/testface.app/testface -liconv -lstdc++ -dead_strip -u _UIApplicationMain -u _xamarin_release_managed_ref -u _xamarin_create_managed_ref -u _xamarin_get_block_descriptor -u _xamarin_timezone_get_data -u _xamarin_log -u _mono_pmip
        Process exited with code 1, command:
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -framework UIKit -framework Foundation -framework CoreGraphics -weak_framework CFNetwork /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/libsmma_combo.a /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/libsmma.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/testface.exe.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/System.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/bind1.dll.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/registrar.arm64.o /Users/bam/Projects/bind1/testface/obj/iPhone/Debug/mtouch-cache/main.arm64.o -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/9.8.2.22/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libapp.a -licucore -lstdc++.6.0.9 -lgcc_eh -Wl,-pie -arch arm64 -miphoneos-version-min=9.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -lz -o /Users/bam/Projects/bind1/testface/bin/iPhone/Debug/testface.app/testface -liconv -lstdc++ -dead_strip -u _UIApplicationMain -u _xamarin_release_managed_ref -u _xamarin_create_managed_ref -u _xamarin_get_block_descriptor -u _xamarin_timezone_get_data -u _xamarin_log -u _mono_pmip
        ld: library not found for -lgcc_eh
        clang: error: linker command failed with exit code 1 (use -v to see invocation)

MTOUCH: error MT5209: Native linking error: library not found for -lgcc_eh
MTOUCH: error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -lstdc++ -dead_strip
MTOUCH: error MT5202: Native linking failed. Please review the build log.
    Task "MTouch" execution -- FAILED
    Done building target "_CompileToNative" in project "/Users/bam/Projects/bind1/testface/testface.csproj".-- FAILED

Done building project "/Users/bam/Projects/bind1/testface/testface.csproj".-- FAILED

Build FAILED.

Upvotes: 1

Views: 784

Answers (1)

poupou
poupou

Reputation: 43543

There's not a lot of data to help, but I can say that the -lgcc_eh does not come directly from Xamarin.iOS.

If it's not in your own project options then it must be coming from some binding/3rd party assembly you're using in your project.

Your partial build logs hints that something adds libsmma_combo.a and libsmma.a to your project. They are also other options (e.g. -licucore -lstdc++.6.0.9) that likely comes from a requirement of a 3rd party library you're using.

It's possible that one of them is rather old and that updates are available.

Upvotes: 0

Related Questions