Recent

Author Topic: Using Qt on Mac OS  (Read 13997 times)

DrMefistO

  • New Member
  • *
  • Posts: 13
Using Qt on Mac OS
« on: April 21, 2014, 11:40:34 am »
Hi!
I'm trying to make my project cross-runnable. And I have some troubles.
I have tried to use Qt in my project, and have did such things.

Then, I have compiled my program with LCLWidgetType=qt. It was compiled. But when I'm trying to run it, it writes in console: mach-o but wrong architecture about QtWebToolkit.framework/Version/4/QtWebToolkit. My platform is i386, I guess.

So, my question is: How to compile my program or Qt bindings or Qt Library or what for my Platform or for Any Mac Platform?
« Last Edit: April 21, 2014, 11:43:24 am by DrMefistO »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Using Qt on Mac OS
« Reply #1 on: April 21, 2014, 05:03:04 pm »
Quote
But when I'm trying to run it, it writes in console: mach-o but wrong architecture about QtWebToolkit.framework/Version/4/QtWebToolkit. My platform is i386, I guess.
Check whether the binary is also for i386. On Linux, you can use `file` from terminal. I don't know whether this tool has its root in Unix or Linux. If the former, then Mac is likely to have it as well. The output would be something like:
Code: [Select]
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.4.0, strippedA not so difficult alternative is to build the Qt binding from source yourself. The source archive documents the process quite simply but I think it's understandable.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #2 on: April 21, 2014, 05:46:05 pm »
Quote
Check whether the binary
Which binary? And what I should to do, if I will be know a bit mode.

I just want to distribute my program with minimum "left-side works": user should be able to "just double-click and run".

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Using Qt on Mac OS
« Reply #3 on: April 21, 2014, 06:11:18 pm »
Quote
Which binary?
Qt binding (.dylib / .so)
Quote
I just want to distribute my program with minimum "left-side works": user should be able to "just double-click and run".
For Mac, I suggest using Carbon instead of Qt.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #4 on: April 21, 2014, 06:15:13 pm »
Quote
For Mac, I suggest using Carbon instead of Qt.
Carbon has so many bugs... TListView: selecting items by arrow keys changes focus to whole ListView, then goes to next item.
TStatusBar: some text dissapears from status bar randomly. But in Win/Linux it works normal.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #5 on: April 21, 2014, 07:04:50 pm »
Quote
Dyld Error Message:
  Library not loaded: QtWebKit.framework/Versions/4/QtWebKit
  Referenced from: /Library/Frameworks/Qt4Pas.framework/Versions/5/Qt4Pas
  Reason: no suitable image found.  Did find:
   /Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit: mach-o, but wrong architecture
This is text of error message. "QtWebKit.framework/Versions/4/QtWebKit" has x86_64 architecture. What's next?)

When I'm trying to use built-up qt4pas from sources, Im' getting:
Quote
ld: warning: ignoring file /Library/Frameworks//Qt4Pas.framework/Qt4Pas, file was built for x86_64 which is not the architecture being linked (i386): /Library/Frameworks//Qt4Pas.framework/Qt4Pas
Changing project's architecture from Default to i386/x86_64 don't change anything.

My Lazarus IDE tells me that it is "i386-Darwin-Carbon".
« Last Edit: April 21, 2014, 07:17:51 pm by DrMefistO »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Using Qt on Mac OS
« Reply #6 on: April 22, 2014, 02:53:20 am »
Quote
Dyld Error Message:
  Library not loaded: QtWebKit.framework/Versions/4/QtWebKit
  Referenced from: /Library/Frameworks/Qt4Pas.framework/Versions/5/Qt4Pas
  Reason: no suitable image found.  Did find:
   /Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit: mach-o, but wrong architecture
This is text of error message. "QtWebKit.framework/Versions/4/QtWebKit" has x86_64 architecture. What's next?)
64-bit / 32-bit incompatibilities between libraries. Seems like the binding is 32-bit, but the library is 64-bit. What OS X version are you using? AFAIK 32-bit OS X is deprecated (or obsolete?) so latest OS X must be 64-bit.
When I'm trying to use built-up qt4pas from sources, Im' getting:
Quote
ld: warning: ignoring file /Library/Frameworks//Qt4Pas.framework/Qt4Pas, file was built for x86_64 which is not the architecture being linked (i386): /Library/Frameworks//Qt4Pas.framework/Qt4Pas
Changing project's architecture from Default to i386/x86_64 don't change anything.

My Lazarus IDE tells me that it is "i386-Darwin-Carbon".
How did you build it? Did you follow the readme/install file? The Qt4Pas library itself is written in C-flattened C++. So if you're building it from Lazarus, obviously you didn't follow the readme/install.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #7 on: April 22, 2014, 09:47:51 am »
What OS X version are you using?
My processor is Intel i5, so I think Mac has 64-bit mode.
What OS X version are you using?How did you build it? Did you follow the readme/install file? The Qt4Pas library itself is written in C-flattened C++. So if you're building it from Lazarus, obviously you didn't follow the readme/install.
  • qmake
  • qcodebuild
« Last Edit: April 22, 2014, 10:09:58 am by DrMefistO »

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Using Qt on Mac OS
« Reply #8 on: April 22, 2014, 10:11:28 am »
If you installed already builded qt libs then you cannot use binary of libQt4Pas since Qt libs are 64bit and libQt4Pas is 32 bit.
1.With 64bit you must rebuild libQt4Pas, so your qt widgetset will use cocoa widgetset, and there are some qt bugs which should be fixed with qt-4.8.6 and 5.2.2 afaik.That bugs stops me from using Qt 64bit for mac (cocoa).It actually works but have problems with mouse and capture.
2.For using (that's what I'm using now) 32 bit (carbon) you must rebuild qt with carbon (and deploy also) and also you must rebuild libQt4Pas.That works fine - my apps are in real production.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #9 on: April 22, 2014, 10:19:41 am »
1.With 64bit you must rebuild libQt4Pas, so your qt widgetset will use cocoa widgetset, and there are some qt bugs which should be fixed with qt-4.8.6 and 5.2.2 afaik.That bugs stops me from using Qt 64bit for mac (cocoa).It actually works but have problems with mouse and capture.
2.For using (that's what I'm using now) 32 bit (carbon) you must rebuild qt with carbon (and deploy also) and also you must rebuild libQt4Pas.That works fine - my apps are in real production.
Could you post here steps for 1. and 2. please?

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Using Qt on Mac OS
« Reply #10 on: April 22, 2014, 10:55:11 am »
1.With 64bit you must rebuild libQt4Pas, so your qt widgetset will use cocoa widgetset, and there are some qt bugs which should be fixed with qt-4.8.6 and 5.2.2 afaik.That bugs stops me from using Qt 64bit for mac (cocoa).It actually works but have problems with mouse and capture.
2.For using (that's what I'm using now) 32 bit (carbon) you must rebuild qt with carbon (and deploy also) and also you must rebuild libQt4Pas.That works fine - my apps are in real production.
Could you post here steps for 1. and 2. please?

1.Rebuild libQt4Pas from sources and that's it, your application will be 64bit qt-cocoa based.
2.Download qt sources, (I'm not sure that it's possible to build eg. qt-4.8.5 for carbon 32 bit), so download eg. qt-4.7.4 and build it for 32 bit carbon.Then rebuild libQt4Pas against qt-4.7.4

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #11 on: April 22, 2014, 11:20:08 am »
so download eg. qt-4.7.4 and build it for 32 bit carbon.Then rebuild libQt4Pas against qt-4.7.4
O don't understand how to "build it for 32 bit carbon".

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Using Qt on Mac OS
« Reply #12 on: April 22, 2014, 12:40:02 pm »
When you unpack qt-4.7.4 there are "howto" files like README, INSTALL etc ... there you can find howto build it.

DrMefistO

  • New Member
  • *
  • Posts: 13
Re: Using Qt on Mac OS
« Reply #13 on: April 22, 2014, 12:43:12 pm »
I know how to build, but how to build for 32-bit carbon? It's the same as just
 - qmake
 - make
 - make install
?

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Using Qt on Mac OS
« Reply #14 on: April 22, 2014, 01:09:33 pm »
I did it one or two years ago, so really cannot remember. Think that you have to pass some flags to configure/qmake .... really don't know.

 

TinyPortal © 2005-2018