Error: libQtSql.so.4 on embedded system



  • Dear all,

    I want to run an application which runs and connects with a database on embedded linux. (TI AM3358)
    When I try to cross-compile the Qt-code I get the following error:

    error while loading shared libraries: libQtSql.so.4: cannot open shared object file: No such file or directory
    

    I started to look online for this file. I found it here: http://www.rpmfind.net/linux/rpm2html/search.php?query=libQtSql.so.4
    I downloaded the first file. After I extracted it and copied to /usr/lib/libQtSql.so.4.

    When I try to compile the code I get the following error:

    error while loading shared libraries: libQtSql.so.4: internal error
    

    Isn't this the correct file? Or should I first compile this somehow?
    As you can see, I'm a beginner ;).

    Thanks in advance,
    Kind regards


  • Lifetime Qt Champion

    Hi,

    What Linux distribution is your target running ?
    How did you cross-compile Qt ?



  • @SGaist

    Thanks for the reply.

    So, Linux distribution of the target: Embedded Linux --> output of uname -a

    Linux goembed 3.2.0 #1 Sat Oct 14 10:02:32 CST 2017 armv7l GNU/Linux
    

    I'm using the image from from the vendor GOEMBED. I have builded the image it with buildroot. (all info of the image can be found here: http://www.goembed.com/index.php/Community/post/tpoId/127)

    On the embedded system, when I navigate to /usr/lib I get the following libraries:

    0_1528234230520_6c9ae265-0b72-4280-9fec-0d092fe23595-image.png

    After I just added :

    • libQtSql.so.4
    • libQtSql.so.4.8
    • libQtSql.so.4.8.7

    0_1528234370076_771d1d83-8c44-42ce-80d8-360d8f8c3920-image.png

    So Qt was builded when building the image with buildroot. But I was missing this library.

    Kind regards.


  • Qt Champions 2018

    @TMJJ you need to build the sql lib exactly as you built the other Qt libs.

    otherwise it will 99% crash ;)



  • @aha_1980

    Oooh that's a pitty! I was affraid of this.

    So I need to find a way to add this library to buildroot, so I can recompile it completely.

    Kind regards



  • Talk to GoEmbed support, request the toolchain for this Linux you are using, download and configure.

    Then sync the Qt4.8.6 repository:
    $ git clone -b v4.8.6 https://code.qt.io/cgit/qt/qt.git qt4.8.6

    Using the toolchain you downloaded, perform cross-compiling, when you finish copying the library libQt4Sql * to the card.

    This would be a way if GoEmbed support does not have a version with libQt4Sql ready.

    Here's the Readme of how to cross-compile in the SQL part:
    https://code.qt.io/cgit/qt/qt.git/tree/src/sql/README.module?h=v4.8.6

    Run the ./configure and see the options to enable SQL support:

     -qt-sql- <driver> ... Enable to SQL <driver> in the QtSql library, by default
     -plugin-sql- <driver> Enable SQL <driver> as a plugin to be linked to
                          [db2 ibase mysql oci odbc psql sqlite sqlite2 sqlite_symbian symsql tds]
    

    Cleiton Bueno

    Blog | Linkedin | B2Open


  • Lifetime Qt Champion

    Just case: the latest version of Qt 4 is Qt 4.8.7.