Skip to content

Instantly share code, notes, and snippets.

@carloswherbet
Forked from Jokymon/crossbuild_qt5_for_rpi.sh
Last active August 29, 2015 14:25
Show Gist options
  • Save carloswherbet/842b71d0cec8ff78a3fb to your computer and use it in GitHub Desktop.
Save carloswherbet/842b71d0cec8ff78a3fb to your computer and use it in GitHub Desktop.

Revisions

  1. @Jokymon Jokymon revised this gist Nov 17, 2014. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions crossbuild_qt5_for_rpi.sh
    Original file line number Diff line number Diff line change
    @@ -21,9 +21,9 @@ cd qt-on-raspberry
    wget http://downloads.raspberrypi.org/raspbian_latest
    mv raspbian_latest raspbian_latest.zip
    unzip raspbian_latest.zip
    sudo mkdir $(ROOTFS_MOUNT)
    sudo mkdir $ROOTFS_MOUNT
    # The offset is probably always the same due to the requirements for RaspberryPi SD Cards
    sudo mount -o loop,offset=62914560 2014-09-09-wheezy-raspbian.img $(ROOTFS_MOUNT)
    sudo mount -o loop,offset=62914560 2014-09-09-wheezy-raspbian.img $ROOTFS_MOUNT

    ### Get the Qt sources and cross compilation scripts
    git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git
    @@ -34,7 +34,7 @@ cd ..

    ### Fix symlinks and lib paths in the mounted rootfs
    cd cross-compile-tools
    sudo ./fixQualifiedLibraryPaths $(ROOTFS_MOUNT) ~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
    sudo ./fixQualifiedLibraryPaths $ROOTFS_MOUNT ~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
    cd ..

    ### Compiling qtbase
    @@ -48,8 +48,8 @@ cd ..
    ### Compile other packages
    for MODULE in qtimageformats qtsvg qtscript qtxmlpatterns qtdeclarative qtsensors qtgraphicaleffects qtlocation qtserialport qttools qtquick1 qtquickcontrols
    do
    cd $(MODULE)
    $(PREFIX)/bin/qmake .
    cd $MODULE
    $PREFIX/bin/qmake .
    make -j4
    sudo make install
    cd ..
    @@ -58,4 +58,4 @@ done
    ### Finish the modified Raspbian image
    cd ..
    sync
    sudo umount $(ROOTFS_MOUNT)
    sudo umount $ROOTFS_MOUNT
  2. @Jokymon Jokymon created this gist Oct 2, 2014.
    61 changes: 61 additions & 0 deletions crossbuild_qt5_for_rpi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    set -e

    PREFIX=~/opt/qt5pi
    ROOTFS_MOUNT=/mnt/rasp-pi-rootfs

    # On Ubuntu 14.04 do the following first to get the ia32-lib
    if [ `lsb_release -ds` -eq "Ubuntu 14.04 LTS" ]
    sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
    fi

    ### Get the RaspberryPi cross compilation tools
    git clone https://github.com/raspberrypi/tools.git
    mv tools rpi-tools

    ### Create the environment for building our cross compiled Qt
    mkdir qt-on-raspberry
    cd qt-on-raspberry

    ### Get the root file system and mount it
    # Get the latest Raspbian image
    wget http://downloads.raspberrypi.org/raspbian_latest
    mv raspbian_latest raspbian_latest.zip
    unzip raspbian_latest.zip
    sudo mkdir $(ROOTFS_MOUNT)
    # The offset is probably always the same due to the requirements for RaspberryPi SD Cards
    sudo mount -o loop,offset=62914560 2014-09-09-wheezy-raspbian.img $(ROOTFS_MOUNT)

    ### Get the Qt sources and cross compilation scripts
    git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git
    git clone git://gitorious.org/qt/qt5.git
    cd qt5
    ./init-repository
    cd ..

    ### Fix symlinks and lib paths in the mounted rootfs
    cd cross-compile-tools
    sudo ./fixQualifiedLibraryPaths $(ROOTFS_MOUNT) ~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
    cd ..

    ### Compiling qtbase
    cd qt5/qtbase
    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot $(ROOTFS_MOUNT) -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix $(PREFIX)
    make -j4
    sudo make install
    cd ..


    ### Compile other packages
    for MODULE in qtimageformats qtsvg qtscript qtxmlpatterns qtdeclarative qtsensors qtgraphicaleffects qtlocation qtserialport qttools qtquick1 qtquickcontrols
    do
    cd $(MODULE)
    $(PREFIX)/bin/qmake .
    make -j4
    sudo make install
    cd ..
    done

    ### Finish the modified Raspbian image
    cd ..
    sync
    sudo umount $(ROOTFS_MOUNT)