简体   繁体   English

编译使用OpenMP的iOS静态库

[英]Compiling static library for iOS that uses OpenMP

I'm writing a simple cross-platform library that uses OpenMP but I can't figure out how to test it in an iPhone app. 我正在编写一个使用OpenMP的简单跨平台库,但我无法弄清楚如何在iPhone应用程序中测试它。
I'm running OS X , with GCC 4.7 , I compiled it as a static library, I also managed to link it together with libgomp.a and add it to my test app in Xcode. 我正在运行OS X ,使用GCC 4.7 ,我将其编译为静态库,我还设法将它与libgomp.a链接在一起并将其添加到我在Xcode中的测试应用程序中。 App builds without any error or warning but when I run it in the iPhone simulator all I get is this error message: 应用程序构建没有任何错误或警告,但当我在iPhone模拟器中运行它时,我得到的是此错误消息:

dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
  Referenced from: /opt/local/lib/gcc47/i386/libgomp.1.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___emutls_get_address
  Referenced from: /opt/local/lib/gcc47/i386/libgomp.1.dylib
  Expected in: /usr/lib/libSystem.B.dylib

I read that there was a bug in previous versions of GCC with ___emutls_get_address , but it should be fixed now. 我读到以前版本的GCC中有一个带有___emutls_get_address ,但现在应该修复它。 Do you have any idea what might be wrong? 你知道什么可能是错的吗?

It is looking for a dynamic library that does not exist. 它正在寻找一个不存在的动态库。 Since you can't use dynamic libraries on the actual device, it will fail on device but not during build. 由于您无法在实际设备上使用动态库,因此它将在设备上失败但在构建期间不会失败。 You should try to rebuild the library as .a files manually, and ensure you arnt using any -l arguments. 您应该尝试手动将库重建为.a文件,并确保使用任何-l参数。 That is the best I have for you. 这是我给你的最好的。 Assuming this isnt jailbroken (probably true), you will need to simply link it manually. 假设这不是越狱(可能是真的),你需要手动链接它。 You could always just add the libraries code files to your project. 您可以随时将库代码文件添加到项目中。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM