Trying to use eIQ, tensorflow build fails

I am trying to replicate the results of this blog: NXP iMX8基于eIQ框架测试 Machine Learning

Unfortunately I get linker errors when building tensorflow-lite. See dump below:

I can see that there are a lot of references to: “recipe-sysroot-native” while I was expecting “recipe-sysroot”, where the missing libraries are actually located. I am quite new to yocto, so I do not really understand yet where the sysroot is determined and how to change it. I hope someone can help me? - Thanks!

------
aarch64-tdx-linux-g++ -pthread -shared -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/sannenj/nxp_eiq/oe-core/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/sannenj/nxp_eiq/oe-core/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0=/usr/src/debug/tensorflow-lite/2.3.1-r0 -fdebug-prefix-map=/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0=/usr/src/debug/tensorflow-lite/2.3.1-r0 -fdebug-prefix-map=/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native= build/temp.linux-x86_64-3.8/interpreter_wrapper/interpreter_wrapper.o build/temp.linux-x86_64-3.8/interpreter_wrapper/interpreter_wrapper_pybind11.o build/temp.linux-x86_64-3.8/interpreter_wrapper/numpy.o build/temp.linux-x86_64-3.8/interpreter_wrapper/python_error_reporter.o build/temp.linux-x86_64-3.8/interpreter_wrapper/python_utils.o -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/git/tensorflow/lite/tools/make/gen/linux_aarch64/lib/ -L/home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/lib -ltensorflow-lite -lrt -o build/lib.linux-x86_64-3.8/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find crti.o: No such file or directory
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find crtbeginS.o: No such file or directory
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lrt
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lstdc++
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lm
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lgcc_s
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lpthread
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lc
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find -lgcc_s
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find crtendS.o: No such file or directory
| /home/sannenj/nxp_eiq/oe-core/build/tmp/work/aarch64-tdx-linux/tensorflow-lite/2.3.1-r0/recipe-sysroot-native/usr/bin/aarch64-tdx-linux/../../libexec/aarch64-tdx-linux/gcc/aarch64-tdx-linux/9.3.0/ld: cannot find crtn.o: No such file or directory
| collect2: error: ld returned 1 exit status
| error: command 'aarch64-tdx-linux-g++' failed with exit status 1
| WARNING: exit code 1 from a shell command.
| 
ERROR: Task (/home/sannenj/nxp_eiq/oe-core/build/../layers/meta-ml/recipes-libraries/tensorflow-lite/tensorflow-lite_2.3.1.bb:do_compile) failed with exit code '1'

Dear @sannenj,

Thank you for providing the information.

We are currently trying to reproduce your issue. Were you able to collect additional information in the mean time, which could help us as well?

Best Regards
Kevin

No, I do not have further information yet unfortunately.

Dear @sannenj ,

The Toradex team is reviewing the instructions of porting meta-ml to the BSP and we will have a new article on the developer website in the coming weeks.
I’ve faced the same issue building meta-ml. I was able to build it by adding the following line:

export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"

To the python3native.bbclass recipe:

../layers/openembedded-core/meta/classes/python3native.bbclass

This will be in the article in the developer that is coming.

Thanks for your help. I tried your solution. Now getting errors while configuring glib and while building arm-compute-library. Will probably wait for the new article and see if that improves things.

@sannenj , @jaski.tx , Toradex just released a new article with instructions for building eIQ on the Yocto BSP: https://developer.toradex.com/knowledge-base/building-machine-learning-software-with-toradex-reference-images-for-yocto-project

I tried it this weekend and those instructions do work. So thanks for that!

Perfect that the issue is solved. Thanks for the feedback.