abhiTronix / raspberry-pi-cross-compilers

Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. 🍇
https://sourceforge.net/projects/raspberry-pi-cross-compilers
GNU General Public License v3.0
583 stars 102 forks source link

qmake built for x86 #94

Closed Nickellick closed 2 years ago

Nickellick commented 2 years ago

I want to use the latest version of Qt5 for Raspberry Pi 4B for PySide2. However, when building the PySide2 library, there are problems running qmake. After a bit of research, it turned out that qmake was somehow compiled for x86. All other binaries compiled correctly for ARM.

So, if I run (on target, of course) cd /usr/local/qt5.15/bin and try to check binary with file qmake It ouputs: qmake: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=781f60a8151971256f3ac25972223493fbdf2f4f, for GNU/Linux 3.2.0, with debug_info, not stripped I'm pretty sure that I used cross-compiler, because if I run file xmlpatterns or file qml It outputs ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, stripped

So my question is, how do I build qmake for a target?

abhiTronix commented 2 years ago

How did you build qmake?

Nickellick commented 2 years ago

How did you build qmake?

I don't actually specify what to build. I just used your guide (BTW it was very helpful, thanks!)

Nickellick commented 2 years ago

Important to mention: I'm using Ubuntu 21.10 as "compiler machine" with gcc 11.2. Because of this, I had some problems with "numeric limits". I added the line

#include <limits>

within the #ifdef __cplusplus block to the file ~/rpi-qt/build/qtbase/src/corelib/global/qglobal.h

and -no-pch parameter to configure, so it looked like this ../qt-everywhere-src-5.15.2/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=$(echo $CROSS_COMPILER_LOCATION)/bin/arm-linux-gnueabihf- -sysroot ~/rpi-qt/sysroot/ -prefix /usr/local/qt5.15 -extprefix ~/rpi-qt/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -L$HOME/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -I$HOME/rpi-qt/sysroot/usr/include/arm-linux-gnueabihf -no-pch as it was mentioned in this solution

My config.summary:

Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: devices/linux-rasp-pi4-v3d-g++ (arm, CPU features: neon)
Target compiler: gcc 8.3.0
Configuration: cross_compile compile_examples largefile neon shared shared rpath release c++11 c++14 c++17 c++1z concurrent dbus reduce_exports stl
Build options:
  Mode ................................... release
  Optimize release build for size ........ no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Using ccache ........................... no
  Using new DTAGS ........................ no
  Relocatable ............................ yes
  Using precompiled headers .............. no
  Using LTCG ............................. no
  Target compiler supports:
    NEON ................................. yes
  Build parts ............................ libs
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... yes
  Qt D-Bus directly linked to libdbus .... yes
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... yes
  Using system zlib ...................... yes
  Zstandard support ...................... no
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ yes
  GLib ................................... yes
  iconv .................................. no
  ICU .................................... yes
  Built-in copy of the MIME database ..... yes
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. yes
    Using system PCRE2 ................... yes
Qt Network:
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  Linux AF_NETLINK ....................... yes
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ yes
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. yes
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... yes
  INTEGRITY HID .......................... no
  mtdev .................................. yes
  tslib .................................. no
  xkbcommon .............................. yes
  X11 specific:
    XLib ................................. yes
    XCB Xlib ............................. yes
    EGL on X11 ........................... yes
    xkbcommon-x11 ........................ yes
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... yes
    EGLFS GBM ............................ yes
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ yes
  LinuxFB ................................ yes
  VNC .................................... yes
  XCB:
    Using system-provided xcb-xinput ..... yes
    Native painting (experimental) ....... no
    GL integrations:
      GLX Plugin ......................... no
      EGL-X11 Plugin ..................... yes
Qt Sql:
  SQL item models ........................ yes
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt PrintSupport:
  CUPS ................................... yes
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... yes
  PostgreSQL ............................. yes
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... yes
Qt Testlib:
  Tester for item models ................. yes
Serial Port:
  ntddmodm ............................... no
Qt SerialBus:
  Socket CAN ............................. yes
  Socket CAN FD .......................... yes
  SerialPort Support ..................... yes
Further Image Formats:
  JasPer ................................. no
  MNG .................................... no
  TIFF ................................... yes
    Using system libtiff ................. yes
  WEBP ................................... yes
    Using system libwebp ................. yes
Qt QML:
  QML network support .................... yes
  QML debugging and profiling support .... yes
  QML just-in-time compiler .............. yes
  QML sequence object .................... yes
  QML XML http request ................... yes
  QML Locale ............................. yes
Qt QML Models:
  QML list model ......................... yes
  QML delegate model ..................... yes
Qt Quick:
  Direct3D 12 ............................ no
  AnimatedImage item ..................... yes
  Canvas item ............................ yes
  Support for Qt Quick Designer .......... yes
  Flipable item .......................... yes
  GridView item .......................... yes
  ListView item .......................... yes
  TableView item ......................... yes
  Path support ........................... yes
  PathView item .......................... yes
  Positioner items ....................... yes
  Repeater item .......................... yes
  ShaderEffect item ...................... yes
  Sprite item ............................ yes
QtQuick3D:
  Assimp ................................. yes
  System Assimp .......................... no
Qt Scxml:
  ECMAScript data model for QtScxml ...... yes
Qt Gamepad:
  SDL2 ................................... no
Qt 3D:
  Assimp ................................. yes
  System Assimp .......................... no
  Output Qt3D GL traces .................. no
  Use SSE2 instructions .................. no
  Use AVX2 instructions .................. no
  Aspects:
    Render aspect ........................ yes
    Input aspect ......................... yes
    Logic aspect ......................... yes
    Animation aspect ..................... yes
    Extras aspect ........................ yes
Qt 3D Renderers:
  OpenGL Renderer ........................ yes
  RHI Renderer ........................... no
Qt 3D GeometryLoaders:
  Autodesk FBX ........................... no
Qt Bluetooth:
  BlueZ .................................. yes
  BlueZ Low Energy ....................... yes
  Linux Crypto API ....................... yes
  Native Win32 Bluetooth ................. no
  WinRT Bluetooth API (desktop & UWP) .... no
  WinRT advanced bluetooth low energy API (desktop & UWP) . no
Qt Sensors:
  sensorfw ............................... no
Qt Quick Controls 2:
  Styles ................................. Default Fusion Imagine Material Universal
Qt Quick Templates 2:
  Hover support .......................... yes
  Multi-touch support .................... yes
Qt Positioning:
  Gypsy GPS Daemon ....................... no
  WinRT Geolocation API .................. no
Qt Location:
  Qt.labs.location experimental QML plugin . yes
  Geoservice plugins:
    OpenStreetMap ........................ yes
    HERE ................................. yes
    Esri ................................. yes
    Mapbox ............................... yes
    MapboxGL ............................. yes
    Itemsoverlay ......................... yes
QtXmlPatterns:
  XML schema support ..................... yes
Qt Multimedia:
  ALSA ................................... yes
  GStreamer 1.0 .......................... yes
  GStreamer 0.10 ......................... no
  Video for Linux ........................ yes
  OpenAL ................................. yes
  PulseAudio ............................. yes
  Resource Policy (libresourceqt5) ....... no
  Windows Audio Services ................. no
  DirectShow ............................. no
  Windows Media Foundation ............... no
Qt TextToSpeech:
  Flite .................................. no
  Flite with ALSA ........................ no
  Speech Dispatcher ...................... no
Qt Tools:
  Qt Assistant ........................... yes
  Qt Designer ............................ yes
  Qt Distance Field Generator ............ yes
  kmap2qmap .............................. yes
  Qt Linguist ............................ yes
  Mac Deployment Tool .................... no
  makeqpf ................................ yes
  pixeltool .............................. yes
  qdbus .................................. yes
  qev .................................... yes
  Qt Attributions Scanner ................ yes
  qtdiag ................................. yes
  qtpaths ................................ yes
  qtplugininfo ........................... yes
  Windows deployment tool ................ no
  WinRT Runner Tool ...................... no
Qt Tools:
  QDoc ................................... no

Note: Also available for Linux: linux-clang linux-icc

WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.

Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.
abhiTronix commented 2 years ago

Important to mention: I'm using Ubuntu 21.10 as "compiler machine" with gcc 11.2.

Because of this, I had some problems with "numeric limits". I added the line

include

within the #ifdef __cplusplus block to the file ~/rpi-qt/build/qtbase/src/corelib/global/qglobal.h

and -no-pch parameter to configure, so it looked like this ../qt-everywhere-src-5.15.2/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=$(echo $CROSS_COMPILER_LOCATION)/bin/arm-linux-gnueabihf- -sysroot ~/rpi-qt/sysroot/ -prefix /usr/local/qt5.15 -extprefix ~/rpi-qt/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -L$HOME/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -I$HOME/rpi-qt/sysroot/usr/include/arm-linux-gnueabihf -no-pch as it was mentioned in this solution

@Nickellick I'm not understanding this, for what purpose you're using gcc 11.2 exactly for? In my guide(which is specifically written for toolchains with this project only) mentions use of GCC base toolchains(for example GCC 8.3.0 for Buster and GCC 10.2.0 for bullseye) which are only available within this project and it's clearly mentioned in the guide's description, which I quote:

"Since many finding it difficult to cross-compile QT library for their Raspberry Pi with this project binaries, I decided to make this document. This guide documents the every steps to follow to cross-compile Latest available Qt-5.15.2 for any Raspberry Pi variant/model available, using the Raspberry Pi Toolchains available with this project only."

 

Target compiler: gcc 8.3.0

Also, Here in configuration you're using GCC 8.3.0 toolchains. Are you trying to compile QT binaries or something else? Help me understand the complete setup and steps you followed till now.

Nickellick commented 2 years ago

Also, Here in configuration you're using GCC 8.3.0 toolchains. Are you trying to compile QT binaries or something else? Help me understand the complete setup and steps you followed till now.

After configure, I just type make. My guess is that it builds the tools for the host machine by compiler on the host machine, uses them, and then builds binaries for target. All other binaries except qmake are built for target. Of course, I ran make install after the build.

abhiTronix commented 2 years ago

But what are you using GCC 11.2 for?

Nickellick commented 2 years ago

But what are you using GCC 11.2 for?

I don't explicitly use it. As I wrote above, it is used automatically when I run the make command inside the build folder. The command for configure and its summary shown above.

All other binaries are compiled for target, so I'm pretty sure the cross-compiler works fine. Also:

My guess is that it builds the tools for the host machine by compiler on the host machine, uses them, and then builds binaries for target

abhiTronix commented 2 years ago

I don't what're you doing on your end, I just cross-compiled the latest QT and it went successfully, Kindly follow every step in guide carefully and avoid these changes:

I added the line

include

within the #ifdef __cplusplus block to the file ~/rpi-qt/build/qtbase/src/corelib/global/qglobal.h

and -no-pch parameter to configure, so it looked like this ../qt-everywhere-src-5.15.2/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=$(echo $CROSS_COMPILER_LOCATION)/bin/arm-linux-gnueabihf- -sysroot ~/rpi-qt/sysroot/ -prefix /usr/local/qt5.15 -extprefix ~/rpi-qt/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -L$HOME/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -I$HOME/rpi-qt/sysroot/usr/include/arm-linux-gnueabihf -no-pch as it was mentioned in this solution

Nickellick commented 2 years ago

I don't what're you doing on your end, I just cross-compiled the latest QT and it went successfully, Kindly follow every step in guide carefully and avoid these changes

Could you please write what OS and version you are running on the host machine? And please, just for general information, what version of gcc (regular, not for cross-compiling) you have installed.

I followed your guide very closely and I don't know how to prove it. I need this information to be sure that this is really only a problem on my side. This will help me a lot. Thank you!

abhiTronix commented 2 years ago

Linux Mint x64 with GCC 8.3.0 buster toolchains for Raspberry Pi 3B+. Also, It's not just me, hundreds of people everyday visit that specific guide. So the problem is definitely at your end, and still you're not convinced then feel free to try other toolchains.

Nickellick commented 2 years ago

Linux Mint x64 with GCC 8.3.0 buster toolchains for Raspberry Pi 3B+. Also, It's not just me, hundreds of people everyday visit that specific guide. So the problem is definitely at your end, and still you're not convinced then feel free to try other toolchains.

Thanks a lot! But please tell me which version of GCC (regular, not for cross-compilation, not for RPi) is installed on your PC? I'll try building QT a few more times with a different environment to see what's going on.

And please listen to me. I don't blame you or your guide. I'm convinced it really works, and it works great. I see this has been tested many times by other people. I just want to know what's going on on my side. So I want to try again with a different environment - just like yours.

It's really strange that my computer only built one x86 binary and all the rest are for ARM. I just want to get it right.

abhiTronix commented 2 years ago

Sorry but I've to close this. It might be a bad environment variable issue or missing step from guide. But this is not a forum. IMO you've to start from scratch OS and follow guide step-by-step to resolve this.