{"id":30512760,"url":"https://github.com/ledangquangdangquang/crosscompilation","last_synced_at":"2026-02-10T09:05:04.635Z","repository":{"id":305098618,"uuid":"1021909309","full_name":"ledangquangdangquang/CrossCompilation","owner":"ledangquangdangquang","description":"Cross compilation of Qt6.5.1 for RPI","archived":false,"fork":false,"pushed_at":"2025-08-18T02:10:39.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-18T04:13:24.726Z","etag":null,"topics":["cross-compilation","cross-compiler","cross-compiler-toolchain"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ledangquangdangquang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-18T06:27:00.000Z","updated_at":"2025-08-18T02:10:42.000Z","dependencies_parsed_at":"2025-07-18T10:43:51.855Z","dependency_job_id":"4f5c37f5-3b09-4952-b01f-dcb1f0e234cd","html_url":"https://github.com/ledangquangdangquang/CrossCompilation","commit_stats":null,"previous_names":["ledangquangdangquang/crosscompliation","ledangquangdangquang/crosscompilation"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ledangquangdangquang/CrossCompilation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledangquangdangquang%2FCrossCompilation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledangquangdangquang%2FCrossCompilation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledangquangdangquang%2FCrossCompilation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledangquangdangquang%2FCrossCompilation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ledangquangdangquang","download_url":"https://codeload.github.com/ledangquangdangquang/CrossCompilation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledangquangdangquang%2FCrossCompilation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272174834,"owners_count":24886296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-compilation","cross-compiler","cross-compiler-toolchain"],"created_at":"2025-08-26T05:08:36.067Z","updated_at":"2026-02-09T06:34:30.594Z","avatar_url":"https://github.com/ledangquangdangquang.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e Cross compilation of Qt6.5.1 for RPI\u003c/h1\u003e\n\n- Cross Compilation https://youtu.be/8kpHgNKPooc\n- Remote Debugging https://youtu.be/QWz-4R4kMIo\n- Localization https://youtu.be/JtTtzYZ_Nk0\n- Reference (LearnQT): https://youtube.com/playlist?list=PLw1hBEGKfRbmvt57e-JriZclgbSSHYzwH\u0026feature=shared \n- Reference (MuyePan): https://www.youtube.com/watch?v=8kpHgNKPooc\n\u003e [!IMPORTANT]\n\u003e * ***Change the hostname and username of Raspberry Pi OS (`pi@192.168.30.77`)***\n\u003e * ***Change the username of Ubuntu (`quang`)***\n\u003e * ***Only one line to copy for each step.***\n\u003e * ***One terminal on the host to set up.***\n\u003e * ***Plz be patient and calm.***\n\n# System Requirements\n* Ubuntu \n```\nDistributor ID:\tUbuntu\nDescription:\tUbuntu 22.04.5 LTS\nRelease:\t22.04\nCodename:\tjammy\n```\n* Raspberry Pi Os \n```\nDistributor ID:\tDebian\nDescription:\tDebian GNU/Linux 11 (bullseye)\nRelease:\t11\nCodename:\tbullseye\n```\n# Prepare RPI\nInstall the lastest 64bit Raspberry Pi OS with desktop and update the system.\nCheck firmware:\n```\ncat /boot/.firmware_revision\n```\n```bash\nsudo apt update\nsudo apt full-upgrade\nsudo reboot\nsudo rpi-update 6db8c1cdd3da2f070866d2149c956ce86a4ccdd5\nsudo reboot\n```\n\nInstall necessary packages.\n```\nsudo apt-get install libboost-all-dev libudev-dev libinput-dev libts-dev libmtdev-dev libjpeg-dev libfontconfig1-dev libssl-dev libdbus-1-dev libglib2.0-dev libxkbcommon-dev libegl1-mesa-dev libgbm-dev libgles2-mesa-dev mesa-common-dev libasound2-dev libpulse-dev gstreamer1.0-omx libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev  gstreamer1.0-alsa libvpx-dev libsrtp2-dev libsnappy-dev libnss3-dev \"^libxcb.*\" flex bison libxslt-dev ruby gperf libbz2-dev libcups2-dev libatkmm-1.6-dev libxi6 libxcomposite1 libfreetype6-dev libicu-dev libsqlite3-dev libxslt1-dev \n```\n```\nsudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libx11-dev freetds-dev libsqlite3-dev libpq-dev libiodbc2-dev firebird-dev libxext-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync1 libxcb-sync-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxi-dev libdrm-dev libxcb-xinerama0 libxcb-xinerama0-dev libatspi2.0-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxss-dev libxtst-dev libpci-dev libcap-dev libxrandr-dev libdirectfb-dev libaudio-dev libxkbcommon-x11-dev gdbserver\n```\nMake a folder for qt6 installation.\n```\nsudo mkdir /usr/local/qt6\n```\nGrant full access to the fold used for the deployment from Qt Creator. \n```\nsudo chmod 777 /usr/local/bin\n```\nRemember versions of gcc(10.2.1), ld(2.35.2) and ldd(2.31). Source code of the same version should be downloaded to build cross compiler later.\n\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/ba2f1848-0c5c-426d-8d3f-1420931637bd)\n\nAppend following piece of code to the end of ~/.bashrc.\n```\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/\n```\nUpdate the changes.\n```\nsource ~/.bashrc\n```\n# Prepare host\nCreate a virtual machine for Ubuntu 22.04.2 and then update the system.\n```\nsudo apt update\nsudo apt upgrade\n```\nInstall necessary packages.\n```\nsudo apt-get install make build-essential libclang-dev ninja-build gcc git bison python3 gperf pkg-config 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-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libatspi2.0-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev build-essential gawk git texinfo bison file wget libssl-dev gdbserver gdb-multiarch libxcb-cursor-dev\n```\n## Build the lastest CMake from source\n```\ncd ~\ngit clone https://github.com/Kitware/CMake.git\ncd CMake\n./bootstrap \u0026\u0026 make -j8\u0026\u0026 sudo make install\n```\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/e11f4e6c-a4c0-4f03-86dc-b6d463bab80b)\n\nFolder CMake is not need any more. You can delete it.\n\n## Build gcc as a cross compiler\nDownload necessary source code. **You should modify the following commands to your needs.**\nFor the time I make this page, they are:\n* gcc 10.3.0(gcc version 10.2.1 does not exist and use the closest one)\n* binutils 2.35.2(ld version)\n* glibc 2.31(ldd version)\n```\ncd ~\nmkdir gcc_all \u0026\u0026 cd gcc_all\nwget https://ftpmirror.gnu.org/binutils/binutils-2.35.2.tar.bz2\nwget https://ftpmirror.gnu.org/glibc/glibc-2.31.tar.bz2\nwget https://ftpmirror.gnu.org/gcc/gcc-10.3.0/gcc-10.3.0.tar.gz\ngit clone --depth=1 https://github.com/raspberrypi/linux\ntar xf binutils-2.35.2.tar.bz2\ntar xf glibc-2.31.tar.bz2\ntar xf gcc-10.3.0.tar.gz\nrm *.tar.*\ncd gcc-10.3.0\ncontrib/download_prerequisites\n```\nMake a folder for the compiler installation.\n```\nsudo mkdir -p /opt/cross-pi-gcc\nsudo chown $USER /opt/cross-pi-gcc\nexport PATH=/opt/cross-pi-gcc/bin:$PATH\n```\nCopy the kernel headers in the above folder.\n```\ncd ~/gcc_all\ncd linux\nKERNEL=kernel7\nmake ARCH=arm64 INSTALL_HDR_PATH=/opt/cross-pi-gcc/aarch64-linux-gnu headers_install\n```\nBuild Binutils. **You should modify the following commands to your needs.**\n```\ncd ~/gcc_all\nmkdir build-binutils \u0026\u0026 cd build-binutils\n../binutils-2.35.2/configure --prefix=/opt/cross-pi-gcc --target=aarch64-linux-gnu --with-arch=armv8 --disable-multilib\nmake -j 8\nmake install\n```\nEdit gcc-10.3.0/libsanitizer/asan/asan_linux.cpp. Add following piece of code.\n```\n#ifndef PATH_MAX\n#define PATH_MAX 4096\n#endif\n```\n\nDo a partial build of gcc. **You should modify the following commands to your needs.**\n```\ncd ~/gcc_all\nmkdir build-gcc \u0026\u0026 cd build-gcc\n../gcc-10.3.0/configure --prefix=/opt/cross-pi-gcc --target=aarch64-linux-gnu --enable-languages=c,c++ --disable-multilib\nmake -j8 all-gcc\nmake install-gcc\n```\nPartially build Glibc. **You should modify the following commands to your needs.**\n```\ncd ~/gcc_all\nmkdir build-glibc \u0026\u0026 cd build-glibc\n../glibc-2.31/configure --prefix=/opt/cross-pi-gcc/aarch64-linux-gnu --build=$MACHTYPE --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-headers=/opt/cross-pi-gcc/aarch64-linux-gnu/include --disable-multilib libc_cv_forced_unwind=yes\nmake install-bootstrap-headers=yes install-headers\nmake -j8 csu/subdir_lib\ninstall csu/crt1.o csu/crti.o csu/crtn.o /opt/cross-pi-gcc/aarch64-linux-gnu/lib\naarch64-linux-gnu-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross-pi-gcc/aarch64-linux-gnu/lib/libc.so\ntouch /opt/cross-pi-gcc/aarch64-linux-gnu/include/gnu/stubs.h\n```\nBack to gcc.\n```\ncd ~/gcc_all/build-gcc\nmake -j8 all-target-libgcc\nmake install-target-libgcc\n```\nFinish building glibc.\n```\ncd ~/gcc_all/build-glibc\nmake -j8\nmake install\n```\nFinish building gcc.\n```\ncd ~/gcc_all/build-gcc\nmake -j8\nmake install\n```\nAt this point, we have a full cross compiler toolchain with gcc. Folder gcc_all is not need any more. You can delete it.\n\n## Building Qt6\nMake folders for sysroot and qt6.\n```\ncd ~\nmkdir rpi-sysroot rpi-sysroot/usr rpi-sysroot/opt\nmkdir qt6 qt6/host qt6/pi qt6/host-build qt6/pi-build qt6/src\n```\nDownload QtBase source code\n```\ncd ~/qt6/src\nwget https://download.qt.io/official_releases/qt/6.5/6.5.1/submodules/qtbase-everywhere-src-6.5.1.tar.xz\ntar xf qtbase-everywhere-src-6.5.1.tar.xz\n```\n### Build Qt6 for host\n```\ncd $HOME/qt6/host-build/\ncmake ../src/qtbase-everywhere-src-6.5.1/ -GNinja -DCMAKE_BUILD_TYPE=Release -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$HOME/qt6/host\ncmake --build . --parallel 8\ncmake --install .\n```\nBinaries will be in $HOME/qt6/host\n### Build Qt6 for rpi\ncopy and paste a few folders from rpi using rsync through SSH. **You should modify the following commands to your needs.**\n```\ncd ~\nrsync -avz --rsync-path=\"sudo rsync\" pi@192.168.30.77:/usr/include rpi-sysroot/usr\nrsync -avz --rsync-path=\"sudo rsync\" pi@192.168.30.77:/lib rpi-sysroot\nrsync -avz --rsync-path=\"sudo rsync\" pi@192.168.30.77:/usr/lib rpi-sysroot/usr \nrsync -avz --rsync-path=\"sudo rsync\" pi@192.168.30.77:/opt/vc rpi-sysroot/opt\n```\nCreate a file named toolchain.cmake in $HOME/qt6.\n```\ncmake_minimum_required(VERSION 3.18)\ninclude_guard(GLOBAL)\n\nset(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_SYSTEM_PROCESSOR arm)\n\n# You should change location of sysroot to your needs.\nset(TARGET_SYSROOT /home/quang/rpi-sysroot)\nset(TARGET_ARCHITECTURE aarch64-linux-gnu)\nset(CMAKE_SYSROOT ${TARGET_SYSROOT})\n\nset(ENV{PKG_CONFIG_PATH} $PKG_CONFIG_PATH:${CMAKE_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE}/pkgconfig)\nset(ENV{PKG_CONFIG_LIBDIR} /usr/lib/pkgconfig:/usr/share/pkgconfig/:${TARGET_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE}/pkgconfig:${TARGET_SYSROOT}/usr/lib/pkgconfig)\nset(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})\n\nset(CMAKE_C_COMPILER /opt/cross-pi-gcc/bin/${TARGET_ARCHITECTURE}-gcc)\nset(CMAKE_CXX_COMPILER /opt/cross-pi-gcc/bin/${TARGET_ARCHITECTURE}-g++)\n\nset(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -isystem=/usr/include -isystem=/usr/local/include -isystem=/usr/include/${TARGET_ARCHITECTURE}\")\nset(CMAKE_CXX_FLAGS \"${CMAKE_C_FLAGS}\")\n\nset(QT_COMPILER_FLAGS \"-march=armv8-a\")\nset(QT_COMPILER_FLAGS_RELEASE \"-O2 -pipe\")\nset(QT_LINKER_FLAGS \"-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-rpath-link=${TARGET_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE} -Wl,-rpath-link=$HOME/qt6/pi/lib\")\n\nset(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\nset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\nset(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\nset(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)\nset(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)\nset(CMAKE_BUILD_RPATH ${TARGET_SYSROOT})\n\ninclude(CMakeInitializeConfigs)\n\nfunction(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)\n  if (_PREFIX MATCHES \"CMAKE_(C|CXX|ASM)_FLAGS\")\n    set(CMAKE_${CMAKE_MATCH_1}_FLAGS_INIT \"${QT_COMPILER_FLAGS}\")\n        \n    foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)\n      if (DEFINED QT_COMPILER_FLAGS_${config})\n        set(CMAKE_${CMAKE_MATCH_1}_FLAGS_${config}_INIT \"${QT_COMPILER_FLAGS_${config}}\")\n      endif()\n    endforeach()\n  endif()\n\n\n  if (_PREFIX MATCHES \"CMAKE_(SHARED|MODULE|EXE)_LINKER_FLAGS\")\n    foreach (config SHARED MODULE EXE)\n      set(CMAKE_${config}_LINKER_FLAGS_INIT \"${QT_LINKER_FLAGS}\")\n    endforeach()\n  endif()\n\n  _cmake_initialize_per_config_variable(${ARGV})\nendfunction()\n\nset(XCB_PATH_VARIABLE ${TARGET_SYSROOT})\n\nset(GL_INC_DIR ${TARGET_SYSROOT}/usr/include)\nset(GL_LIB_DIR ${TARGET_SYSROOT}:${TARGET_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE}/:${TARGET_SYSROOT}/usr:${TARGET_SYSROOT}/usr/lib)\n\nset(EGL_INCLUDE_DIR ${GL_INC_DIR})\nset(EGL_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libEGL.so)\n\nset(OPENGL_INCLUDE_DIR ${GL_INC_DIR})\nset(OPENGL_opengl_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libOpenGL.so)\n\nset(GLESv2_INCLUDE_DIR ${GL_INC_DIR})\nset(GLIB_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libGLESv2.so)\n\nset(GLESv2_INCLUDE_DIR ${GL_INC_DIR})\nset(GLESv2_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libGLESv2.so)\n\nset(gbm_INCLUDE_DIR ${GL_INC_DIR})\nset(gbm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libgbm.so)\n\nset(Libdrm_INCLUDE_DIR ${GL_INC_DIR})\nset(Libdrm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libdrm.so)\n\nset(XCB_XCB_INCLUDE_DIR ${GL_INC_DIR})\nset(XCB_XCB_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/${TARGET_ARCHITECTURE}/libxcb.so)\n\nlist(APPEND CMAKE_LIBRARY_PATH ${CMAKE_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE})\nlist(APPEND CMAKE_PREFIX_PATH \"/usr/lib/${TARGET_ARCHITECTURE}/cmake\")\n```\nFix absolute symbolic links\n```\ncd ~\nwget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py\nchmod +x sysroot-relativelinks.py \npython3 sysroot-relativelinks.py rpi-sysroot\n```\nCompile source code for rpi.\n```\ncd $HOME/qt6/pi-build\ncmake ../src/qtbase-everywhere-src-6.5.1/ -GNinja -DCMAKE_BUILD_TYPE=Release -DINPUT_opengl=es2 -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DQT_HOST_PATH=$HOME/qt6/host -DCMAKE_STAGING_PREFIX=$HOME/qt6/pi -DCMAKE_INSTALL_PREFIX=/usr/local/qt6 -DCMAKE_TOOLCHAIN_FILE=$HOME/qt6/toolchain.cmake -DQT_QMAKE_TARGET_MKSPEC=devices/linux-rasp-pi4-aarch64 -DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON -DQT_FEATURE_xlib=ON\ncmake --build . --parallel 8\ncmake --install .\n```\nSend the binaries to rpi. **You should modify the following commands to your needs.**\n```\nrsync -avz --rsync-path=\"sudo rsync\" $HOME/qt6/pi/* pi@192.168.30.77:/usr/local/qt6\n```\n## With Qt Creator\nDownload Qt Creator\n```\ncd ~ \nwget https://github.com/qt-creator/qt-creator/releases/download/v10.0.0/qtcreator-linux-x64-10.0.0.deb\nsudo dpkg -i qtcreator-linux-x64-10.0.0.deb \nrm qtcreator-linux-x64-10.0.0.deb \n```\nThen open **Qt Creator** in `/opt/qt-creator/bin`\n\nSet up **Compilers**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/e98645c4-cf99-45e3-a8b4-ecc0899d6fa0)\n\nSet up **Debuggers**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/f75adf17-b8eb-4149-a5fc-cf59978aa3d9)\n\nSet up **Devices**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/57609ea4-6901-41a8-8264-c6bb7aeac844)\n\nClick **Deploy Public Key...** to deploy the key. Create one if not existed.\n\nTest the device.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/9883e600-7963-48e3-98fc-dc3f2e651bff)\n\nSet up **Qt Versions**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/6c43b6f0-a256-4d2d-86f6-80bb393602af)\n\nSet up **Kits**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/93e04b07-7cbc-43d6-a17c-53fe6d272de9)\n\nOn **CMake Configuration** opton, click Change and add follow commands. **You should modify the following commands to your needs.**\n```\n-DCMAKE_TOOLCHAIN_FILE:UNINITIALIZED=/home/quang/qt6/pi/lib/cmake/Qt6/qt.toolchain.cmake\n```\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/d7c4600a-7058-4541-bdfd-ce184e7fd94c)\n\n## Test HelloWorld\nOn **Help** option select **About Plugins**.Then uncheck **ClangCodeModel**(**No need for Qt Creator 10 or later**)..\n\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/efb1db08-c5cc-4210-adfe-85507e36d329)\n\nAppend following piece of code to the end of CMakeLists.txt(**No need for Qt Creator 10 or later**).\n```\ninstall(TARGETS HelloWorld\n    RUNTIME DESTINATION \"\"\n    BUNDLE DESTINATION \"\"\n    LIBRARY DESTINATION \"\"\n)\n```\nGoto **Projects**\nUnder **Run** section, on **X11 Forwarding** check **Forward to local display** and input :0 to the text field. \n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/b396954b-fb04-48ae-a3c4-8ae67178513e)\n\nUnder **Environment** section, click **Details** to expand the environment option. Click **Add**, then on **Variable** column type **LD_LIBRARY_PATH**. On the **Value** column, type **:/usr/local/qt6/lib/**.\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/059f275c-bfa4-4357-b4b6-82880b5c1054)\n\nRun.\n\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/ee26ad77-f370-433b-8734-89e70c21903c)\n\nWe have HelloWorld running on rpi now.\n## Add QML module\n\u003e [!TIP]\n\u003e - ***Create a copy of the host-build and pi-build folders.***\n\u003e - ***It is recommended to start copying from the block below.***\n\nDownload source code.\n```\ncd ~/qt6/src\nwget https://download.qt.io/official_releases/qt/6.5/6.5.1/submodules/qtshadertools-everywhere-src-6.5.1.tar.xz\ntar xf qtshadertools-everywhere-src-6.5.1.tar.xz\nwget https://download.qt.io/official_releases/qt/6.5/6.5.1/submodules/qtdeclarative-everywhere-src-6.5.1.tar.xz\ntar xf qtdeclarative-everywhere-src-6.5.1.tar.xz\n```\nYou can check dependencies at ~/qt6/src/qtdeclarative-everywhere-src-6.5.1/dependencies.yaml and ~/qt6/src/qtshadertools-everywhere-src-6.5.1/dependencies.yaml\nMake sure required modules should be built and installed first. \n\nBuild the modules for host\n```\ncd ~/qt6/host-build\nrm -rf *\n$HOME/qt6/host/bin/qt-configure-module ../src/qtshadertools-everywhere-src-6.5.1\ncmake --build . --parallel 8\ncmake --install .\nrm -rf *\n$HOME/qt6/host/bin/qt-configure-module ../src/qtdeclarative-everywhere-src-6.5.1\ncmake --build . --parallel 8\ncmake --install .\n```\nBuild the modules for rpi\n```\ncd ~/qt6/pi-build\nrm -rf *\n$HOME/qt6/pi/bin/qt-configure-module ../src/qtshadertools-everywhere-src-6.5.1\ncmake --build . --parallel 8\ncmake --install .\nrm -rf *\n$HOME/qt6/pi/bin/qt-configure-module ../src/qtdeclarative-everywhere-src-6.5.1\ncmake --build . --parallel 8\ncmake --install .\n```\nSend the binaries to rpi. **You should modify the following commands to your needs.**\n```\nrsync -avz --rsync-path=\"sudo rsync\" $HOME/qt6/pi/* pi@192.168.30.77:/usr/local/qt6\n```\n## Test HelloWorldQml\n***Create Project -\u003e Select Qt Quick Application to enable QML project***\n![image](https://github.com/MuyePan/CrossCompileQtForRpi/assets/136073506/f67fd349-3537-42f0-8e15-244f138a09d4)\n\u003e [!IMPORTANT]\n\u003e * Each new project\n\u003e     * Under **Run** section, on **X11 Forwarding** check **Forward to local display** and input :0 to the text field. \n\u003e     * Under **Environment** section, click **Details** to expand the environment option. Click **Add**, then on **Variable** column type **LD_LIBRARY_PATH**. On the **Value** column, type **:/usr/local/qt6/lib/**.\n\u003e       ```\n\u003e       LD_LIBRARY_PATH\n\u003e       ```\n\u003e       ```\n\u003e       :/usr/local/qt6/lib\n\u003e        ```\n\u003e       ```\n\u003e       LD_LIBRARY_PATH = :/usr/local/qt6/lib\n\u003e       ```\n\n\n\n---\nOnce everything is set up, each time you build in Qt Creator, the build output will automatically appear in `/usr/local/bin` on the Raspberry Pi OS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledangquangdangquang%2Fcrosscompilation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fledangquangdangquang%2Fcrosscompilation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledangquangdangquang%2Fcrosscompilation/lists"}