Meet "undefined reference to `log2f@GLIBC_2.27'" error when using the crosscompile toolchain

Please provide the following info:
Hardware Platform: Pegasus
Software Version: DRIVE Software 10
Host Machine Version: native Ubuntu 18.04
SDK Manager Version: latest

When I use the x86_64 to aarch64 crosscompile toolchain to build a target, the linker says:
/opt/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/…/aarch64-linux-gnu/libc/usr/lib/libavcodec.so.57: undefined reference to log2f@GLIBC_2.27' /opt/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/lib/libavcodec.so.57: undefined reference to exp2f@GLIBC_2.27’

My compile platform is bazel 2.2, and I wrote the right toolchain settings for cc_rules (because I can successfully crosscompile many target onto pegasus). And I tried to add “-lm” to my bazel toolchain settings both compile flag and linkopt. But it still doesn’t work.

All these missing symbols come from GLIBC_2.27, but I noticed that the toolchain only support glibc_2.25. Does anyone have ideas about updating glibc? I tried to copy all lib*.so from /lib/aarch64-linux-gnu/ on pegasus to toolchain’s directory, but the error remains.

Thanks for helping.

Hello @zhenye.jiang,

glibc version that is delivered with Drive Software 10 on the DRIVE AGX is 2.27:
nvidia@tegra-ubuntu:~$ ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.

Simply copying the lib*.so is not enough as the lib libc.so.6 for example is a symbolic link to libc-2.2_.so, So you might want to change the symbolic link to what you are trying to do, so your application will add a different so file.

Can you please elaborate on what are you trying to compile that is failing?
Can you please provide a sample code and the compilation command that causes this failure?