This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cross-compiling using "x86_64-aarch64-none-linux-gnu" toolchain: Cannot link with GLIBC 2.34, where to find GLIBC 2.31?

Former Member
Former Member

I cross-built the TensorFlow Lite C API shared library `libtensorflowlite_c.so`: my host machine was Linux Ubuntu `x86 64`, and I built the library for Arm `aarch64` target using the latest toolchain: `gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz`.

Then I went to the Arm `aarch64` Ubuntu machine (20.02), and tried to link the library with a test program.

But I got a bunch of "undefined references" to GLIBC:
```
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `fstat@GLIBC_2.33'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `__libc_single_threaded@GLIBC_2.32'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `pthread_join@GLIBC_2.34'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `dlsym@GLIBC_2.34'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `stat@GLIBC_2.33'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `dlopen@GLIBC_2.34'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `pthread_once@GLIBC_2.34'
/usr/bin/ld: /home/joedoe/git/myproj/subprojects/tensorflow/mycom/binaries/aarch64/libtensorflowlite_c.so: undefined reference to `pthread_create@GLIBC_2.34'
```

The `ldd --version` on the target Arm machine gives me: `Ubuntu GLIBC 2.31`.

I went back to the toolchain and executed the GLIBC from the toolchain `aarch64-none-linux-gnu/libc/lib64/libc.so.6`, and I got `GNU C Library (GNU) stable release version 2.34`.
So, the toolchain built my library using glibc 2.34, and I am trying to run it on the Arm machine with older 2.31 GLIBC?

I tried to use older toolchain from developer.arm.com/.../downloads, however, I didn't even find the `libc.so.6` at all in those packages.
Another option is to update Arm Ubuntu OS to version 21 (which uses GLIBC 2.34), but updating OS isn't a good solution. I'd rather downgrade the toolchain.

Can anyone help? How to use downgraded GLIBC?

  • Former Member
    0 Former Member

    Does anyone know which older cross-toolchain can be used instead of the gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz

    I am talking about cross-compiling on Linux x86 64 host machine, targeting Arm 64-bit machine

    As I mentioned above, seems like gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz links with new GNU C library (glibc) which is distributed only with the newest Linux Ubuntu 21, and not in the most widely used Ubuntu 20. So, does this mean that gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz can only be used to target new Ubuntus??