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

[BUG] 32-bit arch may need linking to libatomic, otherwise build fails #434

Open
barracuda156 opened this issue May 4, 2024 · 3 comments · May be fixed by #663
Open

[BUG] 32-bit arch may need linking to libatomic, otherwise build fails #434

barracuda156 opened this issue May 4, 2024 · 3 comments · May be fixed by #663

Comments

@barracuda156
Copy link
Contributor

Describe the bug

Nothing checks for support of 8-byte atomics in hardware. So linking to libatomic is not done where required.

To reproduce

Build on ppc or arm.

Expected behavior

-latomic should be passed when needed.

Additional information

/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_valkey/valkey/work/compwrap/cc/opt/local/bin/gcc-mp-13 -Wl,-headerpad_max_install_names -L/opt/local/lib -lMacportsLegacySupport -arch ppc -O3 -flto -g -ggdb -L/usr/local/opt/openssl/lib -o valkey-benchmark ae.o anet.o valkey-benchmark.o adlist.o dict.o zmalloc.o redisassert.o release.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/jemalloc/lib/libjemalloc.a -lm -ldl ../deps/hiredis/libhiredis_ssl.a -L/opt/local/libexec/openssl3/lib -lssl -L/opt/local/libexec/openssl3/lib -lcrypto 
ld: warning: directory '/usr/local/opt/openssl/lib' following -L not found
Undefined symbols:
  "___atomic_fetch_add_8", referenced from:
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
  "___atomic_load_8", referenced from:
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
  "___atomic_compare_exchange_8", referenced from:
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
      _hdr_record_values_atomic in libhdrhistogram.a(hdr_histogram.o)
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
@madolson
Copy link
Member

madolson commented Jun 17, 2024

@PingXie Can we close this, it seems like Neal fixed this?

@barracuda156
Copy link
Contributor Author

@PingXie If you mean this 71dd85d then no, not yet.
uname -m returns Power Macintosh on Darwin, not ppc. The latter is a build arch, not machine type.

By the way, it should not be needed when building for ppc64 (any OS), but that patch seems to apply to either case on Linux.

If we do not mind redundant linking on ppc64, then uname -p returns powerpc (or after all Power*Macintosh can be checked for with uname -m).

PingXie added a commit to PingXie/valkey that referenced this issue Jun 18, 2024
Fix valkey-io#434

Signed-off-by: Ping Xie <pingxie@google.com>
@PingXie PingXie linked a pull request Jun 18, 2024 that will close this issue
@PingXie
Copy link
Member

PingXie commented Jun 18, 2024

I see. I can't test the fix. @barracuda156 can you please help review #663?

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

Successfully merging a pull request may close this issue.

3 participants