在xamarin中使用静态库时出错:错误:本机链接错误:找不到-lgcc_eh的库

时间:2016-09-03 10:20:17

标签: gcc xamarin xamarin.ios clang++

我有一个静态库(arm64)的绑定,并将其添加为xamarin studio中我的单视图iOS项目的引用,但是得到了与clang ++相关的错误。我在我的额外mtouch参数(最后一个)上尝试了不同的东西:

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

但我有一个错误:

  

原生链接错误:找不到-lgcc_eh的库

我不清楚计算机上缺少什么,我需要更新任何内容吗?我可以毫无问题地在XCode上运行本机代码。

其他信息:
sdk版本9.3
链接器行为:链接所有
禁用增量构建

部分日志:

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

1 个答案:

答案 0 :(得分:0)

没有太多数据可以提供帮助,但我可以说,-lgcc_eh并非来自Xamarin.iOS的直接

如果它不在您自己的项目选项中,那么它必须来自您在项目中使用的某些绑定/第三方程序集。

您的部分构建日志提示某些内容会为您的项目添加libsmma_combo.alibsmma.a。它们也是其他选项(例如-licucore -lstdc++.6.0.9),可能来自您正在使用的第三方库的要求。

其中一个可能很旧并且可以进行更新。