Using Qt on Mac OS lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- DrMefistO · 2014-04-21 09:40 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. Installed qt-mac-opensource-4.8.5Installed Qt Bindinds mac_bin- qt4pas-V2.5_Qt4.5.3 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? ---------------------------------------------------------------------- Leledumbo · 2014-04-21 15:03 QuoteBut 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 · 2014-04-21 15:46 QuoteCheck whether the binaryWhich 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 · 2014-04-21 16:11 QuoteWhich binary?Qt binding (.dylib / .so) QuoteI 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 · 2014-04-21 16:15 QuoteFor 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 · 2014-04-21 17:04 QuoteDyld 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 architectureThis 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: Quoteld: 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/Qt4PasChanging project's architecture from Default to i386/x86_64 don't change anything. My Lazarus IDE tells me that it is "i386-Darwin-Carbon". ---------------------------------------------------------------------- Leledumbo · 2014-04-22 00:53 Quote from: DrMefistO on April 21, 2014, 07:04:50 pmQuoteDyld 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 architectureThis 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. Quote from: DrMefistO on April 21, 2014, 07:04:50 pmWhen I'm trying to use built-up qt4pas from sources, Im' getting: Quoteld: 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/Qt4PasChanging 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 · 2014-04-22 07:47 Quote from: Leledumbo on April 22, 2014, 02:53:20 amWhat OS X version are you using?My processor is Intel i5, so I think Mac has 64-bit mode. Quote from: Leledumbo on April 22, 2014, 02:53:20 amWhat 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.qmakeqcodebuild ---------------------------------------------------------------------- zeljko · 2014-04-22 08:11 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 · 2014-04-22 08:19 Quote from: zeljko on April 22, 2014, 10:11:28 am1.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 · 2014-04-22 08:55 Quote from: DrMefistO on April 22, 2014, 10:19:41 amQuote from: zeljko on April 22, 2014, 10:11:28 am1.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 · 2014-04-22 09:20 Quote from: zeljko on April 22, 2014, 10:55:11 amso download eg. qt-4.7.4 and build it for 32 bit carbon.Then rebuild libQt4Pas against qt-4.7.4O don't understand how to "build it for 32 bit carbon". ---------------------------------------------------------------------- zeljko · 2014-04-22 10:40 When you unpack qt-4.7.4 there are "howto" files like README, INSTALL etc ... there you can find howto build it. ---------------------------------------------------------------------- DrMefistO · 2014-04-22 10:43 I know how to build, but how to build for 32-bit carbon? It's the same as just  - qmake  - make  - make install ? ---------------------------------------------------------------------- zeljko · 2014-04-22 11:09 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. ---------------------------------------------------------------------- DrMefistO · 2014-04-22 12:40 Whole problem was in qmake compiles qt4pas as x86_64. Solution is: add CONFIG+=x86 to Qt4Pas.pro file. Then compile: QMAKESPEC=macx-g++ qmakemake ---------------------------------------------------------------------- DrMefistO · 2014-04-22 15:36 Another problem: built-up Qt4Pas.framework can't be used to build application from Lazarus. It writes: Quoteld: file not found: QtGui.framework/Versions/4/QtGui for architecture i386But binary Libray Binary Intel (used Xcode 3.1, OsX 10.5, Qt 4.7) works perfect. I have used qt-4.7.4 to build Qt4Pas and file info tells me that it is i386 Mach-o dynamically shared library (actually, the same with already compiled binary from bindings site). So... I don't know what to do. I just want to strip using of QtNetwork, QtWebKit and others. I want just QtCore, QtGui! =( ---------------------------------------------------------------------- zeljko · 2014-04-22 17:00 pls. ping me via private msg tomorrow. I'll send you link to tar.gz for complete Qt-4.7.4 + libQt4Pas binaries , so you just need to extract it and then you can use it imediatelly. ---------------------------------------------------------------------- DrMefistO · 2014-04-22 18:03 Only if they without Network, Multimedia and other "Huge" libs, ok? Only Core and Gui. ---------------------------------------------------------------------- zeljko · 2014-04-23 05:43 You can remove others , but in that case lazarus qt-lcl will not work under Mac. ---------------------------------------------------------------------- DrMefistO · 2014-04-23 06:54 But under Windows it works! I'm using one DLL for IDE, and one - for my program. I mean even "HelloWorld" program imports QtNetwork and QtWebToolkit due-to Qt4Pas. But for Windows I can delete some imports from Qt4Pas.dll. ---------------------------------------------------------------------- zeljko · 2014-04-24 05:20 Quote from: DrMefistO on April 23, 2014, 08:54:28 amBut under Windows it works! I'm using one DLL for IDE, and one - for my program. I mean even "HelloWorld" program imports QtNetwork and QtWebToolkit due-to Qt4Pas. But for Windows I can delete some imports from Qt4Pas.dll. That's something else , yes if you remove dependency on QtNetwork from Qt4Pas and from qt45.pas then it can work. ---------------------------------------------------------------------- DrMefistO · 2014-04-24 08:58 Actually, as I wrote before, I can't use recompiled Qt4Pas for compiling my program for Mac. =( Maybe you can help me?