Unable to deploy Qt app under Linux



  • Hi,

    How can I force Qt to create a stripped binary?

    I always get "unstripped-binary-or-object" & "binary-or-shlib-defines-rpath" when I try to create debian package *.deb although I configure my projects using:

    CONFIG += c++11
    CONFIG += release
    
    CONFIG += console
    CONFIG -= app_bundle
    
    TEMPLATE = app
    


  • I found the following solution but I want anther approach through qmake
    http://stackoverflow.com/a/35560010


  • Qt Champions 2016

    @mbnoimi
    You can add a post-build step, but I don't remember the exact commands. Search the qmake manual for it, there were some variables to be set. Alternatively you can add an additional target (through TEMPLATE = subdirs) that will depend on your actual code and will execute the command, but that's more cumbersome.


  • Moderators

    QMAKE_POST_LINK = strip <your binary> should do it.

    I may be wrong on the syntax, I long ago switched to cmake for building.



  • @ambershark Thanks it works.

    QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
    

    But unfortunately it didn't fix binary-or-shlib-defines-rpath



  • binary-or-shlib-defines-rpath affects directly on the distro because it calls the stored paths


  • Qt Champions 2016

    @mbnoimi
    Try setting the rpath qmake variable to point to nowhere (i.e. make it empty):

    QMAKE_RPATHDIR = 
    QMAKE_RPATHLINKDIR = # Possibly not needed
    


  • @kshegunov said in Unstripped binary or object!:

    QMAKE_RPATHDIR =
    QMAKE_RPATHLINKDIR = # Possibly not needed

    Still get same error message:

    E: sync-accounts-manager: binary-or-shlib-defines-rpath opt/sync-accounts-manager/SyncAccountsManager /home/mbnoimi/.Qt/5.7/gcc_64/lib
    


  • I pushed my init project to github so because of this error I'm unable to connect to database:

    mbnoimivm@ubuntu:~$ /opt/sync-accounts-manager/SyncAccountsManager.sh
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~$ ldd /opt/sync-accounts-manager/SyncAccountsManager
    /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
    /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
    /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
            linux-vdso.so.1 =>  (0x00007ffd5594c000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f86d6806000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f86d6160000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f86d5e5b000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f86d5c45000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86d5880000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f86d5661000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f86d5448000)
            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f86d5041000)
            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f86d4cc7000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f86d4ac3000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f86d47bb000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86d45b2000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86d42ac000)
            /lib64/ld-linux-x86-64.so.2 (0x000055adc312e000)
            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f86d2a3e000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f86d2800000)
    mbnoimivm@ubuntu:~$
    

  • Qt Champions 2016

    @mbnoimi
    Try running chrpath -d on your binary (and/or Qt) to remove the rpath.

    Found the suggestion on the deb mailing list.


  • Moderators

    @mbnoimi Do you have mysql as a plugin in Qt? If so you need to make sure you have the plugins set up on your machine properly.

    On your development machine they will work properly but when you distribute they may not.

    Usually I distribute then in the lib directory I use and then plugins, so something like this:

    myapp/
       bin/
          myapp (actual binary)
          qt.conf
       libs/
          libmylib.so
          libQt5Core.so.5
          plugins/
             platforms/
                libqxcb.so (linux)
             sqldrivers/
                libsqlmysql.so
       myapp (shell script to launch with a custom LD path)
    

    Inside the qt.conf file you need:

    [Paths]
    Plugins = ../libs/plugins
    

    Then I use a shell script to start my app:

    #!/bin/sh
    
    dir="$(dirname `readlink -f $0`)"
    LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
    QT_QPA_FONTDIR="$dir/fonts"
    export LD_LIBRARY_PATH QT_QPA_FONTDIR
    exec $dir/bin/myapp "$\@"
    

    Finally make sure you use chrpath to strip RPATH info out of your binaries (apps and libs) as suggested by @kshegunov . If they have hard coded paths as built on your system and those paths do not exist on your target system they will not work. If the path is gone it will use the LD_LIBRARY_PATH.

    Make sure you have the libraries you wanted to distribute in libs and all others (i.e. Qt) in LD path areas on your system and you should be good to go.

    That was a long answer to saying basically your app can't find the mysql Qt plugin. ;) Hopefully it helps though, I've gone through a lot of headache getting binary apps distributed for Linux in the past.



  • @ambershark I did as you advice but I'm still get same errors!

    Files tree:

    .
    ├── bin
    │   ├── qt.conf
    │   └── SyncAccountsManager
    ├── libs
    │   ├── libicudata.so.56 -> libicudata.so.56.1
    │   ├── libicudata.so.56.1
    │   ├── libicui18n.so.56 -> libicui18n.so.56.1
    │   ├── libicui18n.so.56.1
    │   ├── libicuuc.so.56 -> libicuuc.so.56.1
    │   ├── libicuuc.so.56.1
    │   ├── libqgsttools_p.prl
    │   ├── libqgsttools_p.so -> libqgsttools_p.so.1.0.0
    │   ├── libqgsttools_p.so.1 -> libqgsttools_p.so.1.0.0
    │   ├── libqgsttools_p.so.1.0 -> libqgsttools_p.so.1.0.0
    │   ├── libqgsttools_p.so.1.0.0
    │   ├── libQt5Core.so -> libQt5Core.so.5.7.0
    │   ├── libQt5Core.so.5 -> libQt5Core.so.5.7.0
    │   ├── libQt5Core.so.5.7 -> libQt5Core.so.5.7.0
    │   ├── libQt5Core.so.5.7.0
    │   ├── libQt5Gui.la
    │   ├── libQt5Gui.prl
    │   ├── libQt5Gui.so -> libQt5Gui.so.5.7.0
    │   ├── libQt5Gui.so.5 -> libQt5Gui.so.5.7.0
    │   ├── libQt5Gui.so.5.7 -> libQt5Gui.so.5.7.0
    │   ├── libQt5Gui.so.5.7.0
    │   ├── libQt5Sql.la
    │   ├── libQt5Sql.prl
    │   ├── libQt5Sql.so -> libQt5Sql.so.5.7.0
    │   ├── libQt5Sql.so.5 -> libQt5Sql.so.5.7.0
    │   ├── libQt5Sql.so.5.7 -> libQt5Sql.so.5.7.0
    │   ├── libQt5Sql.so.5.7.0
    │   └── plugins
    │       ├── platforms
    │       │   ├── libqeglfs.so
    │       │   ├── libqlinuxfb.so
    │       │   ├── libqminimalegl.so
    │       │   ├── libqminimal.so
    │       │   ├── libqoffscreen.so
    │       │   └── libqxcb.so
    │       └── sqldrivers
    │           ├── libqsqlite.so
    │           ├── libqsqlmysql.so
    │           └── libqsqlpsql.so
    └── SyncAccountsManager.sh
    

    SyncAccountsManager.pro

    QT += core sql
    QT -= gui
    
    TARGET = SyncAccountsManager
    
    CONFIG += c++11
    CONFIG += release
    
    CONFIG += console
    CONFIG -= app_bundle
    
    TEMPLATE = app
    
    SOURCES += src/main.cpp \
        src/connectdb.cpp
    
    HEADERS += \
        src/connectdb.h
    
    DESTDIR = bin
    
    win32 {
        MOC_DIR = tmp-win32
        UI_DIR = tmp-win32
        UI_HEADERS_DIR = tmp-win32
        UI_SOURCES_DIR = tmp-win32
        OBJECTS_DIR = tmp-win32
        RCC_DIR = tmp-win32
    }
    
    linux {
        MOC_DIR = tmp-lin64
        UI_DIR = tmp-lin64
        UI_HEADERS_DIR = tmp-lin64
        UI_SOURCES_DIR = tmp-lin64
        OBJECTS_DIR = tmp-lin64
        RCC_DIR = tmp-lin64
    #    QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
    #    QMAKE_RPATHDIR =
    #    QMAKE_RPATHLINKDIR = # Possibly not needed
        QMAKE_POST_LINK = $${PWD}/src/fix_executable.sh $${TARGET} $$(QTDIR) $${PWD}/$${DESTDIR} $${PWD}
    
    }
    
    

    fix_executable.sh

    #!/bin/sh
    appname="$1"
    qt="$2"
    binpath="$3"
    project_path="$4"
    distro=$project_path/deb/files
    
    #### Clean the app
    strip $binpath/$appname
    chrpath -d $binpath/$appname
    
    #### Create files tree ####
    cd $distro
    rm -fr $distro/*
    mkdir bin
    mkdir -p libs/plugins
    cp -fr $binpath $distro
    chmod +x  $distro/bin/$appname.sh
    mv -f $distro/bin/$appname.sh $distro
    cp -fr $qt/lib/* $distro/libs
    cp -fr $qt/plugins $distro/libs
    

    ldd result on the deployed machine:

    mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
            linux-vdso.so.1 =>  (0x00007ffe1044f000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
            /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
    mbnoimivm@ubuntu:~/files$
    

  • Moderators

    ldd result on the deployed machine:

    mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
            linux-vdso.so.1 =>  (0x00007ffe1044f000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
            /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
    mbnoimivm@ubuntu:~/files$
    

    Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

    So run ldd like this:

    $ cd yourapp/bin
    $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
    

    That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works. If not the ldd output will be useful at least.

    One of the things that is most concerning is this line:

    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)

    Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)



  • @ambershark said in Unable to deploy Qt app under Linux:

    Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

    The content of SyncAccountsManager.sh

    #!/bin/sh
    
    dir="$(dirname `readlink -f $0`)"
    LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
    QT_QPA_FONTDIR="$dir/fonts"
    export LD_LIBRARY_PATH QT_QPA_FONTDIR
    exec $dir/bin/SyncAccountsManagermyapp "$\@"
    

    So run ldd like this:
    $ cd yourapp/bin
    $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager

    That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works.

    The result of ldd:

    mbnoimivm@ubuntu:~$ cd files/bin
    mbnoimivm@ubuntu:~/files/bin$ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
            linux-vdso.so.1 =>  (0x00007ffe11f17000)
            libQt5Sql.so.5 => ../libs/libQt5Sql.so.5 (0x00007f73059e7000)
            libQt5Core.so.5 => ../libs/libQt5Core.so.5 (0x00007f73052cc000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7304fbf000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7304da9000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73049e4000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f73047c5000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73044bf000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f73042a6000)
            libicui18n.so.56 => ../libs/libicui18n.so.56 (0x00007f7303e0b000)
            libicuuc.so.56 => ../libs/libicuuc.so.56 (0x00007f7303a53000)
            libicudata.so.56 => ../libs/libicudata.so.56 (0x00007f7302070000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7301e6b000)
            libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f7301c69000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7301a61000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7301758000)
            /lib64/ld-linux-x86-64.so.2 (0x000055c051da4000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f730151a000)
    mbnoimivm@ubuntu:~/files/bin$
    

    Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)

    No, it's in my files tree see above please.



  • I tried the following but I got same result:

    mbnoimivm@ubuntu:~/files/bin$ LD_LIBRARY_PATH="../libs" ./SyncAccountsManager
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~/files/bin$
    

  • Moderators

    Sure is in that list, I must have missed it.. Ok so let's try moving those sqldrivers... Sometimes I have issues with where Qt looks for plugins.

    Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.


  • Moderators

    Ok then after that lets see if this is a mysql problem and not a Qt one. Run ldd libqsqlmysql.so and post that output. It may be looking for a mysql library that was upgraded and no longer on your system.

    Oh and it shouldn't affect the driver only class availability but make sure you have QT += sql in your pro file. Just in case it does affect it... But I doubt it will.



  • @ambershark said in Unable to deploy Qt app under Linux:

    Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.

    Same error :(

    mbnoimivm@ubuntu:~$ files/SyncAccountsManager.sh
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~$ tree -R files/
    files/
    ├── bin
    │   ├── qt.conf
    │   └── SyncAccountsManager
    ├── libs
    │   ├── libicudata.so.56
    │   ├── libicudata.so.56.1
    │   ├── libicui18n.so.56
    │   ├── libicui18n.so.56.1
    │   ├── libicuuc.so.56
    │   ├── libicuuc.so.56.1
    │   ├── libqgsttools_p.prl
    │   ├── libqgsttools_p.so
    │   ├── libqgsttools_p.so.1
    │   ├── libqgsttools_p.so.1.0
    │   ├── libqgsttools_p.so.1.0.0
    │   ├── libQt5Core.so
    │   ├── libQt5Core.so.5
    │   ├── libQt5Core.so.5.7
    │   ├── libQt5Core.so.5.7.0
    │   ├── libQt5Sql.la
    │   ├── libQt5Sql.prl
    │   ├── libQt5Sql.so
    │   ├── libQt5Sql.so.5
    │   ├── libQt5Sql.so.5.7
    │   ├── libQt5Sql.so.5.7.0
    │   └── plugins
    │       ├── libqsqlite.so
    │       ├── libqsqlmysql.so
    │       ├── libqsqlpsql.so
    │       ├── libQt5Sql.la
    │       ├── libQt5Sql.prl
    │       ├── libQt5Sql.so
    │       ├── libQt5Sql.so.5
    │       ├── libQt5Sql.so.5.7
    │       ├── libQt5Sql.so.5.7.0
    │       ├── platforms
    │       │   ├── libqeglfs.so
    │       │   ├── libqlinuxfb.so
    │       │   ├── libqminimalegl.so
    │       │   ├── libqminimal.so
    │       │   ├── libqoffscreen.so
    │       │   └── libqxcb.so
    │       └── sqldrivers
    │           ├── libqsqlite.so
    │           ├── libqsqlmysql.so
    │           └── libqsqlpsql.so
    └── SyncAccountsManager.sh
    5 directories, 42 files
    mbnoimivm@ubuntu:~$
    


  • @ambershark said in Unable to deploy Qt app under Linux:

    Ok then after that lets see if this is a mysql problem and not a Qt one. Run ldd libqsqlmysql.so and post that output. It may be looking for a mysql library that was upgraded and no longer on your system.

    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
            linux-vdso.so.1 =>  (0x00007fff87591000)
            libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007faa39173000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007faa38f34000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007faa3888d000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007faa38589000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faa381c4000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faa37fbf000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faa37da1000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faa37a9b000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007faa37884000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007faa3766b000)
            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007faa37264000)
            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007faa36eea000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007faa36be2000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007faa369da000)
            /lib64/ld-linux-x86-64.so.2 (0x000055741e96f000)
            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007faa3516c000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007faa34f2e000)
    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$
    


  • I tried to apply strip but unfortunately it didn't fix the problem

    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ strip libqsqlmysql.so
    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
            linux-vdso.so.1 =>  (0x00007ffd21f90000)
            libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007fa3fe87c000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007fa3fe63d000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fa3fdf96000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa3fdc92000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa3fd8cd000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa3fd6c8000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa3fd4aa000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa3fd1a4000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa3fcf8d000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fa3fcd74000)
            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fa3fc96d000)
            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fa3fc5f3000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fa3fc2eb000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa3fc0e3000)
            /lib64/ld-linux-x86-64.so.2 (0x0000562224202000)
            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fa3fa875000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fa3fa637000)
    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$
    


  • IMPORTANT:
    Although this distro works fine on the original PC but I get this error by ldd:

    mbnoimi@mbnoimi-laptop ~/HPC/SyncAccountsManager/deb/files/libs/plugins/sqldrivers $ ldd libqsqlmysql.so 
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
    	linux-vdso.so.1 =>  (0x00007ffe9f9fd000)
    	libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007f8bd5f9b000)
    	libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f8bd5f59000)
    	libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f8bd5a82000)
    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8bd5700000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8bd5337000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8bd511c000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8bd4f18000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8bd4cfb000)
    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8bd49f1000)
    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8bd47db000)
    	libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007f8bd4379000)
    	libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f8bd3fe4000)
    	libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007f8bd3d7e000)
    	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f8bd3a6d000)
    	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8bd3864000)
    	/lib64/ld-linux-x86-64.so.2 (0x0000563fd9f32000)
    	libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f8bd1dad000)
    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8bd1b3c000)
    mbnoimi@mbnoimi-laptop ~/HPC/SyncAccountsManager/deb/files/libs/plugins/sqldrivers $ 
    
    

  • Qt Champions 2016

    @mbnoimi
    How did any of this have anything to do with strip or .deb packages?

    Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
    You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

    Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

    From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

    #!/bin/sh
    
    # Don't spawn children shells unnecessarily by using `
    dir=$(dirname $(readlink -f "$0"))
    
    # The following might happen to be pretty important
    cd $dir'/bin'
    
    # Execute from the current shell's context and no need to export if you don't spawn a new shell process
    app=$dir'/bin/SyncAccountsManagermyapp' 
    
    LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
    


  • @kshegunov I did exactly as you suggested although I didn't notice any problem in the old appname.sh file. Any way your suggestion gave me exactly same error!
    May you please take a look into https://github.com/mbnoimi/sql-sync-manager/releases/tag/0.12


  • Moderators

    @kshegunov said in Unable to deploy Qt app under Linux:

    @mbnoimi
    How did any of this have anything to do with strip or .deb packages?

    Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
    You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

    Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

    From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

    #!/bin/sh
    
    # Don't spawn children shells unnecessarily by using `
    dir=$(dirname $(readlink -f "$0"))
    
    # The following might happen to be pretty important
    cd $dir'/bin'
    
    # Execute from the current shell's context and no need to export if you don't spawn a new shell process
    app=$dir'/bin/SyncAccountsManagermyapp' 
    
    LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
    

    His problem is definitely deeper than the start script. As we've had him do it direct on the command line with the same results.

    Some of the other comments on the start script you made I don't understand. For instance the only difference in $() and backtick in a bash script is looks. Under the covers they both do the same thing. I go back and forth on which I use, they act the exact same though and neither starts an extra shell compared to the first. The newer syntax is $() because they look better but backtick was not deprecated or anything.

    The other thing is you mention has to do with escaping. If dir = /a path with spaces/mydir then the script would fail. The original script suffers from the same non-escaping though. Just not sure what your comment meant. The "$@" is a bug though, the \ shouldn't be there.

    Anyway back on to the problem at hand. I'm betting you might have a bad mysql lib. I would remove Qt from the equation and test a binary linked against mysql directly. See if it works. If it does I may have another idea for you, if not then fix your MySQL and you should be all set. ;)



  • @ambershark said in Unable to deploy Qt app under Linux:

    Anyway back on to the problem at hand. I'm betting you might have a bad mysql lib. I would remove Qt from the equation and test a binary linked against mysql directly. See if it works. If it does I may have another idea for you, if not then fix your MySQL and you should be all set. ;)

    I built recent MySQL library against Qt (from Oracle PPA) for that I made my distro using *.deb becuase it asks the user for the following depends (Debreate project file SyncAccountsManager.dbp)

    Depends: libmysqlclient20 (>=5.7.11), libstdc++6 (>=4.8.4), libgcc1 (>=1:3.0), libc6 (>=2.14)
    

    I'm not sure if this affect on the distro. Another thing I'm using recent GCC because I use some code written in recent C++ version:

    mbnoimi@mbnoimi-laptop ~ $ gcc --version
    gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    mbnoimi@mbnoimi-laptop ~ $
    

    Using the above gcc I built Qt MySQL Plugin but on my machine everything fine and I'm able to connect to MySQL without any problem.



  • Guys, may I ask you for a tiny test:

    Could you please build this release then upload the binaries for me?


  • Moderators

    Yea that sounds like your problem then. You used a different mysql and didn't distribute your custom one to the target system. And you should NOT do this as that would violate the license of mysql.

    I'm betting Qt is looking for a mysql version that isn't there or isn't working properly. Hence the "no driver" error message.

    Welcome to the wonderful world of making linux binaries. It is painful. It takes a lot of time and effort to solve all these problems. It sounds like you should have a good jumping off point to figure out where you went wrong with mysql though.

    You can try making sure the mysql stuff on the target machine is the same as on your machine. Use ldd liberally in trying to find what binaries are failing to load. And finally you can try something like strace to see what operations are running when it fails. OH and don't strip your binaries before distribution and try running the application through gdb. The call stack may give you insight as to why the mysql on the target machine is not good enough.

    One last idea, make sure you linked against the same bit size as the target machine. I.e. if you linked 64-bit and the target is 32-bit it would not work and have driver issues.


  • Qt Champions 2016

    @ambershark said in Unable to deploy Qt app under Linux:

    Some of the other comments on the start script you made I don't understand. For instance the only difference in $() and backtick in a bash script is looks. Under the covers they both do the same thing. I go back and forth on which I use, they act the exact same though and neither starts an extra shell compared to the first. The newer syntax is $() because they look better but backtick was not deprecated or anything.

    The other thing is you mention has to do with escaping. If dir = /a path with spaces/mydir then the script would fail. The original script suffers from the same non-escaping though. Just not sure what your comment meant. The "$@" is a bug though, the \ shouldn't be there.

    You're most certainly correct. One should take my scripting "skills" with a grain of salt. What I still insist on, however, is that the application is executed from a folder that is different from the one that qt.conf resides in. This can (and possibly does) break the way the plugins are resolved (i.e. the .so locations). If you follow the documentation page on deployment you'd see that the example puts everything (app, conf file) in the root folder and the plugin directory is under that too. That's why I also referenced the warning in the docs.


  • Moderators

    @kshegunov Oh I see what you were saying. I got caught up on the scripting. ;)

    The qt.conf is in the directory containing the executable though. So I still don't understand. It is supposed to be in bin with the executable.

    I read that link just in case I was using qt.conf wrong all these years and I didn't see anything to say it would have a problem if launched from outside the containing directory. I may have missed it though.

    When you launch the application like /path/to/my/app and your working directory is /home/user the binary would still get the applicationDirPath() as /path/to/my and that is where it would look for qt.conf. So as far as I can tell you don't need to cd bin before launching the app. I mean it doesn't hurt to do it, but I don't think it hurts not to do it either. :)


  • Moderators

    Your fix_executable.sh script is bad. Here is the output from the build:

    g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/Qt/include -I/usr/local/Qt/include/QtSql -I/usr/local/Qt/include/QtCore -Itmp-lin64 -I/usr/local/Qt/mkspecs/linux-g++ -o tmp-lin64/main.o src/main.cpp
    g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/Qt/include -I/usr/local/Qt/include/QtSql -I/usr/local/Qt/include/QtCore -Itmp-lin64 -I/usr/local/Qt/mkspecs/linux-g++ -o tmp-lin64/connectdb.o src/connectdb.cpp
    src/main.cpp: In function ‘int main(int, char**)’:
    src/main.cpp:10:16: warning: unused variable ‘dataServer’ [-Wunused-variable]
         ConnectDB *dataServer = new ConnectDB("QMYSQL",
                    ^~~~~~~~~~
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Qt/lib -o bin/SyncAccountsManager tmp-lin64/main.o tmp-lin64/connectdb.o   -L/usr/local/Qt/lib -lQt5Sql -lQt5Core -lpthread
    /home/mike/tmp/sql-sync-manager-0.12/deb/fix_executable.sh SyncAccountsManager /usr/local/Qt /home/mike/tmp/sql-sync-manager-0.12/bin /home/mike/tmp/sql-sync-manager-0.12
    /home/mike/tmp/sql-sync-manager-0.12/deb/fix_executable.sh: line 13: cd: /home/mike/tmp/sql-sync-manager-0.12/deb/files: No such file or directory
    mkdir: cannot create directory ‘bin’: File exists
    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/SyncAccountsManager': No such file or directory
    chmod: cannot access '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/SyncAccountsManager': No such file or directory
    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/SyncAccountsManager.sh': No such file or directory
    chmod: cannot access '/home/mike/tmp/sql-sync-manager-0.12/deb/files/SyncAccountsManager.sh': No such file or directory
    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/qt.conf': No such file or directory
    cp: target '/home/mike/tmp/sql-sync-manager-0.12/deb/files/libs' is not a directory
    cp: cannot create directory '/home/mike/tmp/sql-sync-manager-0.12/deb/files/libs': No such file or directory
    make: *** [Makefile:204: bin/SyncAccountsManager] Error 1
    

    The fix is to make sure deb/files exists. It doesn't in your source package. Maybe add mkdir to your script or add it to the source dist.

    Anyway, it's built, I have the same issue with unavailable driver though. But I don't have mysql installed on this machine.

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    

    Where would you like me to send the binaries?


  • Qt Champions 2016

    @ambershark said in Unable to deploy Qt app under Linux:

    So as far as I can tell you don't need to cd bin before launching the app.

    You don't, that was a dead end long shot on my part.

    @mbnoimi , I get only "Unable to connect!" no missing drivers but I haven't copied your binaries for Qt and plugins I'm using my distro's (which happens to be debian) own set.


  • Moderators

    Then yours is working. If you don't get the driver issue your build worked correctly. It can't connect because you don't have the database it is looking for.


  • Qt Champions 2016

    @ambershark said in Unable to deploy Qt app under Linux:

    Then yours is working.

    I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
    My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

    Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
    

    are also concerning.

    On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??


  • Moderators

    @kshegunov said in Unable to deploy Qt app under Linux:

    @ambershark said in Unable to deploy Qt app under Linux:

    Then yours is working.

    I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
    My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

    Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
    

    are also concerning.

    On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??

    Yea I originally told him to put them in plugins/sqldrivers and when that didn't work told him to try just in plugins (the old style). Neither changed anything and I'm guessing he just left them in plugins. He should definitely move them back for a real release.

    Those messages he gets are my big concern too. I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I was expecting ldd to show the problems but for some reason it's not. The problems are still there but ldd isn't shedding light on it.


  • Qt Champions 2016

    @ambershark said in Unable to deploy Qt app under Linux:

    I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I

    First ldd should be run with the proper path (for the qsqlmysql plugin). From the commands he posted he ran it with the default linker locations so it will find the distro's Qt and you he'd get version mismatches. See the lines that follow the command:

    mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
    ...
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007faa38f34000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007faa3888d000)
    

  • Moderators

    @kshegunov Yea I warned him about that and told him to run it with LD_LIBRARY_PATH before the ldd. That was like 20 posts ago though. He had similar results that didn't tell me what I needed to know though.



  • Thank you very much @kshegunov & @ambershark

    I formatted my PC and the virtual machine I use for testing deployments. I don't use any PPA so I'm using the official packages of GCC and MySQL in Linux Mint 18 x64 xfce repositories.

    I get same exact errors I read all your posts twice to be sure everything is fine but I still unable to deploy my app. I pushed the source code to github and the deb file too.

    Please guide me how can I fix this issue.

    I'm very frustrated because I wasted hours for preparing the deployment even before writing my code. I googled a lot and read all Qt deployment guidance but nothing help me practically.



  • mbnoimivm@ubuntu:~$ /opt/SyncAccountsManager/SyncAccountsManager.sh
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Unable to connect!
    ^C
    mbnoimivm@ubuntu:~$
    


  • If you want to send any files, I can add you to my github project.

    @ambershark I added you to my project but @kshegunov I couldn't find you on Github



  • @mbnoimi said in Unable to deploy Qt app under Linux:

    I formatted my PC and the virtual machine I use for testing deployments

    I tried to run the app on Mint VM and it works fine! so the problem in my Ubuntu VM. I'm using Ubuntu 14.04 while I build the app under LM 18 (built from Ubuntu 16.04) so I've to investigate in Ubuntu libraries.

    As I told you before deb package calls the following dependencies

    Depends: libmysqlclient20 (>=5.7.11), libstdc++6 (>=4.8.4), libgcc1 (>=1:3.0), libc6 (>=2.14)
    

    Do you think I've to change them for previous Ubuntu versions?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.