Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. CMake /usr/bin/ld: cannot find -lQtScript
Forum Updated to NodeBB v4.3 + New Features

CMake /usr/bin/ld: cannot find -lQtScript

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
7 Posts 2 Posters 2.7k 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.
  • B Offline
    B Offline
    Briddl
    wrote on last edited by
    #1

    Hi,

    I have a existing Qt 4.8.2 project where I had to QtScript support. The project is build with cmake.
    I added the QtScript lib bby ```

    //

    find_package(Qt4 REQUIRED QtScript QtCore QtGui QtXml)
    

    This works fine for compiling but when the linker starts I get every time:

    /usr/bin/ld: cannot find -lQtScript 
    collect2: error: ld returned 1 exit status
    make[2]: *** [...] Error 1
    make[1]: *** [...] Error 2
    make: *** [all] Error 2
    

    Since compiling works find_package() should have worked. What I don't understand is why das linking not work when find_package() must have found QtScript already. Has someone any ideas?

    Regards

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

      Hi,

      Pretty strange indeed. Did you check that you have the QtScript dev package installed ?

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

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Pretty strange indeed. Did you check that you have the QtScript dev package installed ?

        B Offline
        B Offline
        Briddl
        wrote on last edited by
        #3

        @SGaist

        dpkg -l | grep libqt4* 
        

        returns:

        ii    libqt4-script:amd64  4:4.8.2+dfsg-11  amd64     Qt   4 script module 
        rc   libqt4-script:i386    4:4.8.2+dfsg-11  i386      Qt   4 script module
        

        it seams to me it is available. However I didn't see a *script-dev version.

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

          Aren't you then missing the libqt4-dev package from your system ?

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

          B 1 Reply Last reply
          0
          • SGaistS SGaist

            Aren't you then missing the libqt4-dev package from your system ?

            B Offline
            B Offline
            Briddl
            wrote on last edited by
            #5

            @SGaist libqt4-dev is listed I just forgot to mention it.

            I got one step closer to the solution. It seams that the cmake script used the non commercial qt 4.8.2 version instate of the also installed commercial 4.8.2 version.

            I added just to test it

            link_directories([PATH_TO_COMMERCIAL_LIBS])
            

            With this added the progamm is compiled and linked successfully. The problems now is that I get warnings that no safe linker search path for the target could be created because some how now the script finds both the ones in the commercial directory and the one in /sr/lib/x86_64-linux-gnu.

            I think i have to find the right envirmental variable to make it right. Thanks for your help.

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

              IIRC, you can use CMAKE_PREFIX_PATH when calling qmake to make it found your other Qt version first.

              By the way, are you locked to 4.8.2 ? If not, you should at least update to 4.8.7 which is the latest and last of the Qt 4 series or better go with Qt 5.

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

              B 1 Reply Last reply
              0
              • SGaistS SGaist

                IIRC, you can use CMAKE_PREFIX_PATH when calling qmake to make it found your other Qt version first.

                By the way, are you locked to 4.8.2 ? If not, you should at least update to 4.8.7 which is the latest and last of the Qt 4 series or better go with Qt 5.

                B Offline
                B Offline
                Briddl
                wrote on last edited by
                #7

                @SGaist thx I will try that. I have to check if I can use Qt5 I think we have a non version bound license but at the moment its kind of a "never touch a running system" situation"

                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