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

Does build with errors... #4

Closed flagsoft closed 7 years ago

flagsoft commented 8 years ago

Does not build... errors:

sed: RE error: illegal byte sequence

Unpacking curl tar: Unrecognized archive format tar: Error exit delayed from previous errors.

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: curl/lib/*.a (No such file or directory)

michis-MBP:Build-OpenSSL-cURL-master michi$ bash ./build.sh 
Building OpenSSL
Cleaning up
Downloading openssl-1.0.1l.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4326k  100 4326k    0     0  1002k      0  0:00:04  0:00:04 --:--:-- 1067k
Unpacking openssl
Building openssl-1.0.1l for x86_64
Copying headers
Building Mac libraries
Building openssl-1.0.1l for iPhoneOS  armv7
Building openssl-1.0.1l for iPhoneOS  armv7s
Building openssl-1.0.1l for iPhoneOS  arm64
Building openssl-1.0.1l for iPhoneSimulator  x86_64
Building openssl-1.0.1l for iPhoneSimulator  i386
Building iOS libraries
Building openssl-1.0.1l for AppleTVOS  arm64
sed: RE error: illegal byte sequence

Building Curl
Cleaning up
Downloading curl-7.37.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   318  100   318    0     0    462      0 --:--:-- --:--:-- --:--:--   462
Unpacking curl
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Libraries...
Architectures in the fat file: openssl/Mac/lib/libcrypto.a are: x86_64 
Architectures in the fat file: openssl/Mac/lib/libssl.a are: x86_64 
Architectures in the fat file: openssl/iOS/lib/libcrypto.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: openssl/iOS/lib/libssl.a are: armv7 i386 x86_64 arm64 
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: curl/lib/*.a (No such file or directory)
michis-MBP:Build-OpenSSL-cURL-master michi$ 
jasonacox commented 8 years ago

The tar errors (and later fatal error) were due to a URL change on https://curl.haxx.se/libcurl/ (moved from http to https). I updated the libcurl-build.sh script. Please try again with the new code. Thanks for the feedback!

jasonacox commented 8 years ago

@flagsoft on the sed error, that would seem to indicate that you have multibyte (UTF-8 encoding) characters in the file that sed is editing. There are several sed command run in the buildTVOS() function. Since the iOS builds work, it is probably caused by the fork() edits. I'll add an export LC_CTYPE=C to see if that helps.

ryujik commented 8 years ago

Me too, build errors: ` Mac:Build-OpenSSL-cURL-master RK$ ./build.sh Building OpenSSL Cleaning up Downloading openssl-1.0.1s.tar.gz curl: (1) Protocol "https" not supported or disabled in libcurl Building nghttp2 for HTTP2 support Cleaning up Downloading nghttp2-1.9.2.tar.gz curl: (1) Protocol "https" not supported or disabled in libcurl

Building Curl Building with HTTP2 Support (nghttp2) Cleaning up Downloading curl-7.48.0.tar.gz curl: (1) Protocol "https" not supported or disabled in libcurl

Libraries...

opensll fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: openssl//lib/.a (No such file or directory)

nghttp2 (rename to libnghttp2.a) fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: nghttp2/lib/*.a (No such file or directory)

libcurl (rename to libcurl.a) fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: curl/lib/*.a (No such file or directory) `

alberttra commented 7 years ago

This problem is still there. Does anyone know how to fix?

ryujik commented 7 years ago

What you need to build the libssl or libcurl?

alberttra commented 7 years ago

Hi, thanks for the response. I have the same problem as the others mentioned, but only at the last step while building libcurl, the other steps (openssl and nghttp2) were fine

libcurl (rename to libcurl.a) fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: curl/lib/*.a (No such file or directory)

The libcurl.a has not been created 😭

ryujik commented 7 years ago

Execute in terminal:

1) export IPHONEOS_DEPLOYMENT_TARGET="8.0" 2) export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" 3) ARCH="armv7" 4) export CFLAGS="-arch armv7 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" 5) export LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" 6) ./configure --disable-shared --enable-static --host="armv7-apple-darwin" --enable-threaded-resolver --with-darwinssl --with-ssl=/usr/bin/openssl --with-ca-bundle=/Users/???/Downloads/curl-7.48.0/ca-bundle.crt 7) make -j sysctl -n hw.logicalcpu_max 8) cp lib/.libs/libcurl.a "../../Desktop/libcurl-armv7.a" .... Last) lipo -create -output "../../Desktop/libcurl.a" "../../Desktop/libcurl-armv7.a" "../../Desktop/libcurl-armv7s.a" "$../../Desktop/libcurl-arm64.a"

For each architecture: armv7(iOS), armv7s(iOS), arm64(iOS), i386(macOS), x86_64(macOS)

ryujik commented 7 years ago

script example.txt 😎✌️

alberttra commented 7 years ago

thanks, ryujik. I will try it using your script

jasonacox commented 7 years ago

@ryujik thanks for the suggestion and example. I suspect the build failure is related to http2. You can try disabling the inclusion of http2 support:

bash build.sh -disable-http2

jasonacox commented 7 years ago

If the error you are getting is this...

configure: error: --with-nghttp2 was specified but could not find libnghttp2 pkg-config file.

This is a good indication that you are missing pkg-config. You can install:

brew install pkg-config

I have updated the nghttp2 build script to check for pkg-config and attempt to install it if it is not already installed. Script is now building without errors.