Please nominate your Qt Champions for 2021!

Linux Qt Creator compiling third party library problem

  • Hi there,

    I'm a Linux beginner. When compiling a project with a third party static library (.a file) with Qt Creator 4.12.4 (Qt 5.15) following errors show up:

    //libswe.a(sweph.o): undefined reference to symbol 'dladdr@@GLIBC_2.2.5'
    /lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status

    Does anyone know what is missing and can give me some help on this?

    Thanks in advance,

  • Lifetime Qt Champion

    LIBS += -ldl

  • Lifetime Qt Champion


    Where does that static library come from ?
    How what is built ?
    On which distribution ?

  • Hello SGast,

    meanwhile I tried another distro - same problem. The tested distros are:

    Linux Mint 20 Cinnamon (Ubuntu based)
    Manjaro 20.03 KDE (Arch Linux based)

    On Intel i7 processor with integrated uhd 630 graphics.

    I doubt that the problem is related to the third party library. The problem is my poor understanding how to link needed Linux libraries to my Qt project.

    I took a look into a makefile that came with the third party library for testing proposes. And there is says:

    swemini: swemini.o libswe.a
    	$(CC) $(OP) -o swemini swemini.o -L. -lswe -lm -ldl

    Because I didn't include the last two Linux libraries -lm -ldl that might be the cause of the errors. But I don't know how to do that.

    Do you know these Linux libraries and how to include them into an Qt Creator project?

  • Lifetime Qt Champion

    LIBS += -ldl

  • Yes, problem solved.
    I'm a bit ashamed that it was so simple and I tried so hard and didn't get it.

    Thank you very much SGaist!

Log in to reply