-
Notifications
You must be signed in to change notification settings - Fork 364
Compile Qt 64 bit with OpenSSL on MacOs
This is how we compile Qt and OpenSSL from source.
In it's jump to OpenSSL 1.1.0, there were a lot of changes to OpenSSL which are not compatible to Qt below 5.9 (at time of writing this, support for OpenSSL 1.1.0 was discussed for the future version Qt 5.9). So if you compile Qt 5.8 or lower, get an OpenSSL version 1.0.x.
First, we compile openSSL. Get the latest (not pre-) version from https://www.openssl.org/source/ (or install git and check out the lastest version). Next we will untar the sources, and build openSSL.
tar xvfz openSSL-sources.xxxx.tar.gz
cd openSSL-xxxx
mkdir dist
./Configure --prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared darwin64-x86_64-cc
make depend && make && make install
OpenSSL is now compiled and installed in the previously created dist/ folder. We will now use this to compile Qt.
You can obtain the Qt sources from the Qt homepage using the quick installer. Configure Qt using the following command. Of course you might have to modify the path to openSSL.
./configure -release -opensource -openssl -I /Users/peter/Downloads/openssl-1.1.0h/dist/include/ -L /Users/peter/Downloads/openssl-1.1.0h/dist/lib/ -nomake examples -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qttranslations -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtxmlpatterns
Run make to build the whole thing. Get a coffee ... or 2.
When macdeployqt is not working as expected you might have to change the rpath. The rpath defines where the executable looks for libraries. Unfortunately, this is set at compile time and can not be influenced from the outside at runtime. With a custom compile of Qt these can be set wrong. You can change the defined rpath. otool -L <file>
shows the currently set paths and install_name_tool -rpath <old-path> <new-path> <file>
can change the path in the executable. Instead of using an rpath, which is absolut, you can also use a @executable_path which is relative to the executable being called.