Repository navigation
Universal binary support - #421
stuartcarnie wants to merge 1 commit into
Conversation
|
Thank you for taking on this huge project! I think I need to build at least some of these myself so they will have the proper code signature, and also so I know how to do it next time they change. Also, some of this code came from my personal forks (like Sparkle and NMSSH). This was all a bit opaque which I apologize for. I've added submodules with all the external dependencies whose source wasn't already in the repo as of commit e83f5af. Please help me learn what you did, because I spent some time fighting with libsixel's automake today and it was not much fun. The parts I'm not sure how to do are:
|
|
Hi @gnachman libsixelI committed Fat binariestl;dr:
$ lipo -create -output libssl.a libssl-arm64.a libssl-x86_64.aAnd to verify your archive: $ lipo -info libssl.aOpenSSLThis was the most involved.
Build arm64 target
diff --git Configurations/10-main.conf Configurations/10-main.conf
index 3b07731db8..fdcdb6a514 100644
--- Configurations/10-main.conf
+++ Configurations/10-main.conf
@@ -1557,6 +1557,14 @@ my %targets = (
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "macosx",
},
+ "darwin64-arm64-cc" => {
+ inherit_from => [ "darwin-common", asm("aarch64_asm") ],
+ CFLAGS => add("-Wall"),
+ cflags => add("-arch arm64"),
+ lib_cppflags => add("-DL_ENDIAN"),
+ bn_ops => "SIXTY_FOUR_BIT_LONG",
+ perlasm_scheme => "ios64",
+ },
##### GNU Hurd
"hurd-x86" => {NOTE: This updated patch ensures arm64 assembly optimizations are utilized, which I missed from my first version.
$ ./Configure darwin64-arm64-cc
$ make build_generated
$ make libcrypto.a libssl.a -j4
$ mv libcrypto.a libcrypto-arm64.a
$ mv libssl.a libssl-arm64.a
$ make cleanConfigure and build the x86_64 target$ ./Configure darwin64-x86_64-cc
$ make build_generated
$ make libcrypto.a libssl.a -j4
$ mv libcrypto.a libcrypto-x86_64.a
$ mv libssl.a libssl-x86_64.aFat binary
$ lipo -create -output libcrypto.a libcrypto-arm64.a libcrypto-x86_64.a
$ lipo -create -output libssl.a libssl-arm64.a libssl-x86_64.alibssh2I checked out the latest (1.9-DEV), which seems to work fine, but you could fetch a specific version. Build x86_64 target
$ mkdir build_x86_64
$ cd build_x86_64
$ cmake -DOPENSSL_ROOT_DIR=~/projects/macos/openssl -DBUILD_EXAMPLES=NO -DBUILD_TESTING=NO -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCRYPTO_BACKEND=OpenSSL ..
$ make libssh2 -j4NOTE: libssh2.a output is in Build arm64 target
$ mkdir build_arm64
$ cd build_arm64
$ cmake -DOPENSSL_ROOT_DIR=~/projects/macos/openssl -DBUILD_EXAMPLES=NO -DBUILD_TESTING=NO -DCMAKE_OSX_ARCHITECTURES=arm64 -DCRYPTO_BACKEND=OpenSSL ..
$ make libssh2 -j4Create libssh2 fat binary
$ cd ..
$ lipo -create -output libssh2.a build_arm64/src/libssh2.a build_x86_64/src/libssh2.a |
Update: libssh2I checked out the latest (1.9-DEV), which seems to work fine, but you could fetch a specific version. Turns out CMake can utilize the ability for the clang toolchain to build multiple architectures in a single compilation using Build fat binary
$ mkdir build
$ cd build
$ cmake -DOPENSSL_ROOT_DIR=~/projects/macos/openssl -DBUILD_EXAMPLES=NO -DBUILD_TESTING=NO -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCRYPTO_BACKEND=OpenSSL ..
$ make libssh2 -j4NOTE: libssh2.a output is in |
060a3a9 to
ad793fb
Compare
|
I've pushed a new version that is rebased on your latest. This version is using your forks of the NMSSH and Sparkle frameworks. |
|
Did you have to modify it further to support older versions of macOS? I used this to build a fat binary of OpenSSL for my Mac app that supports back to 10.10, and initially got warnings about linking against a library built for a newer macOS version than I was targeting. I had to add to the |
* Updated to use George's forks of NMSSH and Sparkle * Still uses embedded libsixel TODOs * Determine updated make libsixel invocation to build a universal static binary
ad793fb to
33921d8
Compare
|
I have a makefile that should automate this, but Apple has suggested to me that this might be under NDA for now. Hang tight and I'll try to get a straight answer from them on whether there's any problem making these changes public yet. @tomhamming You shouldn't need to go back as far as 10.10. iTerm2 only supports 10.12+ |
|
@gnachman thanks. I was actually building OpenSSL for my app that supports back to 10.10. I mainly asked the question to clarify that that's the proper way to build for older macOS versions - I'm not familiar with |
|
Commit 83a3c75 adds Makefile targets to build everything as fat binaries. If you build it on a DTK you should get a fat binary. Please let me know if I missed anything. Thanks for your help in getting this done, @stuartcarnie. I am allergic to automake and your help was really valuable. |
|
@gnachman awesome to hear – I'll give |
|
Works great! |
This PR includes all the changes for building iTerm2 as a Universal macOS Binary. There may be edits required so that it can be merged, but most of the time-consuming work as been done. The only change required to iTerm2 itself was to iTermBacktrace.mm (as anticipated).
It includes universal builds for a number of embedded frameworks, including:
libcrypto.aandlibssh.aas fat binarieslibssh2.aas a fat binary