From 519dd0f9820568e499fae141967dbb05b70e6e37 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Wed, 9 Jun 2021 17:09:54 +0000 Subject: [PATCH] Extended %check so it actually runs 'hello world' binaries --- cross-toolchain.spec | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cross-toolchain.spec b/cross-toolchain.spec index ab4d745..ffcc4fe 100644 --- a/cross-toolchain.spec +++ b/cross-toolchain.spec @@ -1,6 +1,7 @@ %define target aarch64-linux-gnu %define target_kernel arm64 +%define target_qemu_arch aarch64 %define gcc_branch 8 Name: cross-gcc%gcc_branch-%target @@ -28,6 +29,7 @@ BuildRequires: gcc-source = %version-%orig_gcc_release BuildRequires: binutils-source = %binutils_evr BuildRequires: glibc-source = %glibc_evr BuildRequires: kernel-source-%kernel_version +BuildRequires: qemu-user-static-%target_qemu_arch %define _libexecdir /usr/libexec @@ -228,9 +230,19 @@ int main(int argc, char** argv) { } EOF +gcc_runtime_libdir=`dirname $(%buildroot%prefix/bin/%target-gcc --print-libgcc-file-name)` + %buildroot%prefix/bin/%target-gcc -o hello_c hello.c || exit 2 %buildroot%prefix/bin/%target-g++ -o hello_cpp hello.cpp || exit 3 +# Note: LD_LIBRARY_PATH is for **target** ld.so. +# Use qemu-user-static so qemu-user is not affected by LD_LIBRARY_PATH +env LD_LIBRARY_PATH=%buildroot%sysroot/lib64:${gcc_runtime_libdir} \ + qemu-%target_qemu_arch-static -L %buildroot%sysroot ./hello_c || exit 5 + +env LD_LIBRARY_PATH=%buildroot%sysroot/lib64:${gcc_runtime_libdir} \ + qemu-%target_qemu_arch-static -L %buildroot%sysroot ./hello_cpp || exit 7 + %files %_bindir/* %prefix/lib/gcc/%target/%gcc_branch/*