diff --git a/altcross-2stage.sh b/altcross-2stage.sh index 1c68f62..a225dca 100755 --- a/altcross-2stage.sh +++ b/altcross-2stage.sh @@ -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 + diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..8b1aa7d --- /dev/null +++ b/hello.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("Hello, %s!\n", argc > 1 ? argv[1] : "world"); + return 0; +} diff --git a/hello.cpp b/hello.cpp new file mode 100644 index 0000000..e5339d8 --- /dev/null +++ b/hello.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char** argv) { + std::cout << "Hello, " << (argc > 1 ? argv[1] : "world") << '!' << std::endl; + return 0; +}