martin
martin

Reputation: 96899

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.
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. App builds without any error or warning but when I run it in the iPhone simulator all I get is this error message:

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. Do you have any idea what might be wrong?

Upvotes: 7

Views: 933

Answers (1)

phyrrus9
phyrrus9

Reputation: 1467

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

Upvotes: 2

Related Questions