Unsolved Cross compile Qt with -xcb failed
-
I use arm-linux-gnueabihf- to cross-compile QT 5.15.2 for rk3288, since I run the executable file failed with not found "xcb"
, I add -xcb during the configuration. Then it failed with the following logs:Trying source 0 (type pkgConfig) of library xcb ... pkg-config use disabled globally. => source produced no result. Trying source 1 (type inline) of library xcb ... + cd /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/config.tests/xcb && /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" -early "CONFIG += cross_compile" 'QMAKE_USE += xcb' 'QMAKE_LIBS_XCB = -lxcb' /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/config.tests/xcb + cd /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/config.tests/xcb && MAKEFLAGS= /usr/bin/make > arm-linux-gnueabihf-g++ -c -pipe -O2 -w -fPIC -I. -I/home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++ -o main.o main.cpp > arm-linux-gnueabihf-g++ -Wl,-O1 -o xcb main.o -lxcb > /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lxcb > collect2: error: ld returned 1 exit status > make: *** [Makefile:67: xcb] Error 1 => source failed verification. ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11' failed. ERROR: Feature 'xcb-xlib' was enabled, but the pre-condition 'features.xlib && libs.xcb_xlib' failed.
It seems that I need to install some extra packages but I don't know which ones are. Does anyone has solved the same problem?
-
@Hupe said in Cross compile Qt with -xcb failed:
cannot find -lxcb
You do not have libxcb in your sysroot. What did you see when you called configure?
-
@Hupe
first of all see this:
https://doc.qt.io/qt-5/linux-requirements.htmlAlso Qt creates a small test application and tries to compile it in order to check if all libs are present.
This for example is for the "tests.xcb_syslibs":
https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/configure.json?h=5.15.2#n1057So you need to have the following libs installed:
"use": "xcb_icccm xcb_util xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xcb"
-
@jsulm
The above log is part of the configure log. The overall log during the configuration is too long to paste. I cut the log that contains "xcb".
I have installedlibfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-xinerama0-dev
as https://doc.qt.io/qt-5/linux-requirements.html shows in my host machine.
-
@raven-worx said in Cross compile Qt with -xcb failed:
icccm
I have installed
libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-xinerama0-dev
in my host machine before configuration. But it still reports errors as above shows.
-
@Hupe said in Cross compile Qt with -xcb failed:
in my host machine before configuration
It does not matter at all what you install on your host machine. As you are cross compiling you need the lib in your sysroot.
-
@jsulm said in Cross compile Qt with -xcb failed:
It does not matter at all what you install on your host machine. As you are cross compiling you need the lib in your sysroot.
a sysroot is not necessarily needed, since the "arm-linux-gnueabihf-g++" compiler selects the libraries automatically from the armhf lib paths.
@Hupe said in Cross compile Qt with -xcb failed:
I have installed
libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-xinerama0-devits mandatory that you install the armhf packages.
This means you need to install it like this:libfontconfig1-dev:armhf libfreetype6-dev:armhf ...
Is this the case?
The way you listed the packages would install the host variants of the packages (probably amd64?) -
I have installed these packages in my rootfs and selected it as my sysroot. But compile with qt still failed with the same error.
-
It seems that my repository doesn't have a version of armhf. Do you know which repository could install armhf version on the X86 host machine?
-
@Hupe
what is your host system? Ubuntu/Debian?
see https://wiki.debian.org/Multiarch/HOWTOi personally prefer building Qt in a docker image. This way you have a (reusable) closed environment with all you need without messing with your host environment.
For a debian based image the following should be enough:
dpkg --add-architecture armhf apt update apt -y install mypackage-dev:armhf .... apt clean
What is the target OS on the device?
-
@raven-worx
I tried to install the development kits as you said, But apt returned an error to install these armhf packages. My host machine runs an Ubuntu 20.04. Now I am trying to start a Debian container to do this. -
I can't install these armhf packages even in debian or ubuntu container. It returned with error:
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/main/binary-armhf/Packages 404 Not Found [IP: 91.189.91.38 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/universe/binary-armhf/Packages 404 Not Found [IP: 91.189.88.142 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/universe/binary-armhf/Packages 404 Not Found [IP: 91.189.88.142 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/universe/binary-armhf/Packages 404 Not Found [IP: 91.189.88.142 80] E: Some index files failed to download. They have been ignored, or old ones used instead.
-
@Hupe
did you runapt update
before you tried to install? -
@raven-worx
Yes, I did. -
I will pay 300 doges if anyone could teach me how to cross-compile QT with xcb, opengl and webengine.
-
@Hupe
the repo urls you posted with the errors contain "bionic" (Ubuntu 18.04), but yousaid you are running 20.04, so there is your issue i guess.This is my (minimal) working "/etc/apt/sources.list" with armhf repos for Ubuntu 20.04:
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal main restricted
deb [arch=armhf] http://ports.ubuntu.com/ focal main restricted
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb [arch=armhf] http://ports.ubuntu.com/ focal-updates main restricted
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal universe
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal-updates universe
deb [arch=armhf] http://ports.ubuntu.com/ focal universe
deb [arch=armhf] http://ports.ubuntu.com/ focal-updates universe
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal multiverse
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb [arch=armhf] http://ports.ubuntu.com/ focal multiverse
deb [arch=armhf] http://ports.ubuntu.com/ focal-updates multiverse
deb [arch=amd64,i386] http://at.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb [arch=armhf] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu focal-security main restricted
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu focal-security universe
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu focal-security multiverse
deb [arch=armhf] http://ports.ubuntu.com/ focal-security main restricted
deb [arch=armhf] http://ports.ubuntu.com/ focal-security universe
deb [arch=armhf] http://ports.ubuntu.com/ focal-security multiversebackup your old sources.list, replace it with that one and run "apt update" again
-
@Hupe said in Cross compile Qt with -xcb failed:
libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-xinerama0-dev
thanks,I have added armhf source with ubuntu-ports successful. I installed armhf dependencies listed in [https://wiki.qt.io/Building_Qt_5_from_Git](link URL) both in the host machine and target machine. Now the -lxcb can be found, But config still fail with error :
Trying source 0 (type pkgConfig) of library xcb_xlib ... + PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary PKG_CONFIG_LIBDIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/share/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --exists --silence-errors x11-xcb + PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary PKG_CONFIG_LIBDIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/share/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --modversion x11-xcb > 1.6.9 + PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary PKG_CONFIG_LIBDIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/share/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-L x11-xcb > -L/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf + PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary PKG_CONFIG_LIBDIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/share/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-l x11-xcb > -lX11-xcb -lX11 -lxcb + PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary PKG_CONFIG_LIBDIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/share/pkgconfig:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --cflags x11-xcb X11/Xlib-xcb.h not found in [] and global paths. => source produced no result. Trying source 1 (type inline) of library xcb_xlib ... X11/Xlib-xcb.h not found in [] and global paths. => source produced no result.
I don't know which library is still missed, Could you please help me. orz
-
I could find X11/Xlib-xcb.h manually:
:/usr/include# find ./ -name Xlib-xcb.h ./X11/Xlib-xcb.h
And I found a lot of missing header files in config.log:
matinal@matinal-host:~/workstation/Qt/qt-everywhere-src-5.15.2$ grep -rn "not found in [] and global paths" config.log 109:dbus/dbus.h not found in [] and global paths. 173:libudev.h not found in [] and global paths. 176:libudev.h not found in [] and global paths. 391:unicode/utypes.h not found in [] and global paths. 392:unicode/ucol.h not found in [] and global paths. 393:unicode/ustring.h not found in [] and global paths. 438:pcre2.h not found in [] and global paths. 441:pcre2.h not found in [] and global paths. 454:sys/slog2.h not found in [] and global paths. 477:double-conversion/double-conversion.h not found in [] and global paths. 506:openssl/ssl.h not found in [] and global paths. 507:openssl/opensslv.h not found in [] and global paths. 584:xcb/xcb_icccm.h not found in [] and global paths. 587:xcb/xcb_icccm.h not found in [] and global paths. 640:EGL/egl.h not found in [] and global paths. 643:EGL/egl.h not found in [] and global paths. 716:VG/openvg.h not found in [] and global paths. 723:harfbuzz/hb.h not found in [] and global paths. 734:jpeglib.h not found in [] and global paths. 762:md4c.h not found in [] and global paths. 767:tslib.h not found in [] and global paths. 776:vulkan/vulkan.h not found in [] and global paths. 799:X11/Xlib-xcb.h not found in [] and global paths. 802:X11/Xlib-xcb.h not found in [] and global paths. 815:xkbcommon/xkbcommon.h not found in [] and global paths. 818:xkbcommon/xkbcommon.h not found in [] and global paths. 829:cups/cups.h not found in [] and global paths. 836:sqlcli.h not found in [] and global paths. 837:sqlcli1.h not found in [] and global paths. 844:ibase.h not found in [] and global paths. 861:mysql.h not found in [] and global paths. 868:mysql.h not found in [] and global paths. 871:mysql.h not found in [] and global paths. 878:oci.h not found in [] and global paths. 887:sql.h not found in [] and global paths. 888:sqlext.h not found in [] and global paths. 902:libpq-fe.h not found in [] and global paths. 907:sqlite.h not found in [] and global paths. 959:jasper/jasper.h not found in [] and global paths. 966:libmng.h not found in [] and global paths. 973:tiffio.h not found in [] and global paths. 980:webp/decode.h not found in [] and global paths. 981:webp/encode.h not found in [] and global paths. 982:webp/demux.h not found in [] and global paths. 983:webp/mux.h not found in [] and global paths. 1101:wayland-version.h not found in [] and global paths. 1110:wayland-egl.h not found in [] and global paths. 1113:wayland-egl.h not found in [] and global paths. 1122:wayland-version.h not found in [] and global paths. 1439:vpx/vpx_encoder.h not found in [] and global paths. 1440:vpx/vp8cx.h not found in [] and global paths. 1497:snappy.h not found in [] and global paths. 1582:alsa/asoundlib.h not found in [] and global paths.
I wonder is there any pre-config that should do for pkg-config?
-
@Hupe
back to the start. please show your Qt configure line.PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary
did you specify a sysroot? if so the libs should be contained in the sysroot, which they are not by simply installing it on your host system of course.
-
This is my configure line now:
#~/bin/bash ./configure \ -v \ -extprefix /opt/Qt5.15.2-armhf \ -hostprefix /opt/Qt5.15.2-armhf-host \ -sysroot /home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary \ -xplatform linux-arm-gnueabihf-g++ \ -opensource \ -confirm-license \ -shared \ -strip \ -xcb-xlib \ -xcb \ -gui \ -make libs \ -make tools \ -widgets \ -nomake examples
I have installed the pre-required libs in my sysroot and could find X11/Xlib-xcb.h