[SOLVED] Cross-compiling QT apps for a raspberry pi - Cannot open shared object file

  • I want to be able to use the QT Creator on my full-sized desktop to be able to develop and compile qt apps and deploy them to the pi.

    I followed this guide: "http://qt-project.org/wiki/Create#QtonPi_App_SDK":http://qt-project.org/wiki/Create#QtonPi_App_SDK

    I am trying to get the hello-qtonpi project to compile. Using the compiler and the toolchain for the pi, I get two errors during compiling:

    @/opt/qtonpi/lib/gcc/armv5tel-qtonpi-linux-gnueabi/4.5.4/../../../../armv5tel-qtonpi-linux-gnueabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
    /opt/qtonpi/libexec/gcc/armv5tel-qtonpi-linux-gnueabi/4.5.4/cc1plus: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory@
    I checked that these two libraries were installed on my pi, and the rsynced /lib and /usr/lib from the pi to my sys-root folder.

    I tried using the QT Creators Add Library -> System Library tool, and selected e.g. libz.so, as it didn't show the so.1 one. It added the following line to the .pro file:

    unix:!macx:!symbian: LIBS += -lz
    However it still didn't get rid of the error.

    How should I include these libraries or tell the compiler where to look from?

  • I think it could be a number of things causing the problem you are seeing.
    And without knowing too much about your situation, here are some ideas that might get you a bit further:

    I do not really know anything about the toolchain you are using but if it is anything like a "normal" one you can call something like this to see which directories it will search for libraries in.
    @g++ -print-search-dirs@

    As a test you can link to the library with the full path just to see if the lookup path is the problem. Like so @LIBS += /usr/lib/libz.so@

    You can also test to specify the sysroot for the toolchain and point it to the location of your raspberry pi sysroot when compiling. For example @g++ --sysroot=/path/to/sysroot/@

  • Thanks for your help. I was able to solve this "myself" though, but had not yet posted the answer here.

    The problem was not with the libraries for the target, but for the host. I had it installed on a 64-bit machine, and the libraries had to be 32 bit. It compiled fine after I installed the i686 versions of libz-devel and libmpc-devel.

    There was something funny with the libz though. The compiler gave me errors, saying that it could not get the version information for zlib, unable to find the absolute file location. I was able to ls -l it though. It showed a symlink pointing from libz.so.1 to libz.so.1.x.x (I don't remember the exact version). I deleted and recreated this symlink, and it was fixed.

    Now I just have to get qt working on the pi...

Log in to reply

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