Important: Please read the Qt Code of Conduct -

Cannot Find -l<LibName>, with older compiler

  • Hey Guys,
    I've been struggling with compiling a library on a newer compiler with QT-Creator.

    The program runs and compiles fine on my QT-5.5.1 GCC 32 bit :
    qmake DIRECTORY_TO_PROJECT/ -r -spec linux-g++-32 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug

    But when I try and compile it using QT-5.6.2 :
    qmake DIRECTORY_TO_PROJECT/ -r -spec devices/linux-imx6-g++ CONFIG+=debug

    It throws "cannot find -lqwt"

    I've spent countless hours searching every corner of the forums without being able to find a clear answer to my problem.

    I have made sure to add the following to my .pro:
    LIBS += -lqwt
    CONFIG += qwt

    And like I had said before, with these included, it runs no problem using the different compiler. However when I add
    LIBS += -l /usr/local/qwt-6.1.3/lib/
    It throws one additional error of:
    "cannot find /usr/local/qwt-6.1.3/lib/"
    And it is most certainly there
    I was thinking that maybe it's because I'm mistakenly trying to use a combination of 64/32 bit libraries, but I don't know that for sure.

    Any insight of what else I should check would be greatly appreciated!

  • Lifetime Qt Champion

    Hi @RyanR,

    LIBS += -l /usr/local/qwt-6.1.3/lib/
    "cannot find /usr/local/qwt-6.1.3/lib/"

    What happens if you change this to (the correct format):

    LIBS += -L/usr/local/qwt-6.1.3/lib -lqwt

    Also, make sure is in the given path (at least as a symlink).

    I was thinking that maybe it's because I'm mistakenly trying to use a combination of 64/32 bit libraries, but I don't know that for sure.

    You can check this with the file command:

    file /usr/local/qwt-6.1.3/lib/ (if that is a symlink, resolve it until you hit the library)


  • @aha_1980 said in Cannot Find -l<LibName>, with older compiler:

    LIBS += -L/usr/local/qwt-6.1.3/lib -lqwt

    I've given this a shot and it spits out:
    skipping incompatible /usr/local/qwt-6.1.3/lib// when searching for -lqwt
    cannot find -lqwt

    This is what led me top believe that maybe there was a mix up with 32 and 64 bit library/compilers, so I've checked the files, and you were correct that it is a symlink to, so I ran "file" on it that, and it returned with:
    ELF 32-bit LSB shared object, ...

    So although this hasn't really solved my issue, it's a step in the right direction.

    Could it be something that I may have missed with the qmake? I just don't fully understand how one compiler can have no issues locating and reading the .so files, where is seems to fail with another

    Thanks for the feedback!

  • I should also add that it is failing I am using the ARM-GCC compiler, I do not currently have the Qt mkspec set, and this is with QT-version 5.6.2

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have all libraries cross-compiled for your target ?

    From the looks of it, you might be trying to link an x86 version of the library.

  • No I don't believe I've done that!

    I was reading that I can use buildroot or something similar to it, and that should do it for me?
    Do you have any other recommendations for what can be used to crosscompile for ARM with Linux?

    I'll give that a try either way! Thanks

  • Lifetime Qt Champion

    You also have the yocto project that can help you.

  • I appreciate the help, but I'm still struggling to get it to compile properly.

    I've been reading up on cross-compiling, and it seems that is definitely my issue, but the process of how to do it remains unclear to me.

    Would you spell out the necessary steps of what is required in order to cross-compile a library, as I am concerned I might have missed an important step or 2 along the way that could be giving me grief.


  • Lifetime Qt Champion

    What development process are you going to follow ? Building a Yocto image ? Cross-compile Qt for your target using its root filesystem to get all needed dependencies ?

  • To be honest, I'm not even sure what different options I may have which I could follow.

    Ideally I would like to keep it all on it's root filesystem, as that seems to be the most straight forward option that I've come across so far.

    Just to be sure I'm fully understanding what I'm in the process of resolving, essentially my problem is that I have this 32 bit library (QWT) that needs to be cross-compiled to run on my ARM Target? and the reason that it was compiling and running fine on the Host side is due to the fact that it's Native-Compiling and therefore didn't have to convert from GCC-ARM? Is that correct?

    I appreciate you bearing with me while I try and familiarize myself with these concepts

  • Lifetime Qt Champion

    IIRC, when building Qwt you have to give it the path to the Qt version you want to use to build it. In that case, point that option to the qmake of your already cross-compiled Qt and you should be good to go.

  • Yup! That Worked!

    I just had to delete the QWT folders in my /usr/local/ and /home/ Directories, download a fresh copy of qwt-6.1.3, and rebuild it using the qmake from the cross-compiler (in /usr/local/Qt-X.X.X-/bin/qmake) I was trying to use, and that did the trick!

    Thanks so much for the help!

Log in to reply