Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. dylib issues with multiple Qt versions installed
Forum Updated to NodeBB v4.3 + New Features

dylib issues with multiple Qt versions installed

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 633 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • btseB Offline
    btseB Offline
    btse
    wrote on last edited by
    #1

    So I have multiple versions of Qt installed (the 2 of interest are Qt4.8 and Qt5.11).

    Both versions were installed using homebrew, so they're installed in /usr/local/Cellar/qt/4.8.7.2 and 5.11.2 respectively.

    I can build my project using either version perfectly fine (via cmd line or Qt Creator). I can run either version using Qt Creator, but when I try to run the Qt4 build via cmd line, I get the following error:

    dyld: Library not loaded: /usr/local/opt/qt/lib/QtSvg.framework/Versions/4/QtSvg
      Referenced from: /Users/brad/labcode/qt4/libs/release/momadataview.app/Contents/MacOS/./momadataview
      Reason: image not found
    [1]    54979 abort      ./momadataview
    

    As you can see, it attempts to load the library located at /usr/local/opt/qt/lib. However, my /usr/local/opt is a symlink to the qt5 version.

    Here is the otool -L output:

    momadataview:
    	/usr/local/opt/qt/lib/QtSvg.framework/Versions/4/QtSvg (compatibility version 4.8.0, current version 4.8.7)
    	/usr/local/opt/qt/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)
    	/usr/local/opt/qt/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)
    	/usr/local/opt/qt/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.8.0, current version 4.8.7)
    	/usr/local/opt/qt/lib/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.7)
    	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 356.0.0)
    

    If I simply change the /usr/local/opt/qt symlink to point to the qt4 version, then it runs perfectly fine as expected.

    So, I guess I have a few questions:

    • When is this dylib linking resolved and where is it getting this info from? I tried looking in some of the mkspecs, but I couldn't find anything that stuck out.
    • Is there an easy fix for this? Ideally, when I build with qt4, the resolved dylibs should be the ones in the qt4 dir.
    • Why does it run fine via Qt Creator? Is there extra settings in Qt Creator that's somehow resolving the incorrect dylib linking? Note that I don't use shadow building, so building via Qt Creator or cmd line generates files at the same location.

    Thanks!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Qt Creator modifies the environment so it uses the Qt version configured in the Kit you use for the project.

      Use otool to check the Id of your dependencies. You likely have one or the other that doesn't use a full path. You can use the DYLD_LIBRARY_PATH environment variable to set additional folders to search for dependencies.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      btseB 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Qt Creator modifies the environment so it uses the Qt version configured in the Kit you use for the project.

        Use otool to check the Id of your dependencies. You likely have one or the other that doesn't use a full path. You can use the DYLD_LIBRARY_PATH environment variable to set additional folders to search for dependencies.

        btseB Offline
        btseB Offline
        btse
        wrote on last edited by
        #3

        @SGaist Thanks, I figured it was those settings configured in the Qt Creator's kit.

        As far as the DYLD_LIBRARY_PATH goes, I guess I have to come up with my own method for setting the proper path depending on which Qt version I'm currently using?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can use macdeployqt before starting it from the command line.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved