Bug #18391
closedError building gems with binary extensions on Ruby 3.1
Description
Testing Ruby 3.1 on Fedora, it seems that every gem with binary extension fails to build. This is the mkmf.log:
LD_LIBRARY_PATH=.:/usr/lib64 pkg-config --exists openssl
LD_LIBRARY_PATH=.:/usr/lib64 pkg-config --libs openssl |
=> "-lssl -lcrypto \n"
LD_LIBRARY_PATH=.:/usr/lib64 "gcc -o conftest -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection conftest.c -L. -L/usr/lib64 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -lruby -lz -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm -lm -lc"
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
and the issue are missing gmp-devel and zlib-devel packages, which were never needed previously. It seems the issue is that LIBRUBYARG_SHARED
includes $(MAINLIBS)
since git|372d94b6ba73d85b2c63c70e873a4914bbe9dbad.
Please note that in Fedora, we construct the buildroot from scratch for every package. Therefore while the development dependencies are available during build of Ruby, they are not available during build of other packages. In essence, this is similar to #14422
Updated by vo.x (Vit Ondruch) over 3 years ago
Please note that the culprit was originally identified in this thread:
Updated by mame (Yusuke Endoh) over 3 years ago
- Assignee set to nobu (Nobuyoshi Nakada)
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
- Status changed from Open to Closed
Applied in changeset git|ec878dac90df0ca5f39e72261b8d4e2898486a93.
Move -ljemalloc to DLDLIBS [Bug #18391]
Set the alternative memory management library only as a platform
specific library, without other libraries.
Updated by vo.x (Vit Ondruch) over 3 years ago
Thx a lot for the fix.