Qt fails to cross compile (compiling for 32 bit on 64 bit system)



  • Hi, I'm trying to compile QT for linux-32 on my Debian 64 bit system.
    I am using Debian's multiarch, so I have all the necessary packages installed for cross compiling to 32 bit (I have done it many times in the past).

    At the moment, I am failing to cross compile QT. It fails at the ./configure stage. My configure is like this:
    /configure "-debug-and-release" "-nomake" "tests" "-qtnamespace" "QT" "-confirm-license" "-accessibility" "-platform" "linux-g++-32" "-developer-build" "-fontconfig" "-qt-freetype" "-qt-libpng" "-glib" "-qt-xcb" "-dbus" "-qt-sql-sqlite" "-gtkstyle" "-prefix" "/home/john/bin/Qt/5.6.0/" -v

    It seems that for some reason the linker cannot find any of the 32 bit libraries. The first time it fails, it's because it cannot find lgthread:
    g++ -m32 -Wl,-O1 -o glib glib.o -lgthread-2.0 -pthread -lglib-2.0
    /usr/bin/ld: cannot find -lgthread-2.0
    collect2: error: ld returned 1 exit status
    Makefile:84: recipe for target 'glib' failed
    make: *** [glib] Error 1
    Glib disabled.

    If I ask it to continue, it continues failing on multiple libs, such as for example:
    g++ -c -m32 -pipe -O2 -Wall -W -fPIC -I. -I../../../mkspecs/linux-g++-32 -o xcb.o xcb.cpp
    xcb.cpp: In function ‘int main(int, char**)’:
    xcb.cpp:39:23: warning: unused variable ‘t’ [-Wunused-variable]
    xcb_connection_t *t = xcb_connect("", &primaryScreen);
    ^
    g++ -m32 -Wl,-O1 -o xcb xcb.o -lxcb
    /usr/bin/ld: cannot find -lxcb
    collect2: error: ld returned 1 exit status
    Makefile:84: recipe for target 'xcb' failed
    make: *** [xcb] Error 1
    xcb disabled.
    The test for linking against libxcb failed!

    In fact, there are multiple failures like this happening.

    Now, I have installed all the necessary libraries, 32 and 64 bit, that are required to build qt5 - apt-get build-dep qt5-default, as instructed by you, plus many others I thought were necessary. But now I'm coming to the realisation that the problem is somewhere in the linking stage where Qt simply cannot find the 32 bit libraries.

    These libraries are there, and in the path. For example:
    ls -l /lib/i386-linux-gnu/libglib-2.0.so*
    lrwxrwxrwx 1 root root 36 Oct 7 2015 /lib/i386-linux-gnu/libglib-2.0.so -> /lib/i386-linux-gnu/libglib-2.0.so.0
    lrwxrwxrwx 1 root root 23 Jul 13 17:46 /lib/i386-linux-gnu/libglib-2.0.so.0 -> libglib-2.0.so.0.4800.1
    -rw-r--r-- 1 root root 1211332 Jul 13 17:46 /lib/i386-linux-gnu/libglib-2.0.so.0.4800.1

    So what is going on here? Is this a bug with 5.6.0? Or some incompatibility with cross compilation?

    Thanks!



  • Noone? I'm sure I can't be the only one cross compiling QT for x32 in x64!



  • You need to install the package you can easily get the answer on the internet which support 32 bits's development.


Log in to reply
 

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