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

atomic_reference.c fails to compile on 32-bit due to unconditional usage of 64-bit atomics #1063

Open
barracuda156 opened this issue Sep 8, 2024 · 0 comments · May be fixed by #1064
Open

Comments

@barracuda156
Copy link

This is probably was missed earlier since GCC was more permissive. With gcc-14 it fails (rightfully so):

ccache /opt/local/bin/gcc-mp-14 -I. -I/opt/local/include/ruby-3.3.4/ppc-darwin10.0.0d2 -I/opt/local/include/ruby-3.3.4/ruby/backward -I/opt/local/include/ruby-3.3.4 -I. -DHAVE_LIBKERN_OSATOMIC_H -I/opt/local/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -Wno-incompatible-pointer-types -fno-common -arch ppc -o atomic_reference.o -c atomic_reference.c
atomic_reference.c: In function 'ir_compare_and_set':
atomic_reference.c:82:7: error: implicit declaration of function 'OSAtomicCompareAndSwap64'; did you mean 'OSAtomicCompareAndSwap32'? [-Wimplicit-function-declaration]
   82 |   if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~
      |       OSAtomicCompareAndSwap32
make: *** [atomic_reference.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-concurrent-ruby-ext/rb33-concurrent-ruby-ext/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/concurrent-ruby-ext-1.3.4 for inspection.
Results logged to /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-concurrent-ruby-ext/rb33-concurrent-ruby-ext/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/extensions/ppc-darwin-10/3.3.0/concurrent-ruby-ext-1.3.4/gem_make.out
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-concurrent-ruby-ext/rb33-concurrent-ruby-ext/work/concurrent-ruby-ext-1.3.4" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-concurrent-ruby-ext/rb33-concurrent-ruby-ext/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-concurrent-ruby-ext/rb33-concurrent-ruby-ext/work/concurrent-ruby-ext-1.3.4/concurrent-ruby-ext.gem 
Exit code: 1

Looks like the code assumes 64-bit atomics is available on the level of OS, which needs not be the case.
Either 32-bit version is to be used on 32-bit arch, or if 64-bit is needed, then libatomic is there.

barracuda156 added a commit to barracuda156/concurrent-ruby that referenced this issue Sep 8, 2024
@barracuda156 barracuda156 linked a pull request Sep 8, 2024 that will close this issue
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.

1 participant