Error when using macdeployqt



  • I have developed a Qt app that is running beautifully on a development Mac, but I am running into errors when I try to use macdeployqt to prepare the bundle for deploying to non-development Macs.

    My project is configured to use the QtMultimediaKit from QtMobility and is also using some 3rd party libraries. You would think macdeploy qt is running into issues with the 3rd party libraries, but it is actually choking on QtMultimediaKit and a something from QtGui. This is a copy of the errors I get when I run the tool:

    @
    ./macdeployqt /Users/Gilgrum/MobileAudio-build-desktop/MobileAudio.app
    ERROR: no file at "/Developer/Qt/Mobility/Library/lib/QtMultimediaKit.framework/Versions/1/QtMultimediaKit"
    ERROR: file copy failed from "/Developer/Qt/Desktop/Qt/473/gcc/lib/QtGui.framework/Resources/qt_menu.nib/classes.nib"
    ERROR: to "/Users/Gilgrum/MobileAudio-build-desktop/MobileAudio.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib"
    ERROR: file copy failed from "/Developer/Qt/Desktop/Qt/473/gcc/lib/QtGui.framework/Resources/qt_menu.nib/info.nib"
    ERROR: to "/Users/Gilgrum/MobileAudio-build-desktop/MobileAudio.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib"
    ERROR: file copy failed from "/Developer/Qt/Desktop/Qt/473/gcc/lib/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
    ERROR: to "/Users/Gilgrum/MobileAudio-build-desktop/MobileAudio.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
    @

    A few points:

    • Qt is installed at /Developer/Qt
    • QtMobility is built at /Developer/Qt/Mobility
    • My application finds the QtMultimediaKit frameworks just fine while running on the development Mac.
    • macqtdeploy appears to be correctly copying my 3rd party libraries into the bundle.
    • The correct path for the QtMultimediaKit is actually .../Library/Frameworks/QtMultimediaKit.framework/Versions/1/QtMultimediaKit instead of .../Library/lib/QtMultimediaKit.framework/...
    • I have no clue what the other errors are referring to (they appear to be referencing files within files).
    • I tried following the instructions to build the bundle manually but that was very time consuming and I must have messed up somewhere because I ended up with a corrupted bundle that wouldn't run at all.

    Any tips on resolving this QtMultimediaKit error?



  • I have problems with macqtdeploy with the current Qt SDK version. :-(



  • Try running macdeployqt with the option "-verbose=3".



  • Actually if I try this for a desktop application with buttons and menus, none of the buttons and menus works! Actually, with previous Qt's versions I remember that macdeployqt used to work just fine!



  • Thanks for the -verbose=3 tip Alexis, that helped out a lot.

    I've almost got a solution for this. Turns out there are two separate issues:

    I) Apparently I've built and installed QtMultimediaKit wrong. Not sure what the exact problem is, but copying everything into the file path that the tool is expecting gets rid of that first error message. I'm not going to bother fixing the real issue because QtMultimediaKit will likely get merged into the main body of Qt(phonon is being deprecated in 4.8).

    II) The rest of the errors are caused by a "known bug":https://bugreports.qt.nokia.com/browse/QTSDK-732 in 4.7.3. Apparently the Beta of 4.8 fixes this.

    I've successfully migrated to 4.8 on the PC, but I'm having some difficulties in the Mac. The 3 things I have done so far:

    1. Install 4.8 using the updater (it is in the experimental section).
    2. Setup my project to build using 4.8 (really easy, just create a new 4.8 build in the projects section)
    3. Copied the file "mobility.prf" from 4.7.3/mingw/mkspecs/features to the equivalent directory in 4.8.0. This file was automatically generated when I built mobility. Just copying this file doesn't appear to hurt anything on the PC.

    As mentioned, these steps on the PC makes it build and run just fine. However on the Mac I am getting build errors to the effect of "Class A is implemented in both 473 and 4.8.0. One of the two will be used. Which one is undefined." These errors are appearing for most (if not all) of the Qt Classes I am using. I am not sure how to force Qt to use the correct version. I am also getting run errors saying QTimer can only be used in threads started with QThread. However, I am not directly using QTimer (I wouldn't be surprised if some of the Qt classes I am using are).

    Any insights on how to move my code into 4.8 on the Mac would be appreciated.



  • As long as the library paths are not changed with install_name_tool (usually by macdeployqt), it uses the paths hardcoded in the libs. It looks like your QtMultimediaKit is still built against 4.7.3, which could be the cause of the trouble. I'd try to build that against 4.8 too. Maybe macdeployqt only changes paths of the libs that ware built against a specific Qt version, but not the others. I did not check that, so it's only a guess.



  • You are correct Volker, the QtMultiMediaKit is hard coded to look for 4.7.3.

    I have tried a couple times to rebuild Mobility against 4.8.0 (once against 4.8.0 downloaded-by-the-updater and once against a freshly-built-from-source copy of 4.8.0), but I keep getting the error "'qt7movievideowidgetmm:94: error: 'gluOrtho2D' was not declared in this scope". This is odd because earlier in the output it looks like the Qt OpenGL package is included just fine.

    Steps I am doing to build QtMultiMediaKit:

    1. Setup my PATH variable to include the bin directory in 4.8.0 (and no other versions of Qt SKD just in case).
      2)Configure Mobility 1.1.3 with:
      configure -prefix path/to/where/i/want/Mobility -modules multimedia
      3)make
      BAM run into gluOrtho2D error after building for a while

    Any ideas on the cause?



  • Nope, I did not touch 4.8 yet :-)

    As 4.8 is "only" a beta, I'd suggest you open a bugreport in the "bug tracker":https://bugreports.qt.nokia.com



  • Wow, speedy reply!

    I will be sure to open a bugreport.

    Where can I get a copy of an older version of the Qt SDK? I read the macdeployqt bug isn't present in earlier versions of Qt and I need to get a deploy-able package together for a presentation this week.



  • I don't use the SDK, but compile the libs manually (old habit from times long before there were SDKs :-)), so maybe someone else can help you with this. I'm pretty sure they are available somewhere, but I can't find them instantly :-/



  • I just noticed that my version of Mobility was out of date (latest version is 1.2). Updating to the latest version fixed the build problem.

    I was able to build and run my program successfully in 4.8.0. I was also able to run macdeployqt without any errors!

    However, I won't mark it as solved yet because while it is copying all the frameworks, it is not updating the references correctly for all of them. otool -L reports that QtMultimediaKit is correctly referencing the internal copy, but the rest of the Qt Frameworks are not.

    I'm going to look into fixing it manually.



  • Still no luck getting the app bundle to run on a non development Mac.

    I used install_name_tool to update the framework path for my bundle. Now otool reports all the Qt Frameworks have a path such as:
    @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore
    (4 other Qt paths listed in the tool but not shown here)

    I verified that all the paths are correct, and that all the non-Qt dylibs are either in the bundle or on the test computer (I did not check the dylib versions).

    The bundle runs fine on my development computer, but has an "unexpected error" on another Mac.

    Any suggestions?



  • I did more reading on how to use install_name_tool. Looks like you have to adjust the dependency paths for each of the libraries individually. In all I think I had to manually adjust about 20 or so paths.

    I noticed that some of the paths had 2 or even 3 slashes separating just 1 directory level. Perhaps this is what is tripping up macdeployqt.

    I am still getting an error, but I think it is because I am testing on a Mac version 10.5 and compiled my 3rd party libraries (incorrectly) on 10.6. I will test on a new Mac version and also look into recompiling my 3rd party libraries.



  • You can try to run the application from the command line terminal like this:

    @
    /full/path/to/your/application/MyProgram.app/Contents/MacOS/MyProgram
    @

    You get the output of stdout and stderr then. Chances are good that you know what's complaining.

    That output is saved in the system logs in case you start the application from the Finder. Just start /Applications/Utilities/Console.app to see those.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.