Skip to content
Snippets Groups Projects
Unverified Commit 7b4b17c4 authored by Stan Hu's avatar Stan Hu
Browse files

Compile Ruby interpreter with -Wl,--no-as-needed LDFLAGS

Debian bullseye patched `ld` to default to `--as-needed`, but this can
cause issues with jemalloc (https://bugs.ruby-lang.org/issues/18409).

Raspberry Pi builds may also need to link in libatomic to support
armv6 platforms, and `--as-needed` causes this dependency to be
dropped in the shared libraries used in C extensions. This causes
missing symbols during runtime.

These flags can be dropped after Ruby 3.0.4 (https://github.com/ruby/ruby/pull/4631).

Relates to https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6235
parent 4eee2a47
No related merge requests found
# Debian bullseye patched `ld` to default to `--as-needed`, but this can
# cause issues with jemalloc (https://bugs.ruby-lang.org/issues/18409).
#
# Raspberry Pi builds may also need to link in libatomic to support
# armv6 platforms, and `--as-needed` causes this dependency to be
# dropped in the shared libraries used in C extensions. This causes
# missing symbols during runtime.
#
# These flags can be dropped after Ruby 3.0.4 (https://github.com/ruby/ruby/pull/4631).
ENV RUBY_EXTRA_LDFLAGS='-Wl,--no-as-needed'
RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/${RUBY_MINOR_VERSION}/ruby-${RUBY_VERSION}.tar.gz" \
| tar -xzC /tmp \
&& cd /tmp/ruby-${RUBY_VERSION} \
&& ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi ${RUBY_CONFIGURE_EXTRA_OPTS} \
&& LDFLAGS=${RUBY_EXTRA_LDFLAGS} ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi ${RUBY_CONFIGURE_EXTRA_OPTS} \
&& make \
&& make install
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment