Recent

Author Topic: Provide QT5 libs in Bundle  (Read 1358 times)

shogun

  • New member
  • *
  • Posts: 6
Provide QT5 libs in Bundle
« on: February 14, 2019, 08:55:21 am »
Hello,

I made an app that is compilable in lazarus IDE using QT5 Widgetset (v5.6.3).

After that, I tried to create a bundle with this app and embendding QT5 Libraries in this bundle.

For that, I use macqtdeploy tool to integrate frameworks in the bundle but the app crash when I try to run it on a fresh OSX install.

Is there any additionnal step to do to make it works (use install_name_tool, copy plugins, ... )? Does I need to recompile QT5 statically (actually I follow the wiki guide and compile QT5Pas framework only)?

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1171
Re: Provide QT5 libs in Bundle
« Reply #1 on: February 14, 2019, 09:13:51 am »
You can have a look at the fpcupdeluxe QT5 app for Darwin.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v1.6.2m/fpcupdeluxe-x86_64-darwin-qt5.zip
It has the QT5 framework embedded.

zeljko

  • Hero Member
  • *****
  • Posts: 1090
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Provide QT5 libs in Bundle
« Reply #2 on: February 14, 2019, 09:40:35 am »
I have script for macdeploy of qt5 apps on mac, currently away from computer, just ping me on priv msg and I"ll upload it here

shogun

  • New member
  • *
  • Posts: 6
Re: Provide QT5 libs in Bundle
« Reply #3 on: February 14, 2019, 11:33:26 am »
Thanks for your answers. I will have a look at fpcupdeluxe.

Zeljko, yes i'm very interested with your script ... If you can upload here it will be nice.

shogun

  • New member
  • *
  • Posts: 6
Re: Provide QT5 libs in Bundle
« Reply #4 on: February 14, 2019, 04:27:28 pm »
I've finally find that I have to add rpath value manually with install_name_tool command. But I still interested with your script ...

This is how to make it work from a fresh install of OSX 10.12.5 :

Step 1 : Install OSX Sierra 10.12.5

Step 2 : Install xcode 7.3.1 + Command Line tools

Step 3 : Install QT 5.9.7

Step 4 : Install fpc-src-3.0.4, install fpc-3.04 using dmg images.

Step 5: Checkout lazarus trunk with svn compile with make bigide PP=ppc386

Step 6: Setup Qt5 for Lazarus :

LazarusDir=/Developer/Lazarus
QtDir=~/Qt5.9.7
cd $LazarusDir/lcl/interfaces/qt5/cbindings
PATH=$QtDir/5.9.7/clang_64/bin:$PATH
qmake
make
make install
cd /Library/Frameworks
sudo ln -s $QtDir/5.9.7/clang_64/lib/*.framework .
Step 7: Open project, set Compiler Executable in Tools→Option to /usr/local/bin/ppcx64 Set LCLWidgetType=qt5 in Project Options (Additions & Overrides) and create application bundle from Project Options Tab Compile your project

Step 7 : Copy compiled application in your_bundle.app/Contents/MacOS Customise your_bundle.app/Contents/Info.plist if needed

Step 8 :

cd /Library/Frameworks/Qt5Pas.framework/Versions/1/
sudo mkdir -p Qt5Pas.framework/Versions/1/
sudo cp Qt5Pas Qt5Pas.framework/Versions/1/                                                                         *** Note: This directory structure is strange but without this step, macdeployqt returns errors ***
$QtDir/5.9.7/clang_64/bin/macdeployqt your_bundle.app
cd your_bundle.app/Contents/MacOS/
install_name_tool -add_rpath @executable/../Frameworks/  ./name_of_your_executable

cd your_bundle.app/Contents/Frameworks/Qt5Pas.framework/Versions/1
install_name_tool -change @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport @executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport ./Qt5Pas
install_name_tool -change @rpath/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./Qt5Pas
install_name_tool -change @rpath/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./Qt5Pas
install_name_tool -change @rpath/QtNetwork.framework/Versions/5/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork ./Qt5Pas
install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./Qt5Pas
« Last Edit: February 15, 2019, 01:35:47 pm by shogun »