The _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY setting differs between Debian
and Raspberry Pi OS, causing programs cross-compiled for Debian Bookworm armhf
to appear to run on Rasbperry Pi OS Bookworm armhf, then later crash
for no obvious reason. For details, see the (now closed) upstream bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119627
I'm not sure whether the Debian or Raspberry Pi OS version is correct,
but the Debian GCC Maintainers are listed as the maintainer for both,
so either way I assume this is the right place to report this issue.
# STEPS TO REPLICATE
1. Download and extract Debian's libstdc++-12-dev and libstdc++-12-dev-armhf-
cross,
plus Raspberry Pi OS's libstdc++-12-dev:
wget
'http://ftp.debian.org/debian/pool/main/g/gcc-12/libstdc++-12-dev_12.2.0-14_armhf.deb'
\
'http://ftp.debian.org/debian/pool/main/g/gcc-12-cross/libstdc++-12-dev-
armhf-cross_12.2.0-14cross1_all.deb' \
'http://raspbian.raspberrypi.com/raspbian/pool/main/g/gcc-12/libstdc++-12-dev_12.2.0-14+rpi1_armhf.deb'
dpkg -x libstdc++-12-dev_12.2.0-14_armhf.deb main
dpkg -x libstdc++-12-dev-armhf-cross_12.2.0-14cross1_all.deb cross
dpkg -x libstdc++-12-dev_12.2.0-14+rpi1_armhf.deb rpi
2. Observe the value for _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY in all three
packages:
grep _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY \
main/usr/include/arm-linux-gnueabihf/c++/12/bits/c++config.h \
cross/usr/arm-linux-gnueabihf/include/c++/12/arm-linux-
gnueabihf/bits/c++config.h \
rpi/usr/include/arm-linux-gnueabihf/c++/12/bits/c++config.h
Expected:
The Raspberry Pi value is the same as the armhf cross-compile version.
Observed:
main/usr/include/arm-linux-gnueabihf/c++/12/bits/c++config.h:#define
_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1
cross/usr/arm-linux-gnueabihf/include/c++/12/arm-linux-
gnueabihf/bits/c++config.h:#define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1
rpi/usr/include/arm-linux-gnueabihf/c++/12/bits/c++config.h:/* #undef
_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY */