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

Build on Intel Mac with Sonoma fails on openssl / MacOS/arm64 #66

Open olekrisek opened 6 months ago

olekrisek commented 6 months ago

Hi, I got this error when I try to build: Mac : Mac-Mini 2018, OS: Sonoma 14.2

% ./build.sh -o 3.1.4 -c 8.1.2 -n 1.55.1 -d -e -i 12.3 -a 12.3
Build-OpenSSL-cURL
This script builds OpenSSL, nghttp2 and libcurl for MacOS, iOS and tvOS devices.
Targets: x86_64, armv7, armv7s, arm64 and arm64e

Building OpenSSL
Downloading openssl-3.1.4.tar.gz
** Building OpenSSL openssl-3.1.4 **
Unpacking openssl
+ Activate Static Engine
Building Mac libraries
Building openssl-3.1.4 for x86_64 (MacOS 12.3)
Testing binary for x86_64:
OpenSSL 3.1.4 24 Oct 2023 (Library: OpenSSL 3.1.4 24 Oct 2023)
Building openssl-3.1.4 for arm64 (MacOS 12.3)
** ERROR with Build - Check /tmp/openssl*.log
==> /tmp/openssl-3.0.9-arm64.log <==
1 error generated.
make[1]: *** [apps/lib/libapps-lib-names.o] Error 1
make: *** [build_sw] Error 2

==> /tmp/openssl-3.0.9-x86_64.log <==
rm -f providers/fips*.new
rm -f openssl.pc libcrypto.pc libssl.pc
find . -type l \! -name '.*' -exec rm -f {} \;

==> /tmp/openssl-3.1.4-arm64.log <==
1 error generated.
make[1]: *** [apps/lib/libapps-lib-apps.o] Error 1
make: *** [build_sw] Error 2

==> /tmp/openssl-3.1.4-x86_64.log <==
rm -f providers/fips*.new
rm -f openssl.pc libcrypto.pc libssl.pc
find . -type l \! -name '.*' -exec rm -f {} \;

and the mentioned log file:

-DENGINESDIR="\"/tmp/openssl-3.1.4-arm64/lib/engines-3\"" -DMODULESDIR="\"/tmp/openssl-3.1.4-arm64/lib/ossl-modules\"" -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -I.. -isysroot /Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -MMD -MF apps/lib/libapps-lib-http_server.d.tmp -MT apps/lib/libapps-lib-http_server.o -c -o apps/lib/libapps-lib-http_server.o apps/lib/http_server.c
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from apps/lib/apps.c:21:
In file included from include/openssl/engine.h:24:
In file included from include/openssl/bn.h:20:
In file included from include/openssl/e_os2.h:234:
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
              ^~~~~~~~~~~~
apps/lib/engine.c:17:10: fatal error: 'string.h' file not found
In file included from apps/lib/app_rand.c:10:
In file included from apps/include/apps.h:13:
In file included from include/internal/e_os.h:16:
In file included from include/openssl/e_os2.h:234:
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
              ^~~~~~~~~~~~

What should I do ?

jasonacox commented 6 months ago

Hi @olekrisek - Thanks for opening this.

./build.sh -o 3.1.4 -c 8.1.2 -n 1.55.1 -d -e -i 12.3 -a 12.3

It seems you are trying to use OpenSSL 3.1 version. Try switching to OpenSSL 3.0 series which is a Long Term Support (LTS) version and is supported until 7th September 2026. OpenSSL versioning is a bit odd (3.1 and 3.2 will expire before 3.0) and the MINOR versions tend to be breaking. For that reason, we focus on the LTS (5 year) version for the project to make it easier to maintain.

I did update the version to latest LTS for all the libraries and it did compile successfully. Please let me know if this helps!

OPENSSL="3.0.9"         # https://www.openssl.org/source/ 
LIBCURL="8.1.2"         # https://curl.haxx.se/download.html
NGHTTP2="1.55.1"        # https://nghttp2.org/
olekrisek commented 6 months ago

Thank you !! This works.