[LLVMdev] LLVM-ar and openssl

Wehrli Johan johan.wehrli at heig-vd.ch
Fri Jun 5 04:33:09 PDT 2015


Hi everyone,

I encountered a strange bug when I tried to compile openssl (https://www.openssl.org/) with clang and llvm-ar on a 64-bit OS X.

I changed the openssl makefile to use llvm-ar instead of simply ar.

Openssl will then create two static libraries libssl.a and libcrypto.a.

The problem occurs when it tries to link these two static libraries to the final openssl executable.

I get the following error :

ld: warning: ignoring file ../libssl.a, file was built for archive which is not the architecture being linked (x86_64): ../libssl.a
ld: warning: ignoring file ../libcrypto.a, file was built for archive which is not the architecture being linked (x86_64): ../libcrypto.a

And, of course, a lot of undefined symbols for architecture X86_64 with all the functions from these two libraries.

Openssl correctly compile with ar on OS-X 64 bits and with ar and llvm-ar on Ubuntu 64 bits.

Does anyone knows why? I searched in the llvm-ar doc in order to find if there was an argument or something like that.

For information, I configured openssl with the following parameters :
./Configure darwin64-x86_64-cc enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64

And I replaced this line AR= ar $(ARFLAGS) r in the Makefile with this AR= /path/to/llvm-ar $(ARFLAGS) r

Greetings,

Johan Wehrli









More information about the llvm-dev mailing list