William Seemann
William Seemann

Reputation: 3530

OSX cross compiling library for ARMv7

I'm trying to compile a library for an iOS application and I receive the following error message:

creating cache ./config.cache
checking for gcc... /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch armv7
checking whether the C compiler (/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch armv7  ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.

Any ideas why the armv7 compiler can't create executables but it works for i386 and x86_64? How do I fix this error?

Upvotes: 0

Views: 1252

Answers (1)

greymouser
greymouser

Reputation: 3181

What library?

I'm guessing OpenSSL by the looks of it (BSD-generic32 is telltale), and if so, just use OpenSSL-for-iPhone to build it.

The important bits for helping to select the right build are in the build-libssl.sh script there, if you are curious.

UPDATE:

Sometimes, specifying the -arch isn't enough. It's helpful to pass the entire -target, especially when compiling C libraries, or libraries that are usually deployed on unix-type systems.

Try clang -target arm64-apple-ios ... and clang -target armv7-apple-ios ..., and then use lipo to merge the libraries into one with multiple architecture support.

You can try out possible target triples (and inspect the defines produced by them, if you're curious) with clang -target armv7-apple-ios -dM -E - < /dev/null|less, for e.g.

Upvotes: 1

Related Questions