C++: Build program with Ubuntu 20.04 ARM machine executer (GLIBC 2.31) for Ubuntu 18.04 ARM device (GLIBC 2.27)

I am trying to build a C++ program for an Ubuntu 18.04 device, using the following ARM Ubuntu setup:

machine:
    image: ubuntu-2004:202101-01
resource_class: arm.medium

(note: there is no Ubuntu 18.04 ARM machine executor)

However, since this image is Ubuntu 20.04, it uses GLIBC 2.31. The device I am building for, an Nvidia Jetson Xavier NX, uses Ubuntu 18.04 with GLIBC 2.27. Thus, once the program executable has been built in my Circle environment, when it is run on the Jetson, it throws the error:

"/lib/aarch64-linux-gnu/libm.so.6: version 'GLIBC_2.29' not found (required by ./build/bin/executable)"

The options I tried to resolve this are:

  1. Download GLIBC 2.27 in my circle workflow and link it to the build in compilation
  2. Patch the executable with the correct GLIBC version using pachelf once the executable has been built in my workflow
  3. Use the Ubuntu 18.04 (x86-64) docker image on Circle and cross-compile for aarch64

However, my attempts failed for the following reasons:

  1. I could not get GLIBC 2.27 to build on the CircleCI machine executor. I got some incredibly low-level issues that I couldn’t find any solutions for online.
  2. I struggled to find adequate guidance and support with patchelf (also, this solution would not really work out in our CICD flow)
  3. Since we upgraded to gcc-9 on the Jetson, we need to upgrade to gcc-9 in the docker image. Unfortunately, I could only find a gcc-8 cross-compilation tool for aarch64 that worked on the Jetson, so the program linking fails due to std::filesystem.

If anyone has had success with this in the past, any guidance here would be greatly appreciated!

Did you try running an L4T base Docker image on Circle’s Arm machine executor and building your program inside that container?