Skip to content
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

__sync_add_and_fetch() breaks cross-compilation #2635

Open
ryzhovau opened this issue Feb 21, 2024 · 2 comments
Open

__sync_add_and_fetch() breaks cross-compilation #2635

ryzhovau opened this issue Feb 21, 2024 · 2 comments
Labels

Comments

@ryzhovau
Copy link

ryzhovau commented Feb 21, 2024

4b140aa#diff-b4dbf33d511bc4aaeb20a4539e694cf4575e9dfe0b9aed1881d58f20e95e6c53R613 and 728fd7d#diff-3045e316fef9708ebd7095e9a191c711c5dd24e58cdb91c0961961463fabacccR1863 makes goaccess unportable to some ARM/MIPS(el)/PowerPC platforms:

mipsel-openwrt-linux-gnu-gcc -O2 -DSYSCONFDIR=\"/opt/etc\" -Wall -Wextra -Wnested-externs -Wformat=2 -g -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare -Wbad-function-cast -Wcast-align -Wdeclaration-after-statement -Wshadow -Wold-style-definition -O2 -pipe -mno-branch-likely -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -msoft-float -mips16 -minterlink-mips16  -pthread -rdynamic -Wl,--dynamic-linker=/opt/lib/ld.so.1 -Wl,-rpath=/opt/lib -L/home/me/E/staging_dir/toolchain-mipsel_mips32r2_gcc-8.4.0_glibc-2.27/usr/lib -L/home/me/E/staging_dir/toolchain-mipsel_mips32r2_gcc-8.4.0_glibc-2.27/lib -fuse-ld=bfd -latomic  -o goaccess src/base64.o src/browsers.o src/color.o src/commons.o src/csv.o src/error.o src/gdashboard.o src/gdns.o src/gholder.o src/gkhash.o src/gkmhash.o src/gmenu.o src/goaccess.o src/gslist.o src/gstorage.o src/gwsocket.o src/json.o src/opesys.o src/options.o src/output.o src/parser.o src/persistence.o src/pdjson.o src/settings.o src/sort.o src/tpl.o src/ui.o src/util.o src/websocket.o src/xmalloc.o src/sha1.o     -lnsl -lncursesw -lpthread 
/home/me/E/staging_dir/toolchain-mipsel_mips32r2_gcc-8.4.0_glibc-2.27/lib/gcc/mipsel-openwrt-linux-gnu/8.4.0/../../../../mipsel-openwrt-linux-gnu/bin/ld.bfd: src/gstorage.o: in function `count_process':
/home/me/E/build_dir/target-mipsel_mips32r2_glibc-2.27/goaccess-1.9/src/gstorage.c:613: undefined reference to `__sync_add_and_fetch_8'
/home/me/E/staging_dir/toolchain-mipsel_mips32r2_gcc-8.4.0_glibc-2.27/lib/gcc/mipsel-openwrt-linux-gnu/8.4.0/../../../../mipsel-openwrt-linux-gnu/bin/ld.bfd: src/parser.o: in function `atomic_lpts_update':
/home/me/E/build_dir/target-mipsel_mips32r2_glibc-2.27/goaccess-1.9/src/parser.c:1863: undefined reference to `__sync_bool_compare_and_swap_8'
collect2: error: ld returned 1 exit status

It's similar to rakshasa/rtorrent#156

Is there a way to make __sync_add_and_fetch() usage optional?

ryzhovau added a commit to Entware/rtndev that referenced this issue Feb 21, 2024
@allinurl
Copy link
Owner

Thanks for bringing this up. I'm interested to know about ARM since I've had smooth builds on armhf and arm64. Could you specify which ARM platform you tried this on? Also, any idea if those platforms include the C11 <stdatomic.h> header? Otherwise, we might have to resort to using mutex locks.

@allinurl allinurl added the build label Feb 22, 2024
@0bi-w6n-K3nobi
Copy link
Contributor

0bi-w6n-K3nobi commented Apr 20, 2024

Hi @allinurl

Maybe the new __atomic functions be the solution...
See here for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants