简体   繁体   中英

linker error while linking to arm64 library on Xcode

I'm trying to build my project for arm64. This project requires an arm64 libcrypto.a. I'd like to know if I'm missing any settings. Thanks in advance...

The error I see is:

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

My project settings are shown below:

Architectures: arm64
Base SDK: Latest iOS(iOS 11.4)
Build Active Architecture Only: No
Supported Platforms: iOS
Valid Architectures: arm64

I've updated "RequiredDeviceCapabilities" in info.plist to arm64.
I've checked the type of library I'm trying to link with:

[Amys-MacBook-Air:include$ lipo -info libcrypto.a 
input file libcrypto.a is not a fat file
Non-fat file: libcrypto.a is architecture: arm64

I fail to understand why the error says the project is being built for x86_64.

Looks like OpenSSL has some issues with multi-arch builds that you need to address for it to work, the answer here Build Multiarch OpenSSL on OS X should help.

Essentially, you'll have to replace a couple of the OpenSSL header files that include the architecture-specific header using #ifdef to check the system architecture at compile time. Do this after building OpenSSL from source for each target that you want. Then you'll be able to use the lipo tools to combine each target's static library build for OpenSSL into one static library, then use that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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