Cross-compile from ubuntu16.04 64bit host to a ubuntu 16.04 32bit target device.



  • My finished Qt application is working and can be used on our smaller machinery. It will take some time before we implement my Raspberry Pi solution. But our Chinese colleagues are currently also producing some machines which could run with my application.

    The point is that at the moment we need to buy 90 bucks windows licenses, so I was given the task of 'solving' that problem. And I outfitted one of the Chinese panel PCs with the 32bit Ubuntu 16.04 distro and I got that troublesome touchscreen to work.

    I have been building executables for the raspberry so long now that I don't know which compiler settings I should set up on Qt Creator on my 64bit computer. So I can compile for the panel PC instead of for the Raspberry.

    And what do I need to do on the panel PC? do I only need to sudo apt-get install Qt5-default???


  • Moderators

    @bask185 As always you need:

    • compiler generating x86 32 bit binaries
    • all needed libraries as 32 bit
    • Qt 32 bit

    In Ubuntu you can install this stuff this way (g++ as example):

    apt-get install g++:i386
    

    When you installed all this then set up a kit in QtCreator with 32 bit g++ and 32 bit Qt.



  • @jsulm said in Cross-compile from ubuntu16.04 64bit host to a ubuntu 16.04 32bit target device.:

    apt-get install g++:i386

    Thanks for you reply
    
    user@user:~$ sudo apt-get install g++:i386
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     g++:i386 : Depends: cpp:i386 (>= 4:5.3.1-1ubuntu1) but it is not going to be installed
                Depends: gcc:i386 (>= 4:5.3.1-1ubuntu1) but it is not going to be installed
                Depends: g++-5:i386 (>= 5.3.1-3~) but it is not going to be installed
                Depends: gcc-5:i386 (>= 5.3.1-3~) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    
    

    I vaguely recall once having installed 32bit stuffs
    I do see 32 bit compilers but I see an error.

    I'll show some screenshots of my compiler settings
    alt text
    alt text
    alt text

    I am pretty sure I have selected the wrong Qt version, I need to add a new one but I don't know where to look for, in the subfolder Qt 5.7 I only see gcc_64 folder. And I get a similar error in the kits tab, the compiler can't produce code for the selected Qt version.

    Besides configuring the kit properly, what exactly must I install on the target device? so far I only apt-get installed qt5-default


  • Moderators

    @bask185 You need to install 32bit Qt version. Qt project does not provide 32bit builds for Linux anymore. Either install it from Ubuntu repository or build it by yourself.



  • @jsulm
    Mate I really have no clue where I can find this.
    I am looking here:
    https://download.qt.io/archive/qt/5.7/5.7.0/
    But I cannot tell what I should or should not download

    I already spend a good minutes in the apt-cache search qt list to find something, but I cannot find it


  • Moderators

    @bask185 I said above that Qt does not provide 32bit binaries for Linux anymore - no need to search for it.
    Look for qt*:i386 packages in Ubuntu.



  • I found these two in the cache.
    libc6-dev-i386 - GNU C Library: 32-bit development libraries for AMD64
    libc6-i386 - GNU C Library: 32-bit shared libraries for AMD64

    and from: https://www.qt.io/download-open-source/#section-2
    I can download "Qt Online Installer for Linux 32-bit", the descreption above it says:
    "Qt online installer is a small executable which downloads content over internet based on your selections. It provides binary and source packages for different Qt library versions and latest Qt Creator."
    Except for the Qt Creator part, this seems good?

    EDIT:
    I found a 3YO qt topic which mentioned these packages
    libsm6:i386
    libxrender1:i386
    libfontconfig1:i386
    libxext6:i386
    libgtk2.0-0:i386
    libcanberra-gtk-module:i386
    libxslt1.1:i386
    libglu1-mesa-dev:i386
    libc6-i386
    libglib2.0-0:i386
    libsm6:i386
    libglu1-mesa:i386
    libgl1-mesa-glx:i386
    libxext6:i386
    libxrender1:i386
    libx11-6:i386
    libfontconfig1:i386
    lsb-core
    g++-multilib \

    I am installing all of these atm, some I reckognize and I know I already have some of them


  • Moderators

    @bask185 I don't think you will be able to install 32 bit Qt using this 32 bit installer as Qt Project does not provide 32bit Linux binaries any-more. But you can try.


Log in to reply