I’ve taught a university Embedded Systems course targeting the BeagleBone Green for a number of years. I’m updating the host OS from Ubuntu 20.04 to 22.04 (Jellyfish).
However, this cause a version problem with GLIBC when cross-compiling:
./helloworld: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34’ not found (required by ./helloworld)
Any suggestions on how I can best force the host to cross-compile using a version of GLIBC which is compatible with the BBG?
Thank you for any ideas!
Details
The binaries are cross-compiled from the Ubuntu host using arm-linux-gnueabihf-gcc
:
(host)$ sudo apt-get install gcc-arm-linux-gnueabihf
(host)$ arm-linux-gnueabihf-gcc helloworld.c -o helloworld
Under Ubuntu 22.04 I have also tried with packages gcc-9-arm-linux-gnueabihf
, gcc-10-arm-linux-gnueabihf
, and gcc-11-arm-linux-gnueabihf
.
The BBG is running Debian Bullseye Minimal Image (2022-05-01) Monthly Snapshot, which seems to have GLIBC version 2.31:
(bbg)$ strings /lib/arm-linux-gnueabihf/libc.so.6 | grep GLIBC
GLIBC_2.4
<...snip...>
GLIBC_2.30
GLIBC_PRIVATE
GNU C Library (Debian GLIBC 2.31-13+deb11u3) stable release version 2.31.
Ubuntu 20.04 seems to be building against GLIBC version 2.31:
(20.04)$ strings /usr/arm-linux-gnueabihf/lib/libc.so.6 | grep GLIB
GLIBC_2.4
<...snip...>
GLIBC_2.30
GLIBC_PRIVATE
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.2) stable release version 2.31.
Ubuntu 22.04 seems to be building against GLIBC version 2.35:
(22.04)$ strings /usr/arm-linux-gnueabihf/lib/libc.so.6 | grep GLIB
GLIBC_2.4
<...snip...>
GLIBC_2.35
GLIBC_PRIVATE
GNU C Library (Ubuntu GLIBC 2.35-0ubuntu1) stable release version 2.35.
When cross compiled from Ubuntu 20.04, it requires GLIBC 2.4+ on the BBG
$ ldd ./helloworld_20_04
linux-vdso.so.1 (0xbef66000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ded000)
/lib/ld-linux-armhf.so.3 (0xb6efe000)
$ strings ./helloworld_20_04 | grep GLIB
GLIBC_2.4
__cxa_finalize@@GLIBC_2.4
puts@@GLIBC_2.4
__libc_start_main@@GLIBC_2.4
abort@@GLIBC_2.4
When cross compiled from Ubuntu 22.04, it requires GLIBC 2.34+ on the BBG
$ ldd helloworld_22_04
./helloworld_22_04: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34' not found (required by ./helloworld_22_04)
linux-vdso.so.1 (0xbeff3000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e71000)
/lib/ld-linux-armhf.so.3 (0xb6f82000)
$ strings ./helloworld_22_04 | grep GLIBC
GLIBC_2.4
GLIBC_2.34
__libc_start_main@GLIBC_2.34
__cxa_finalize@GLIBC_2.4
puts@GLIBC_2.4
abort@GLIBC_2.4
BeagleBone Image:
I’m running Debian Bullseye Minimal Image (2022-05-01) Monthly Snapshot
$ sudo beagle-version
eeprom:[A335BNLTBBG1BBG116046833]
model:[TI_AM335x_BeagleBone_Green]
dogtag:[BeagleBoard.org Debian Bullseye Minimal Image 2022-05-01]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2022.04-g4237220b (Apr 08 2022 - 13:42:29 +0000)]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.kernel]
UBOOT: Loaded Overlay:[M-BB-BBG-00A0.kernel]
kernel:[5.10.109-ti-r43]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~bullseye+20210821]
pkg:[bb-customizations]:[1.20220325.0-0~bullseye+20220325]
pkg:[bb-usb-gadgets]:[1.20220316.1-0~bullseye+20220316]
pkg:[bb-wl18xx-firmware]:[1.20211222.2-0~bullseye+20211222]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20210315-3]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input netdev gpio admin i2c tisdk weston-launch bluetooth cloud9ide]
cmdline:[console=ttyS0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 11.025409] remoteproc remoteproc0: wkup_m3 is available
[ 31.506148] remoteproc remoteproc0: powering up wkup_m3
[ 31.506186] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 31.506604] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 44.794669] remoteproc remoteproc1: 4a334000.pru is available
[ 44.816456] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 44.794669] remoteproc remoteproc1: 4a334000.pru is available
[ 44.816456] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pinctrl-single
[ 10.529977] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 10.531848] gpio-of-helper ocp:cape-universal: Failed to get gpio property of 'P8_03'
[ 10.531880] gpio-of-helper ocp:cape-universal: Failed to create gpio entry
[ 11.204666] gpio-of-helper ocp:cape-universal: Allocated GPIO id=0 name='P8_03'
[ 11.204895] gpio-of-helper ocp:cape-universal: Allocated GPIO id=1 name='P8_04'
<... SNIP ...>
[ 11.217552] gpio-of-helper ocp:cape-universal: ready
END