Qt World Summit: Register Today!

[SOLVED] Suppress .so.* version on linux

  • I've just decided to check my projects on ubuntu and faced a problem where I get my libs with *.1.0.0 postfix, like liblogger.so.1.0.0. Also i got a bunch of links, wich I suppressed (sometimes) with
    @QMAKE_LN_LIB = :

    But I get an error in Issues page like "[path/to/lib] Error 1 (Ignored)" which is disturbing.
    Those libs are parts of my project, I have full control over their versions, so I do not want them to have any numbers in names, and I believe that would make me happy if they won't. I tried this:

    And it does not seem to work for me (numbers still present). And ofcourse one way that seems to work and be rediculous at same time:
    rm liblogger.so.1.0 &
    rm liblogger.so.1 &
    rm liblogger.so &
    liblogger.so &
    cp -u

    With this I must have a separate set of commands for windows, which I already know how, but...
    The rediculous thing is that first qmake 'does stuff' then me 'removes stuff'. Wouldn't it be easier if I could tell qmake 'not to do that stuff'. I think there must be a simple crossplatform way, but google says no.
    Thanks for any help.

  • Hello,
    I think the only alternative is the one you described.
    The libblogger.so.1.0, libblogger.so.1 and libblogger.so are symbolic links to libblogger.so.1.0.0 so if an application is looking for the name without full version number it can still find it. As it won't take extra space on disk you could keep the symbolic links and just do:
    cp -u

    I'm afraid if this is not acceptable for your use case you will have to go for the solution you described.
    Best regards.

  • Well, now after all my things were compiled together, I found that if I link against my libs like so:
    @LIBS: -llogger@

    it really tries to link with liblogger.so on buildtime, BUT on runtime it searches for liblogger.so.1, which is again wierd to me. Why cant it be that simple like on windows, where all my dlls are happy without links and numbers?..

    For now here's what my solution is:

  • http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html has a good explanation of how libraries are used on Linux.

    Basically it is all about allowing for several versions of the same library to be installed on the system without everything breaking.

  • If you don't need symbolic links for your libraries add
    CONFIG += plugin
    to your library's pro-file.

    Documentation say's:
    "This is necessary on some platforms to avoid generating symbolic links with version numbers in the file name, which is appropriate for most dynamic libraries but not for plugins"

Log in to reply