jasonacox / Build-OpenSSL-cURL

Scripts to build OpenSSL, HTTP/2 (nghttp2) and cURL (libcurl) for MacOS, iOS and tvOS devices (x86_64, armv7, armv7s, arm64, arm64e). Now Supporting Apple Silicon, OpenSSL 3.0.x with TLS 1.3 and Mac Catalyst builds.
MIT License
419 stars 125 forks source link

Lib not found #54

Closed lah64 closed 11 months ago

lah64 commented 3 years ago

When I add all 4 static libraries to the project, I start having problems, because XCode can't find these libraries for arm64, what could be the problem?

openssl/Mac/lib/libcrypto.a are:     x86_64 -OK arm64 - Lib not found (XCode)
openssl/Mac/lib/libssl.a are:           x86_64 -OK arm64 - Lib not found (XCode)
nghttp2/lib/libnghttp2_Mac.a are: x86_64 -OK arm64 - Lib not found (XCode)
curl/lib/libcurl_Mac.a are:               x86_64 -OK arm64 - OK
Version: 11.2.3 M1    - Problem
Version: 11.2.2 Intel  - OK

Steps:

  1. any Mac on M1
  2. Add: libcrypto.a OR libnghttp2.a OR libssl.a to project
  3. Compile arm64
  4. Get Output
jasonacox commented 3 years ago

Can you check that the static libraries have all of the architectures built? It should look something like this:

$ file archive/libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0/lib/MacOS/libcurl.a 

archive/libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0/lib/MacOS/libcurl.a: Mach-O universal binary with 2 architectures: [x86_64:current ar archive random library] [arm64]
archive/libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0/lib/MacOS/libcurl.a (for architecture x86_64): current ar archive random library
archive/libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0/lib/MacOS/libcurl.a (for architecture arm64):  current ar archive random library

Also, for multiple target builds, another option is to use the xcframework folder and copy those into your Xcode project. The xcframework files are located in the archive folder:

$ ls -l archive/libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0/xcframework      

 libcrypto.xcframework/
 libcurl.xcframework/
 libnghttp2.xcframework/
 libssl.xcframework/
lah64 commented 3 years ago

Screenshot 2021-03-24 at 17 45 30

jasonacox commented 3 years ago

Are you able to use xcframework to compile your project on the M1?

lah64 commented 3 years ago

Unfortunately not, alas. But I have identified the problem, most likely it is a problem with the libraries here because I took this and these libraries have been compiled successfully both the project. But I can not compile + libnghttp2_Mac.a..

https://github.com/carsenk/openssl10-darwin-arm (libcrypto.a + libssl.a)

jasonacox commented 3 years ago

That's interesting. I'm not able to duplicate your problem. You can try:

1) Building without http2 (though I assume you are wanting http2): ./build.sh -d

2) Try to use the libraries I made: libcurl-7.74.0-openssl-1.1.1i-nghttp2-1.42.0.tgz

jasonacox commented 11 months ago

Closing with the new update - please open if it is still an issue.