-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #23903, compile on pi4, debian bookworm due to missing '_atomic_*' functions. #23904
Conversation
mk/gcc.mk
Outdated
@@ -8,6 +8,7 @@ AR?=ar | |||
CC_AR=${AR} q ${LIBAR} | |||
CFLAGS+=-MD | |||
CFLAGS_INCLUDE=-I | |||
LDFLAGS+=-latomic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check should detect if its needed at compile time, because this library is not necessary or available in other targets. another option is to check if the output from uname is arm32 (is your pi4 running in arm64 mode?)
CHECK_ATOMIC = $(shell echo "int main() { __atomic_fetch_add(0, 0, 0); return 0; }" | \
$(CC) -x c -o /dev/null - $(CFLAGS) $(LDFLAGS) >/dev/null 2>&1 || echo "-latomic")
DFLAGS += $(CHECK_ATOMIC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit fuggered up on the commits (doing a github sync put me down a rabbit hole), but here is where it stands...
amended commit... your suggested revision mostly worked.... two minor changes were needed. as it were, test would always fail and make stops with circular loop. also, __atomic_fetch_add by itself is fine except when referencing large values, _atomic_fetch*_8 nails the problem.
stock bookworm install... aarch64 kernel, 32bit user-land.
uname -m reports aarch64... but binaries are 32bit.
so, uname is missleading but, file $(command -v file) shows 32 bit. that was the one suggested test I found when digging in response to your question.
e140ee5
to
c93ad10
Compare
Another option would be to check for libatomic in configure and meson like u did for r2dec |
yes, that was my thought... while it works for me, seems like there ought to be a better place to do it during configuration... started looking... seen the meson build files, believe i tried putting in qjs like i did with quickjs but didnt work/help. will keep digging, hope to get back to you with something in a few days. |
./configure && make fails reporting missing '_atomic_*' functions during link of r2pm. compiled on pi4, uname -a: Linux raspberrypi 6.6.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux with gcc: version 12.2.0 (Raspbian 12.2.0-14+rpi1) modified: mk/gcc.mk
modified: binr/r2pm/meson.build
This reverts commit 6745d17cdf681ecec38ea08c3d7ea92d84306e8b.
This reverts commit 8ed619b42d040ad2a23888fa0eb5c4749df2883c.
This reverts commit e4605f77e1ee4c2d48dae167230ab712e5318d4b.
./configure && make fails reporting missing '_atomic_*' functions during link of r2pm. compiled on pi4, uname -a: Linux raspberrypi 6.6.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux with gcc: version 12.2.0 (Raspbian 12.2.0-14+rpi1) modified: config-user.mk.acr modified: configure modified: configure.acr modified: libr/lang/Makefile
lgtm now! |
ok to remove the draft bit? |
Ready enough... Weren't going to take it out of draft until the tests passed and got confirmation that the forced pushes were not going to create a problem (or got further instructions to fix it). Pleasantly surprised, thanks. |
./configure && make fails reporting missing 'atomic*' functions
during link of r2pm.
compiled on pi4, uname -a:
Linux raspberrypi 6.6.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux
with gcc: version 12.2.0 (Raspbian 12.2.0-14+rpi1)
Description