2

Trying to build an example program from Qt 5.1, I get this runtime error:

Starting /Users/pietro/myProgs/ParamGUI/build-6_treeview-Desktop_Qt_5_1_0_clang_64bit-Debug/mv_tree.app/Contents/MacOS/mv_tree...
dyld: Library not loaded: /Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /Users/pietro/myProgs/ParamGUI/build-6_treeview-Desktop_Qt_5_1_0_clang_64bit-Debug/mv_tree.app/Contents/MacOS/mv_tree
  Reason: image not found
The program has unexpectedly finished.
/Users/pietro/myProgs/ParamGUI/build-6_treeview-Desktop_Qt_5_1_0_clang_64bit-Debug/mv_tree.app/Contents/MacOS/mv_tree exited with code 0

Starting the program with the debugger, with a break point at the first instruction in main(), I get this error message (relative to a binary code location):

The inferior stopped because it received a signal from the Operating System.  
Signal name: SIGTRAP
Signal meaning: Trace/breakpoint trap

I have no idea how to fix it.
The example was a simple one creating a tree view, from Qt documentation. In the qmake file I specify: QT += widgets

The error Reason: image not found does not refer to a bitmap image, does it?

Am I wrong, or many people are having issues with Qt5?

Platform: Qt 5.1, Mac OS-X 10.7, QtCreator 2.7.2

--- New tests ---
In the same environment:
- A "Plain C++ Project (CMake Build)" works correctly.
- A "Qt Console Application" has the same issues as the application mentioned in this question.

--- Project source code ---

Pro file:

QT += core
QT -= gui
TARGET  = Qt5Test2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

main.cpp file:

#include <QCoreApplication>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    return a.exec();
}
Pietro
  • 12,086
  • 26
  • 100
  • 193
  • `Reason: image not found` is definitely not referering to a bitmap image. Have you tried google it? Those might be helpful: [here](http://stackoverflow.com/questions/13554520/dyld-not-loaded-reason-image-not-found-libopencv-core-2-4-dylib) and [here](http://stackoverflow.com/questions/720162/framework-linking-error-image-not-found) – Boris Dalstein Aug 26 '13 at 03:13
  • Try making a very basic application; in Qt Creator create a new GUI application, compile it and run it. Does that work? Note: I am using Qt 5.1 without any problem on OSX 10.8.4. – Kurt Pattyn Aug 26 '13 at 09:08
  • @KurtPattyn: that is just what I did, I took a test project from Qt's examples directory. – Pietro Aug 26 '13 at 10:48
  • 1
    @Pietro Don't take an example project, just create a new one in Qt Creator; in this way, we can pinpoint if the problem is related to the example app or if it is structural. – Kurt Pattyn Aug 26 '13 at 11:37

1 Answers1

1

The problem is that your Qt files are not at the location that the linker stated in the executable file.

Check the result of the following command on your executable:

otool -L /Users/pietro/myProgs/ParamGUI/build-6_treeview-Desktop_Qt_5_1_0_clang_64bit-Debug/mv_tree.app/Contents/MacOS/mv_tree...

It will show something like the following:

/Users/pietro/myProgs/ParamGUI/build-6_treeview-Desktop_Qt_5_1_0_clang_64bit-Debug/mv_tree.app/Contents/MacOS/mv_tree...:
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 153.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    <CUT OUT>/QtCore.framework/QtCore (compatibility version 5.1.0, current version 5.1.1)
   ...

And so on for all its dependencies.

In your case it requires QtWidgets to be here:

/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets

Does it exist at that location? If not then put it there or you change your executable file to point at the correct position using install_name_tool.

In the latter solution you will have to do:

install_name_tool -change /Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets <THE PATH TO YOUR QtWidgets> <THE PATH TO YOUR EXECUTABLE>

Do a otool -L on the executable afterwards to confirm it. Then run the applicaiton anew.

Morten Kristensen
  • 7,412
  • 4
  • 32
  • 52