altcross-2stage: check if newly build compilers work

This commit is contained in:
Алексей Шепляков 2022-06-05 17:50:08 +04:00
parent 1d6ac898e2
commit 12166953e9
3 changed files with 25 additions and 0 deletions

View File

@ -166,3 +166,16 @@ mv $BUILDDIR/specs "$INSTALLDIR/lib/gcc/$TARGET/${GCC_MAJOR_VERSION}/"
# relocate libgcc_s
mv $INSTALLDIR/lib/gcc/$TARGET/lib64/libgcc_s.so* "$INSTALLDIR/lib/gcc/$TARGET/${GCC_MAJOR_VERSION}/"
rmdir "$INSTALLDIR/lib/gcc/$TARGET/lib64"
$INSTALLDIR/bin/${target}-gcc -o ${BUILDDIR}/hello_c hello.c || exit 2
$INSTALLDIR/bin/${target}-g++ -o ${BUILDDIR}/hello_cpp hello.cpp || exit 3
gcc_runtime_libdir=`$INSTALLDIR/bin/${target}-gcc --print-libgcc-file-name`
gcc_runtime_libdir="${gcc_runtime_libdir%/*}"
env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \
qemu-${arch}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_c || exit 5
env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \
qemu-${arch}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_cpp || exit 7

6
hello.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello, %s!\n", argc > 1 ? argv[1] : "world");
return 0;
}

6
hello.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main(int argc, char** argv) {
std::cout << "Hello, " << (argc > 1 ? argv[1] : "world") << '!' << std::endl;
return 0;
}