Recent

Author Topic: Problem with Qt5 on macOS (Resolved)  (Read 601 times)

mischi

  • Full Member
  • ***
  • Posts: 189
Problem with Qt5 on macOS (Resolved)
« on: November 14, 2025, 02:34:37 pm »
Hi.

I am trying to extend the MacPorts package description of lazarus for the Qt5 version. The big obstacle is that the framework Qt5Pas has a wrong install_name in the final binaries (lazarus, startlazarus and lhelp).

'otool -L lazarus' yields:

lazarus:
<snip>
   Qt5Pas.framework/Versions/1/Qt5Pas (compatibility version 1.2.0, current version 1.2.16)
   /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61901.40.77)

The complete path is needed:
   /opt/local/libexec/qt5/lib/Qt5Pas.framework/Versions/1/Qt5Pas (compatibility version 1.2.0, current version 1.2.16)

or (less preferred):

   /opt/local/Library/Frameworks/Qt5Pas.framework/Versions/1/Qt5Pas (compatibility version 1.2.0, current version 1.2.16)

I tried all kinds of options for fpc as well as the linker, but nothing worked. The only temporary solution was to make the change with  'install_name_tool'.

This is with lazarus 4.4, fpc 3.2.2 and macOS 26.1-arm.

Any help?

MiSchi
« Last Edit: November 20, 2025, 03:46:15 pm by mischi »

zeljko

  • Hero Member
  • *****
  • Posts: 1823
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Problem with Qt5 on macOS
« Reply #1 on: November 14, 2025, 03:34:15 pm »
Maybe that could be fixed with qmake5 ? I'm still using install_name_tool to fix paths in builded myapplication.app , so it carries complete Qt with it and I don't need to install it separatelly.

mischi

  • Full Member
  • ***
  • Posts: 189
Re: Problem with Qt5 on macOS
« Reply #2 on: November 14, 2025, 05:48:26 pm »
Hi

The problem is that the install_name_tool trick is only preliminary for the Lazarus app. It needs to be done for any project as well, which is quite a challenge for a regular user of Lazarus. That is the reason, why I am looking for some settings/options that  take care of this issue. Do you have an idea, how QMake5 does the trick?

MiSchi.

zeljko

  • Hero Member
  • *****
  • Posts: 1823
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Problem with Qt5 on macOS
« Reply #3 on: November 14, 2025, 08:16:20 pm »
I don't know, I'm guessing about qmake params, I've never tried that, that's why I'm using qt deploy script + install_name_tool to pack my app (script triggers after compilation), also I'm not using qt5 on mac for some time, only qt6.

mischi

  • Full Member
  • ***
  • Posts: 189
Re: Problem with Qt5 on macOS
« Reply #4 on: November 14, 2025, 09:53:04 pm »
I haven't tried Qt6 so far. Does it work well and easily?

zeljko

  • Hero Member
  • *****
  • Posts: 1823
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Problem with Qt5 on macOS
« Reply #5 on: November 14, 2025, 10:39:24 pm »
Yes, it works pretty good - I'm using Lazarus Qt6 on mac all the time :), there was some problem with Qt6 bugs during release cycle, but now I'm using Qt-6.8.3 and that's ok.

mischi

  • Full Member
  • ***
  • Posts: 189
Re: Problem with Qt5 on macOS
« Reply #6 on: November 16, 2025, 07:44:29 pm »
I build lazarus with qt6 on macOS 26.1 arm along this way:
1) create the Qt6pas framework in lcl/interfaces/qt6/cbindings
- /opt/local/libexec/qt6/bin/qmake
- make
- sudo make install
2) create lazarus:
- make bigide OPT="-gl -Ff/opt/local/libexec/qt6/lib" LCL_PLATFORM=qt6

Compilation and linking work, but otools -L lazarus yields:
   Qt6Pas.framework/Versions/6/Qt6Pas (compatibility version 6.2.0, current version 6.2.10)

So, /opt/local/libexec/qt6/lib is again missing. Unfortunately.

Edit: I finally got it: I need to change the id of the framework(See below). Then linking works.

This command:

sudo install_name_tool -id /opt/local/libexec/qt6/lib/Qt6Pas.framework/Versions/6/Qt6Pas Qt6Pas.framework/Qt6Pas

fixed it after installation. But this can also be done immediately after building the framework.

Maybe, it can also be done with some options to qmake or make when building the framework, but I leave this to others to investigate.

MiSchi
« Last Edit: November 16, 2025, 10:56:20 pm by mischi »

 

TinyPortal © 2005-2018