Synergy-Binaries icon indicating copy to clipboard operation
Synergy-Binaries copied to clipboard

MacOS universal support

Open thefat32 opened this issue 1 year ago • 2 comments

I've built universal .app using my own universal build of openssl 3.1 and qt 5.15.9. I don't have an M1 mac so you are welcome to test and report. This issue is intended to keep track of work that needs to be done to create an universal build.

Link

# OpenSSL

$ git clone https://github.com/openssl/openssl.git
$ cd openssl
$ git checkout --force -b openssl-3.1 --track origin/openssl-3.1
$ git submodule update --init --recursive --force
$ mkdir build
$ cd build
$ ../Configure darwin64-arm64 --release --prefix=/Users/<username>/install/arm64/openssl
$ make -j8
$ make -j8 install_sw
$ make clean
$ ../Configure darwin64-x86_64 --release --prefix=/Users/<username>/install/x86_64/openssl
$ make -j8
$ make -j8 install_sw
$ cd /Users/<username>/install
$ mkdir -p universal/openssl/lib
$ cp -r x86_64/openssl/include universal/openssl/include
$ lipo -create arm64/openssl/lib/libcrypto.a x86_64/openssl/lib/libcrypto.a -output universal/openssl/lib/libcrypto.a
$ lipo -create arm64/openssl/lib/libssl.a x86_64/openssl/lib/libssl.a -output universal/openssl/lib/libssl.a

# Qt 5.15.9
# Download https://download.qt.io/archive/qt/5.15/5.15.9/single/qt-everywhere-opensource-src-5.15.9.tar.xz

$ gunzip qt-everywhere-opensource-src-5.15.9.tar.gz
$ tar xvf qt-everywhere-opensource-src-5.15.9.tar
$ cd qt-everywhere-opensource-src-5.15.9
$ ./configure QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"  -release -prefix=/Users/<username>/install/universal/qt5
$ make -j8
$ make -j8 install

Add in Scripts/Build/BuildDarwin.sh

-D CMAKE_OSX_ARCHITECTURES="arm64;x86_64" \

Then follow normal install instructions and use own compiled libs in config

[Darwin]

   libQtPath   = /Users/<username>/install/universal/qt5
   openSSLPath = /Users/<username>/install/universal/openssl

thefat32 avatar May 17 '23 20:05 thefat32

Awesome work mate. Thanks for giving this a shot. I'll port this to the build scripts when I get some free time.

DominikDeak avatar May 18 '23 05:05 DominikDeak

Building Qt is time expensive so I think that if you want to add support for building universal .app we need to upload prebuilt binaries somewhere it could be downloaded by build scripts.

Also if you're planning to build Qt 5.15.9 in Ventura (SDK 13) take a look at this issue. Ventura is not a tested platform for Qt5 and I needed to do that one line addition mentioned in the issue to build full Qt 5.15.9.

When you decide how you would like to integrate universal build onto your project I can help.

Have a nice weekend!

thefat32 avatar May 18 '23 16:05 thefat32