Hello-world examples recipe does not compile

I have recently installed OpenEmbedded by following this tutorial and have managed to build the reference minimal image for the verdin-imx8mm without errors.
I’ve followed this other tutorial to create a new meta layer and add a recipe for a simple Hello World application. I get the following warnning when executing bitbake:

NOTE: Tasks Summary: Attempted 686 tasks of which 670 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

Summary: There was 1 WARNING message shown.

I have checked the files and although the output only shows a warning and not an error, the hello world binary has not been generated. Therefore, I have tried to directly execute the compilation file run.do_compile and when doing so it gave me the following error:

./run.do_compile: 105: aarch64-tdx-linux-g ++: not found
WARNING: exit code 127 from a shell command.

The compiler is inside my build in the path
./tmp/sysroots-components/x86_64/gcc-cross-aarch64/usr/bin/aarch64-tdx-linux/aarch64-tdx-linux-g++

Therefore, and having followed all the steps in the tutorials, I imagine that somewhere there is a lack of declaring a variable to indicate the path where the compiler is located. Could someone tell me where that variable should be declared? Shouldn’t the export file (which runs just before the bitbake command) set all the toolchain paths correctly?

Hi @jbruno !

I followed the same steps as you, trying to reproduce your issue, but I was able to produce the ipk package from the hello-world recipe, just like the tutorial. I did it for BSP 5.

So, I have some questions:

  • Which BSP version are you using?
  • Are you using a host OS that is compatible with Yocto (for BSP 5, it is Yocto 3.1 LTS)?
    • (I don’t know if you would be able to build an entire OS if your host OS weren’t compatible… but just in case)
  • Looking at your error output, there is a space between aarch64-tdx-linux-g and ++, which is very odd. Would be possible that your setup/installation isn’t somewhat ““healthy””?

Best regards,

Hi @henrique.tx !
Thank you very much for your interest and for your time to try to replicate this issue. In response to your questions:

  • I am using BSP 5.4 with Yocto 3.1 dunfell.
  • On my host computer I am using 20.04.1-Ubuntu.
  • When copying and pasting a space character has slipped into me. The correct thing would be aarch64-tdx-linux-g ++.
    I understand that you have been able to generate the binary of the hello world example. You could take a look at the run.do_compile file and see if you find any difference from the one I copy below.
#!/bin/sh

# Emit a useful diagnostic if something fails:
bb_exit_handler() {
    ret=$?
    case $ret in
    0)  ;;
    *)  case $BASH_VERSION in
        "") echo "WARNING: exit code $ret from a shell command.";;
        *)  echo "WARNING: ${BASH_SOURCE[0]}:${BASH_LINENO[0]} exit $ret from '$BASH_COMMAND'";;
        esac
        exit $ret
    esac
}
trap 'bb_exit_handler' 0
set -e
export AR="aarch64-tdx-linux-gcc-ar"
export AS="aarch64-tdx-linux-as "
export BUILD_AR="ar"
export BUILD_AS="as "
export BUILD_CC="gcc "
export BUILD_CCLD="gcc "
export BUILD_CFLAGS="-isystem/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_CPP="gcc  -E"
export BUILD_CPPFLAGS="-isystem/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include"
export BUILD_CXX="g++ "
export BUILD_CXXFLAGS="-isystem/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_FC="gfortran "
export BUILD_LD="ld "
export BUILD_LDFLAGS="-L/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -L/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,-rpath,/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/cocinero/oe-core/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2"
export BUILD_NM="nm"
export BUILD_RANLIB="ranlib"
export BUILD_STRIP="strip"
export CC="aarch64-tdx-linux-gcc  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CCLD="aarch64-tdx-linux-gcc  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native= "
export CPP="aarch64-tdx-linux-gcc -E --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security"
export CPPFLAGS=""
export CXX="aarch64-tdx-linux-g++  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native=  -fvisibility-inlines-hidden"
unset DISTRO
export FC="aarch64-tdx-linux-gfortran  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export GIT_CEILING_DIRECTORIES="/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0"
export HOME="/home/cocinero"
export LC_ALL="en_US.UTF-8"
export LD="aarch64-tdx-linux-ld --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now"
export LOGNAME="cocinero"
unset MACHINE
export MAKE="make"
export NM="aarch64-tdx-linux-nm"
export OBJCOPY="aarch64-tdx-linux-objcopy"
export OBJDUMP="aarch64-tdx-linux-objdump"
export PATH="/home/cocinero/oe-core/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/home/cocinero/oe-core/layers/openembedded-core/scripts:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/bin/crossscripts:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/sbin:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/bin:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/sbin:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/bin:/home/cocinero/oe-core/layers/openembedded-core/bitbake/bin:/home/cocinero/oe-core/build/tmp/hosttools"
export PERL_HASH_SEED="0"
export PKG_CONFIG_DIR="/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
export PKG_CONFIG_LIBDIR="/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig:/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include"
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/lib:/usr/lib"
export PSEUDO_DISABLED="1"
export PSEUDO_UNLOAD="1"
export PYTHONHASHSEED="0"
export RANLIB="aarch64-tdx-linux-gcc-ranlib"
export READELF="aarch64-tdx-linux-readelf"
unset SHELL
export SOURCE_DATE_EPOCH="1302044400"
export SOURCE_DATE_EPOCH_FALLBACK="1302044400"
export STRINGS="aarch64-tdx-linux-strings"
export STRIP="aarch64-tdx-linux-strip"
unset TARGET_ARCH
export TERM="screen-256color"
export TZ="UTC"
export USER="cocinero"
export base_bindir="/bin"
export base_libdir="/lib"
export base_prefix=""
export base_sbindir="/sbin"
export bindir="/usr/bin"
export datadir="/usr/share"
export docdir="/usr/share/doc"
export exec_prefix="/usr"
export includedir="/usr/include"
export infodir="/usr/share/info"
export libdir="/usr/lib"
export libexecdir="/usr/libexec"
export localstatedir="/var"
export mandir="/usr/share/man"
export nonarch_base_libdir="/lib"
export nonarch_libdir="/usr/lib"
export oldincludedir="/usr/include"
export prefix="/usr"
export sbindir="/usr/sbin"
export servicedir="/srv"
export sharedstatedir="/com"
export sysconfdir="/etc"
export systemd_system_unitdir="/lib/systemd/system"
export systemd_unitdir="/lib/systemd"
export systemd_user_unitdir="/usr/lib/systemd/user"

do_compile() {
    aarch64-tdx-linux-g++  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot -O hello-world.cpp -o hello-world
}

cd '/home/cocinero/oe-core/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0'
do_compile

# cleanup
ret=$?
trap '' 0
exit $ret

The only thing that occurs to me is that this automatically generated file is being generated incorrectly or some environment variable is missing a path to the compiler.

Best regards,

Hi @jbruno !

Comparing your hello-world’s run.do_compile against mine (which you can find at the end of this message), I could not find the issue.

Some thoughts:

  • Could you try to clean the build artifacts and rebuild everything from zero? (I know it can be very time consuming :sleepy: )

  • Also, maybe the environment was not exported before the bitbake of the recipe? (unlikely, but just in case)

  • It is possible that your environment got broken. If it is really the problem, it can be mitigated by using a container to perform yocto builds: take a look at the Virtual Machines Containers and Cloud Builds section of the Build a Reference Image with Yocto Project/OpenEmbedded | Toradex Developer Center article (particularly, I use it :slight_smile:).

run.do_compile
#!/bin/sh

# Emit a useful diagnostic if something fails:
bb_exit_handler() {
    ret=$?
    case $ret in
    0)  ;;
    *)  case $BASH_VERSION in
        "") echo "WARNING: exit code $ret from a shell command.";;
        *)  echo "WARNING: ${BASH_SOURCE[0]}:${BASH_LINENO[0]} exit $ret from '$BASH_COMMAND'";;
        esac
        exit $ret
    esac
}
trap 'bb_exit_handler' 0
set -e
export AR="aarch64-tdx-linux-gcc-ar"
export AS="aarch64-tdx-linux-as "
export BUILD_AR="ar"
export BUILD_AS="as "
export BUILD_CC="gcc "
export BUILD_CCLD="gcc "
export BUILD_CFLAGS="-isystem/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_CPP="gcc  -E"
export BUILD_CPPFLAGS="-isystem/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include"
export BUILD_CXX="g++ "
export BUILD_CXXFLAGS="-isystem/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_FC="gfortran "
export BUILD_LD="ld "
export BUILD_LDFLAGS="-L/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -L/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,-rpath,/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/workdir/tdxref-bsp-5/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2"
export BUILD_NM="nm"
export BUILD_RANLIB="ranlib"
export BUILD_STRIP="strip"
export CC="aarch64-tdx-linux-gcc  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CCLD="aarch64-tdx-linux-gcc  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native= "
export CPP="aarch64-tdx-linux-gcc -E --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security"
export CPPFLAGS=""
export CXX="aarch64-tdx-linux-g++  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0=/usr/src/debug/hello-world/1.0.0-r0                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native=  -fvisibility-inlines-hidden"
unset DISTRO
export FC="aarch64-tdx-linux-gfortran  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export GIT_CEILING_DIRECTORIES="/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0"
export HOME="/home/pokyuser"
export LC_ALL="en_US.UTF-8"
export LD="aarch64-tdx-linux-ld --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now"
export LOGNAME="pokyuser"
unset MACHINE
export MAKE="make"
export NM="aarch64-tdx-linux-nm"
export OBJCOPY="aarch64-tdx-linux-objcopy"
export OBJDUMP="aarch64-tdx-linux-objdump"
export PATH="/workdir/tdxref-bsp-5/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/workdir/tdxref-bsp-5/layers/openembedded-core/scripts:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/bin/crossscripts:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/sbin:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/usr/bin:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/sbin:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot-native/bin:/workdir/tdxref-bsp-5/layers/openembedded-core/bitbake/bin:/workdir/tdxref-bsp-5/build/tmp/hosttools"
export PERL_HASH_SEED="0"
export PKG_CONFIG_DIR="/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
export PKG_CONFIG_LIBDIR="/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/lib/pkgconfig:/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot"
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include"
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/lib:/usr/lib"
export PSEUDO_DISABLED="1"
export PSEUDO_UNLOAD="1"
export PYTHONHASHSEED="0"
export RANLIB="aarch64-tdx-linux-gcc-ranlib"
export READELF="aarch64-tdx-linux-readelf"
unset SHELL
export SOURCE_DATE_EPOCH="1302044400"
export SOURCE_DATE_EPOCH_FALLBACK="1302044400"
export STRINGS="aarch64-tdx-linux-strings"
export STRIP="aarch64-tdx-linux-strip"
unset TARGET_ARCH
export TERM="xterm"
export TZ="UTC"
export USER="pokyuser"
export base_bindir="/bin"
export base_libdir="/lib"
export base_prefix=""
export base_sbindir="/sbin"
export bindir="/usr/bin"
export datadir="/usr/share"
export docdir="/usr/share/doc"
export exec_prefix="/usr"
export includedir="/usr/include"
export infodir="/usr/share/info"
export libdir="/usr/lib"
export libexecdir="/usr/libexec"
export localstatedir="/var"
export mandir="/usr/share/man"
export nonarch_base_libdir="/lib"
export nonarch_libdir="/usr/lib"
export oldincludedir="/usr/include"
export prefix="/usr"
export sbindir="/usr/sbin"
export servicedir="/srv"
export sharedstatedir="/com"
export sysconfdir="/etc"
export systemd_system_unitdir="/lib/systemd/system"
export systemd_unitdir="/lib/systemd"
export systemd_user_unitdir="/usr/lib/systemd/user"

do_compile() {
    aarch64-tdx-linux-g++  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0/recipe-sysroot -Wall hello-world.cpp -o hello-world
}

cd '/workdir/tdxref-bsp-5/build/tmp/work/aarch64-tdx-linux/hello-world/1.0.0-r0'
do_compile

# cleanup
ret=$?
trap '' 0
exit $ret

Best regards,