From 270192250abe27447b878370ee33fc8f08b230ef Mon Sep 17 00:00:00 2001 From: Ray-V Date: Tue, 2 Apr 2019 11:02:10 +0100 Subject: [PATCH] Patched FindTQt.cmake to allow pre-defined executables - TDE commit cf2e8d2857 Added config.{guess,sub} to libtool updating for aarch64 recognition --- cross-compiling-TDE-for-the-RPi3.html | 277 ++++++++++---------------- 1 file changed, 105 insertions(+), 172 deletions(-) diff --git a/cross-compiling-TDE-for-the-RPi3.html b/cross-compiling-TDE-for-the-RPi3.html index b21841a..0fa6317 100755 --- a/cross-compiling-TDE-for-the-RPi3.html +++ b/cross-compiling-TDE-for-the-RPi3.html @@ -210,7 +210,7 @@ export TARGET="arm-linux-gnueabihf" export SYSROOT_REPO=/path_to_Slackware_arm_current_libs_headers_installation_directory
-OR: +## OR:
## 64-bit
@@ -222,12 +222,30 @@ export PiARCH="armv8-a+crc" export TUNE="cortex-a53" export MACH_OPTS="--with-arch=$PiARCH --with-cpu=$TUNE" export glibcMACH_OPTS="--with-arch=$PiARCH --with-tune=$TUNE" -## Set target - building cross compiler to run on x86 to build for target arm +## Set target - building cross compiler to run on x86 to build for target aarch64 export TARGET="aarch64-linux-gnu" ## for SYSROOT location - option [2] in setting up the build environment export SYSROOT_REPO=/path_to_Slarm64_libs_headers_installation_directory

+## Set variables for local paths: +
+## where the source archives are: +export R1405_SRC=/path/to/R14.0.5/source/archives +export MISC_SRC=/path/to/misc/source/archives + +## where the Slackware packages a-y directories are: +export Slack_base=/path/to/Slackware/a-y_directories + +

+## Set installation directories +
+## for cross compiler +export XGCC_DIR=/opt/cross-pi-gcc +## for sysroot +export SYSROOT=$XGCC_DIR/sysroot + +


@@ -255,12 +273,6 @@ The cross compiler is built in this tree: │   └── build-glibc └── pkg DESTDIR for creating package -## Set installation directories -## for x-compiler -export XGCC_DIR=/opt/cross-pi-gcc -## for sysroot -export SYSROOT=$XGCC_DIR/sysroot - mkdir -p /tmp/xgcc/{gcc-8,build_all} cd /tmp/xgcc/gcc-8 @@ -309,8 +321,10 @@ ln -s ../../gcc-8/gmp-6.1.2.tar.xz . ln -s ../../gcc-8/mpc-1.1.0.tar.gz . ln -s ../../gcc-8/mpfr-4.0.2.tar.xz . ln -s ../../gcc-8/isl-0.18.tar.bz2 . + ## Update the prerequisites versions sed -i 's|6.1.0.tar.bz2|6.1.2.tar.xz|;s|mpfr-3.1.4.tar.bz2|mpfr-4.0.2.tar.xz|;s|0.16.1|0.18|;s|1.0.3|1.1.0|' contrib/download_prerequisites + ## Set up the gcc build environment contrib/download_prerequisites --no-verify @@ -332,7 +346,7 @@ cd ../build-gcc make -j4 all-gcc make install-gcc -## Add the cross compiler folder to the path for building glibc +## Add the cross compiler binaries to the path for building glibc ## Prevents "__INT64_C" redefined and "__ARM_ARCH" is not defined errors. ## It also contains $TARGET-strip which is used to strip the glibc executables and libs. export PATH=$XGCC_DIR/bin:$PATH @@ -407,17 +421,14 @@ rm -rf /tmp/xgcc

close This is not directly related to cross compiling TDE for aarch64, but will be needed for setting up the RPi3 to run a 64-bit system. -The kernel, modules and blobs can be used for a 32-bit system. -This build uses 64-bit options even if this kernel will be used for a 32-bit system. -## Set variables if not continuing from previous section -export XGCC_DIR=${XGCC_DIR:-/opt/cross-pi-gcc} -export SYSROOT=${SYSROOT:-$XGCC_DIR/sysroot} -export PATH=$XGCC_DIR/bin:$PATH - -## To keep track of where stuff is installed use the package management system - delete the cross-compiler build installation directory and re-install from the package created +64-bit options are used even if this kernel, modules and blobs will be used for a 32-bit system. +## To keep track of where stuff is installed use the package management system - delete the cross-compiler build installation directory and re-install from the package created rm -rf $XGCC_DIR installpkg /tmp/xgcc830-glibc2.29-*_RPi_headers-en_GB-aarch64.txz +## Set PATH to include cross-compiler if not continuing from previous section +[[ ! $PATH == *$XGCC_DIR/bin* ]] && export PATH=$XGCC_DIR/bin:$PATH + cd /tmp/linux ## Create .config @@ -426,7 +437,7 @@ installpkg /tmp/xgcc830-glibc2.29-*_RPi_headers-en_GB-aarch64.txz ## Build the kernel make -j4 Image ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -## Tail end of screen output shows: +## Tail end of screen output shows where the kernel is: # SYSMAP System.map # OBJCOPY arch/arm64/boot/Image @@ -460,8 +471,6 @@ As detailed in … build qemu  Required to run arm binaries used during the cross compilation - for example tquic and tde-config.
close - -Build cd /tmp wget https://download.qemu.org/qemu-2.12.1.tar.xz @@ -471,7 +480,8 @@ cd qemu-2.12.1/ mkdir build cd build -## Only the one target is needed for the LSB binaries required for the RPi3, and most other options are not required for this particular use. +## Only the one target is needed for the LSB binaries required for the RPi3, +## and most other options are not required for this particular use. ## There is no need to build qemu-static because qemu will be built and run within this environment. export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin @@ -568,13 +578,8 @@ To keep track of where stuff is installed use the package management system - de rm -rf $XGCC_DIR installpkg /tmp/xgcc830-glibc2.29-${K_VER}_RPi_headers-en_GB-$ARM.txz -## Set variables -## where the x-compiler package has been built to install to -export XGCC_DIR=${XGCC_DIR:-/opt/cross-pi-gcc} -## where the sysroot has been set in the x-compiler tree -export SYSROOT=${SYSROOT:-$XGCC_DIR/sysroot} -## and the triple for the host system - RPi3 - for the builds that use the original differentiation between host and target -export HOST=$TARGET +## Set HOST for the host system - RPi3 - for the builds that use the original differentiation between host and target +export HOST=$TARGET ## Set the variables for the TDE packages builds export SLKLDFLAGS="" @@ -591,12 +596,6 @@ export SYS_CNF_DIR="/etc/trinity" export TDE_VERSION=R14.0.5 export BUILD=1 export I18N=en_GB -## Source directories -export R1405_SRC=/path/to/R14.0.5/source/archives -export MISC_SRC=/path/to/misc/source/archives - -## Slack_base = where the Slackware packages a-y directories are: -export Slack_base=/path/to/Sla... ## ldconfig is not going to be used during arm packages installaion because it's an x86 binary, ## nor is /etc/ld.so.conf going to be updated, @@ -616,22 +615,24 @@ mount -B $SYSROOT_REPO $SYSROOT ln -sf $MISC_SRC/* $SYSROOT/src/ ln -sf $R1405_SRC/* $SYSROOT/src/ -## only need qemu-$ARM from the qemu installation - just place it somewhere the kernel can find it +## only need qemu-$ARM from the qemu installation - just place it somewhere the kernel can find it … mkdir -p $SYSROOT/x86 cp /tmp/qemu-temp/usr/local/bin/qemu-$ARM $SYSROOT/x86 rm -rf /tmp/qemu* -## Load the arm interpreter +## … and load the arm interpreter modprobe binfmt_misc mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc [[ $ARM == aarch64 ]] && \ -echo ":arm:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:$SYSROOT/x86/qemu-$ARM:" > /proc/sys/fs/binfmt_misc/register || \ +echo ":arm:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:$SYSROOT/x86/qemu-$ARM:" > /proc/sys/fs/binfmt_misc/register \ +|| \ echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:$SYSROOT/x86/qemu-$ARM:" > /proc/sys/fs/binfmt_misc/register ## let qemu know where the target libraries are export QEMU_LD_PREFIX=$SYSROOT + ## Install all packages needed to build the required TDE packages. ## SYSROOT is not a functioning system, it's just a repository for arm libs and headers required for cross compiling. ## move ldconfig out of the way - links will be set up by doinst.sh @@ -790,29 +791,54 @@ makepkg --linkadd y --chown n $OUTPUT/$PRGNAM-$VERSION-$ARM-$BUILD.txz ltoolupdate_fn () { +{ ## look in SYSROOT for headers and libs sed -i "s|/usr/include|$SYSROOT&|g" admin/acinclude.m4.in sed -i "s|/usr/lib|$SYSROOT/usr/lib$LIBDIRSUFFIX|g" admin/acinclude.m4.in ## correct the variable name in error message sed -i "s|variable UIC to|variable UIC_PATH to|" admin/acinclude.m4.in +## include updating config.{guess,sub} for libart-lgpl and misc builds +[[ -d admin ]] && ADMIN=admin/ || ADMIN="" +cp /$(grep -h config.guess /var/log/packages/libtool*) ./$ADMIN +cp /$(grep -h config.sub /var/log/packages/libtool*) ./$ADMIN cp /$(grep -h ltmain.sh /var/log/packages/libtool*) admin/ cp /$(grep -h libtool.m4 /var/log/packages/libtool*) admin/libtool.m4.in cp /$(grep -h missing /var/log/packages/libtool*) admin/ make -f admin/Makefile.common +} 2>/dev/null } FindTQt-patch_fn () { ## allow tqmoc path to be pre-defined +## https://mirror.git.trinitydesktop.org/gitea/TDE/tde-common-cmake/issues/29 +## commit cf2e8d2857 echo $'--- cmake/modules/FindTQt.cmake +++ cmake/modules/FindTQt.cmake -@@ -34,0 +35 @@ -+if( NOT DEFINED MOC_EXECUTABLE ) -@@ -38 +39 @@ -- -+endif( NOT DEFINED MOC_EXECUTABLE )' | while read line +@@ -21,0 +22,6 @@ ++mark_as_advanced( ++ TMOC_EXECUTABLE ++ MOC_EXECUTABLE ++ UIC_EXECUTABLE ++) ++ +@@ -25 +31,3 @@ +- OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ OUTPUT_VARIABLE TMOC_EXECUTABLE ++ CACHE FILEPATH "TQt tmoc executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) +@@ -37 +45,3 @@ +- OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ OUTPUT_VARIABLE MOC_EXECUTABLE ++ CACHE FILEPATH "TQt moc executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) +@@ -49 +59,3 @@ +- OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ OUTPUT_VARIABLE UIC_EXECUTABLE ++ CACHE FILEPATH "TQt uic executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE )' | while read line do patch -p0 done @@ -845,16 +871,14 @@ echo " set(CMAKE_SYSTEM_NAME Linux) … tqmoc and meinproc x86 binaries  The cross compiling build time can be reduced by using x86 versions of tqmoc and meinproc which produce ARCH independent ouput. The figures for the tdebase build demonstrate how much quicker a build can be.
close -tqmoc is taken from a pre-built tqt3 x86 package. - -meinproc with its associated x86 TDE libs is set up from pre-built x86 packages. +tqmoc, and meinproc with its associated x86 TDE libs, are taken from pre-built TDE x86 packages. Variables for pre-built x86 packages - these were built to install to /opt/tde on a 64-bit system INSTALL_TDE_x86="/opt/tde" LIBDIRSUFFIX_x86="64" ## Install x86 packages to temporary location on BUILD system -cd /location_of_packages -ROOT=/tmp/x86/ installpkg tqt3-R14.0.5-x86_64-*.txz tqtinterface-R14.0.5-x86_64-*.txz dbus-1-tqt-R14.0.5-x86_64-*.txz tdelibs-R14.0.5-x86_64-*.txz libart_lgpl-R14.0.5-x86_64-*.txz +cd /location_of_pre-built_TDE_x86_packages +ROOT=/tmp/x86/ installpkg tqt3-R14.0.5-x86_64-*.txz tqtinterface-R14.0.5-x86_64-*.txz dbus-1-tqt-R14.0.5-x86_64-*.txz tdelibs-R14.0.5-x86_64-*.txz libart*lgpl-R14.0.5-x86_64-*.txz ## Copy tqmoc, and meinproc and its dependent libraries, to a convenient location, $SYSROOT/x86 cd $SYSROOT/x86 @@ -869,6 +893,10 @@ rm -rf /tmp/x86* ## Add an RPATH so meinproc will use these libraries patchelf --force-rpath --set-rpath $SYSROOT/x86 $SYSROOT/x86/meinproc patchelf --force-rpath --set-rpath $SYSROOT/x86 $SYSROOT/x86/libtdecore.so.14.0.0 + +## copy the x86 meinproc to TDE installation directory - it's fussy about its location, producing parsing errors otherwise. +mkdir -p $INSTALL_TDE/bin +cp $SYSROOT/x86/meinproc $INSTALL_TDE/bin/meinproc-x86 close
@@ -915,9 +943,9 @@ mv mkspecs/linux-g++ ../ rm -rf mkspecs/* mv ../linux-g++ mkspecs/ -## RPATH is to be set as $ORIGIN/../lib$LIBDIRSUFFIX, so don't need absolute libs directory built in: -## Allow setting CC/CXX for linux-g++/qmake.conf -## Set correct paths for includes and libs +## RPATH is to be set as $ORIGIN/../lib$LIBDIRSUFFIX, so don't need absolute libs directory built in - +## Allow setting CC/CXX for linux-g++/qmake.conf - +## Set correct paths for includes and libs - echo $'--- mkspecs/linux-g++/qmake.conf +++ mkspecs/linux-g++/qmake.conf @@ -11 +11 @@ @@ -1148,11 +1176,12 @@ if [ -d usr/share/icons/hicolor ]; then fi EOINS - -makepkg_fn + +makepkg_fn ## move ldconfig out of the way - links will be set up by doinst.sh mv /sbin/ldconfig /sbin/ldconfig-bak + ## install to '/' for TDE binaries installpkg $OUTPUT/$PRGNAM-$VERSION-$ARM-$BUILD.txz ## and install to SYSROOT for TDE headers and libs @@ -1424,7 +1453,7 @@ ROOT=$SYSROOT installpkg $OUTPUT/$PRGNAM-$VERSION-$ARM-$BUILD.txz
-… libart_lgpl   +… libart-lgpl  
close cd / @@ -1441,25 +1470,7 @@ mkdir $TMP/tmp-$PRGNAM SUB_DIR=dependencies/ untar_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -3996 +3996 @@ -- -+<<'comment' -@@ -4010 +4009,0 @@ -- -@@ -4011,0 +4011,3 @@ -+comment -+ac_cv_host=aarch64-linux-gnu -+" | while read line -do -patch -p0 -done -} +ltoolupdate_fn chown_fn @@ -1610,9 +1621,8 @@ FindTQt-patch_fn cd_builddir_fn -## Add exitcodes for try_run tests which produce a cmake error when x-compiling -## Need to set CMAKE_CROSSCOMPILING_EMULATOR for try_run tests to run successfully when x-compiling -## However there are then glibc conflict errors, so set exitcodes to values that a native build would give +## Add exitcodes for try_run tests which produce a cmake error when x-compiling, unless CMAKE_CROSSCOMPILING_EMULATOR is set +## Set exitcodes to values that a native build would give ## Additionally, command line '-D HAVE_xxxxx_EXITCODE:STRING=x' option fails with cmake 3.12, so these builds use cmake 3.10 ## rm -rf $TMP/tmp-$PRGNAM/$SUB_DIR$PRGNAM/build-$PRGNAM/* cmake-toolchain_fn @@ -1652,9 +1662,9 @@ cmake-toolchain_fn -Wno-dev \ .. +## Modify paths so that SYSROOT headers and libs are used, to avoid this error: ## error: /usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such file or directory -## Modify paths so that SYSROOT headers and libs are used -## The alternative is to modify FindPkgConfig.cmake to prefix the INCLUDEDIR and LIBDIR results with ${CMAKE_SYSROOT}, but as this issue only surfaces here, that's probably not worth doing. +## The alternative is to modify FindPkgConfig.cmake to prefix the INCLUDEDIR and LIBDIR results with ${CMAKE_SYSROOT}, but as this issue only surfaces here and that's a system file, let's keep the change local: sed -i "s|=/usr/include|=$SYSROOT/usr/include|" CMakeCache.txt sed -i "s|=/usr/lib$LIBDIRSUFFIX|=$SYSROOT/usr/lib$LIBDIRSUFFIX|" CMakeCache.txt @@ -1710,11 +1720,7 @@ sed -i "s|;/usr|;$SYSROOT/usr|" {,$SYSROOT}$INSTALL_TDE/share/cmake/tdelibs.cmak … tdebase  
close - -## copy the x86 meinproc to TDE installation directory - it's fussy about its location, producing parsing errors otherwise. -cp $SYSROOT/x86/meinproc $INSTALL_TDE/bin/meinproc-x86 - -cd / +cd / PRGNAM=tdebase VERSION=$TDE_VERSION BUILD=$BUILD @@ -1882,8 +1888,8 @@ make DESTDIR=$PKG install sed -i "s|$SYSROOT||" $PKG$INSTALL_TDE/bin/khc_htsearch.pl strip_fn - -## Add xinitrc: + +## Add xinitrc: mkdir -p $PKG/etc/X11/xinit echo $"#!""/bin/sh @@ -2130,8 +2136,8 @@ sed -i 's|source /etc/profile.d/mc.sh|#source /etc/profile.d/mc.sh|' \$HOME/.bas echo "## set default runlevel to 4 for tdm sed -i 's|id:[1-5]|id:4|' etc/inittab " >> $PKG/install/doinst.sh - -makepkg_fn + +makepkg_fn installpkg $OUTPUT/$PRGNAM-$VERSION-$ARM-$BUILD.txz ROOT=$SYSROOT installpkg $OUTPUT/$PRGNAM-$VERSION-$ARM-$BUILD.txz @@ -2142,7 +2148,7 @@ sed -i "s|\"$INSTALL_TDE|\"$SYSROOT$INSTALL_TDE|g" {,$SYSROOT}$INSTALL_TDE/share Build times = 19:59 on x86_64 for x86_64 -= 21:02 on x86_64 for RPi3 using tqmoc and meinproc x86_64 binaries += 24:02 on x86_64 for RPi3 using tqmoc and meinproc x86_64 binaries = 33:01 on x86_64 for RPi3 with tqmoc x86_64 & meinproc arm = 49:01 on RPi3 for RPi3 @@ -2821,25 +2827,9 @@ do patch -p0 done +ltoolupdate_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -3113,0 +3114 @@ -+<<'comment' -@@ -3127,0 +3129,2 @@ -+comment -+ac_cv_host=aarch64-linux-gnu" | while read line -do -patch -p0 -done -} - - -chown_fn +chown_fn cd_builddir_fn @@ -3147,22 +3137,6 @@ untar_fn ltoolupdate_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -2944,0 +2945 @@ -+<<'comment' -@@ -2961,0 +2963,2 @@ -+comment -+ac_cv_host=aarch64-linux-gnu" | while read line -do -patch -p0 -done -} - chown_fn cd_builddir_fn @@ -3245,22 +3219,6 @@ untar_fn ltoolupdate_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -2809,0 +2810 @@ -+<<'comment' -@@ -2826,0 +2828,2 @@ -+comment -+ac_cv_host=aarch64-linux-gnu" | while read line -do -patch -p0 -done -} - chown_fn cd_builddir_fn @@ -3348,22 +3306,6 @@ sed -i "s|SUBDIRS=.*$|SUBDIRS=$langs|" translations/Makefile.am ltoolupdate_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -2825,0 +2826 @@ -+<<'comment' -@@ -2842,0 +2844,2 @@ -+comment -+ac_cv_host=aarch64-linux-gnu" | while read line -do -patch -p0 -done -} - chown_fn cd_builddir_fn @@ -3441,22 +3383,6 @@ sed -i 's| ru||' doc/Makefile.am ltoolupdate_fn -## configure error: -## checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized -## Use a work-around - remove the test and force 'aarch64' recognition: -[[ $ARM == aarch64 ]] && { -echo $"--- configure -+++ configure -@@ -2918,0 +2919 @@ -+<<'comment' -@@ -2935,0 +2937,2 @@ -+comment -+ac_cv_host=aarch64-linux-gnu" | while read line -do -patch -p0 -done -} - chown_fn cd_builddir_fn @@ -3507,8 +3433,15 @@ makepkg_fn

- - +
+ +The source for this page is in the gh-pages branch of tde-slackbuilds: +
+git clone https://github.com/Ray-V/tde-slackbuilds.git +cd tde-slackbuilds +git checkout gh-pages + +