Unsolved Cross compile Qt with -xcb failed
-
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
-
I don't know what that global in "not found in [] and global paths" mean. I checked the config.log and found that pkg-config finds the include directory correctly. The problem is that the global path seems to be null. Should I add the include path of sysroot to the environment of my host machine? I will try to set the environment both of my host machine and my target sysroot. Hope it will work.
-
@Hupe said in Cross compile Qt with -xcb failed:
I could find X11/Xlib-xcb.h manually:
:/usr/include# find ./ -name Xlib-xcb.h
./X11/Xlib-xcb.hthis is the host version (outside of your specified sysroot).
Do you really need a sysroot? Either use the sysroot to get your libs or the armhf ones installed on the host. But a mixture of both wont work.
-
@raven-worx
I found these header files in my specified sysroot after running chroot. I use sysroot because compiling webengine needs pkg-config which requires sysroot.
The problem I encountered now is that config-test can't search my sysroot as a default path automatically. That is, the "global paths" in "X11/Xlib-xcb.h not found in [] and global paths." seems not to include the PKG_CONFIG_SYSROOT_DIR=/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary
Besides, I added my sysroot include directory```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/include -
@Hupe said in Cross compile Qt with -xcb failed:
I found these header files in my specified sysroot after running chroot.
i still dont get it.
you chroot into your sysroot?! If so, this is wrong in so many ways...I use sysroot because compiling webengine needs pkg-config which requires sysroot.
i cross-compiled Qt (incl. webengine) quite a few times now, and i never used a sysroot.
Besides, I added my sysroot include directory```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary/usr/includeLD_LIBRARY_PATH isnt used to specify include directories, but rather to find libs during runtime (by the runtime linker)!
-
Sorry for my broken English. I didn't chroot to my sysroot when building qt. I just chroot to my sysroot to find these missing header files.
That is what I got if I configure without sysroot. The warinng shows that pkg-config is required to build QtWebEngine, and sysroot is required to pkg-config.
Note: Also available for Linux: linux-clang linux-icc Note: No wayland-egl support detected. Cross-toolkit compatibility disabled. Note: The following modules are not being compiled in this configuration: 3dcore 3drender webenginecore webengine webenginewidgets pdf pdfwidgets WARNING: Cross compiling without sysroot. Disabling pkg-config WARNING: A pkg-config support is required to build QtWebEngine. WARNING: A pkg-config support is required to build QtPdf. WARNING: QtWebEngine will not be built. WARNING: QtPdf will not be built. 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. ERROR: The OpenGL functionality tests failed! You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2], QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.
I exported both LD_LIBRARY_PATH and C_INCLUDE_PATH but they all didn't work
-
I configure successfully after adding my sysroot include directory to the -I variable.
Now there is only some warings:
Note: Also available for Linux: linux-clang linux-icc Note: PKG_CONFIG_LIBDIR automatically set to /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 Note: PKG_CONFIG_SYSROOT_DIR automatically set to /home/matinal/workstation/rk-source/rk3288-linux/linux/ubuntu/binary Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing. Note: No wayland-egl support detected. Cross-toolkit compatibility disabled. WARNING: Thumb instruction set is required to build ffmpeg for QtWebEngine. WARNING: Building without node.js will disable some features of QtWebEngine DevTools. Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into '/opt/Qt5.15.2-armhf'. Prior to reconfiguration, make sure you remove any leftovers from the previous build.
I will try to find the solution of this warings. Thanks a lot! Do you have dogecoin address?
-
I encountered error as follows:
[8/8701] /usr/bin/g++ -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -m64 -Wl,-O2 -Wl,--gc-sections -pie -Wl,--disable-new-dtags -L/usr/lib/arm-linux-gnueabihf -o "host/transport_security_state_generator" -Wl,--start-group @"host/transport_security_state_generator.rsp" -Wl,--end-group -ldl -lpthread -lrt -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 FAILED: host/transport_security_state_generator /usr/bin/g++ -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -m64 -Wl,-O2 -Wl,--gc-sections -pie -Wl,--disable-new-dtags -L/usr/lib/arm-linux-gnueabihf -o "host/transport_security_state_generator" -Wl,--start-group @"host/transport_security_state_generator.rsp" -Wl,--end-group -ldl -lpthread -lrt -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libdl.so when searching for -ldl /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libdl.a when searching for -ldl /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libpthread.so when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libpthread.a when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/librt.so when searching for -lrt /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/librt.a when searching for -lrt /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 when searching for libgcc_s.so.1 /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 when searching for libgcc_s.so.1 collect2: error: ld returned 1 exit status
It's wired that /usr/bin/ld in my X86 host machine tried to search for the libraries in /usr/lib/arm-linux-gnueabihf/. It's there any other config that should do to select the proper ld tool or library path?
-
@Hupe
i also encountered the last error in transport_security_state_generatorYou can replace the incorrect armhf lib dir with something like that:
sed -i -e 's/-L/usr/lib/arm-linux-gnueabihf//g' <BUILD-DIR>/qtwebengine/src/core/release/host/obj/net/tools/transport_security_state_generator/transport_security_state_generator.ninja
Note that the ninja file is generated during build time.
After replacing simply switch in your build directory and call make to continue the build.