Can't install gems cbor, raindrops, kgio, and stackprof
Hi,
Recently noticed failures in installing the following gems on VMs running Ubuntu Bionic. Each with a different weird and wonderful error.
ubuntu@juju-87625f-hloeung-66:~$ sudo snap install ruby --channel 2.7/stable --classic 2021-10-25T03:34:26Z INFO Waiting for automatic snapd restart... ruby (2.7/stable) 2.7.4 from Ruby core team (rubylang✓) installed
For cbor:
ubuntu@juju-87625f-hloeung-66:~$ gem install cbor -v '0.5.9.6' --source 'https://rubygems.org/' Fetching cbor-0.5.9.6.gem Building native extensions. This could take a while... ERROR: Error installing cbor: ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.gem/gems/cbor-0.5.9.6/ext/cbor/snap/bin/ruby -I /snap/ruby/231/lib/ruby/2.7.0 -r ./siteconf20211025-27308-7v0y83.rb extconf.rb checking for ruby/st.h... yes checking for st.h... yes checking for rb_str_replace() in ruby.h... no checking for rb_big_new() in ruby.h... no checking for rb_intern_str() in ruby.h... no checking for rb_sym2str() in ruby.h... no checking for rb_str_intern() in ruby.h... no checking for rb_integer_unpack() in ruby.h... no creating Makefile
current directory: /home/ubuntu/.gem/gems/cbor-0.5.9.6/ext/cbor make "DESTDIR=" clean
current directory: /home/ubuntu/.gem/gems/cbor-0.5.9.6/ext/cbor make "DESTDIR=" compiling buffer.c In file included from buffer.h:33:0, from buffer.c:28: sysdep.h:133:2: error: #error this size of bignum digits SIZEOF_BDIGITS not implemented #error this size of bignum digits SIZEOF_BDIGITS not implemented ^~~~~ Makefile:244: recipe for target 'buffer.o' failed make: *** [buffer.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/ubuntu/.gem/gems/cbor-0.5.9.6 for inspection. Results logged to /home/ubuntu/.gem/extensions/x86_64-linux/2.7.0/cbor-0.5.9.6/gem_make.out
For raindrops:
ubuntu@juju-87625f-hloeung-66:~$ gem install raindrops -v '0.19.2' --source 'https://rubygems.org/' Fetching raindrops-0.19.2.gem Building native extensions. This could take a while... ERROR: Error installing raindrops: ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.gem/gems/raindrops-0.19.2/ext/raindrops/snap/bin/ruby -I /snap/ruby/231/lib/ruby/2.7.0 -r ./siteconf20211025-3245-1j4wwzl.rb extconf.rb ... make "DESTDIR=" compiling linux_inet_diag.c In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:0, from /usr/include/stdio.h:27, from /snap/ruby/231/include/ruby-2.7.0/ruby/defines.h:126, from /snap/ruby/231/include/ruby-2.7.0/ruby/ruby.h:29, from /snap/ruby/231/include/ruby-2.7.0/ruby.h:33, from linux_inet_diag.c:1: /usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^~~~~~~ linux_inet_diag.c:20:4: error: #error Ruby <= 1.8 not supported
error Ruby <= 1.8 not supported
^~~~~linux_inet_diag.c: In function ‘tcp_stats’: linux_inet_diag.c:589:14: warning: implicit declaration of function ‘rd_fd_region’; did you mean ‘rb_fd_zero’? [-Wimplicit-function-declaration] nl_errcheck(rd_fd_region(diag, args, args->fd)); ^~~~~~~~~~~~ rb_fd_zero Makefile:244: recipe for target 'linux_inet_diag.o' failed make: *** [linux_inet_diag.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/ubuntu/.gem/gems/raindrops-0.19.2 for inspection.
For kgio:
ubuntu@juju-87625f-hloeung-66:~$ gem install kgio -v '2.11.3' --source 'https://rubygems.org/' Fetching kgio-2.11.3.gem Building native extensions. This could take a while... ERROR: Error installing kgio: ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.gem/gems/kgio-2.11.3/ext/kgio/snap/bin/ruby -I /snap/ruby/231/lib/ruby/2.7.0 -r ./siteconf20211025-3878-10052w1.rb extconf.rb checking for CLOCK_MONOTONIC in time.h... yes ... current directory: /home/ubuntu/.gem/gems/kgio-2.11.3/ext/kgio make "DESTDIR=" compiling accept.c In file included from kgio.h:24:0, from accept.c:4: ancient_ruby.h: In function ‘my_str_set_len’: ancient_ruby.h:7:14: error: ‘struct RString’ has no member named ‘len’ RSTRING(str)->len = len; ^~ ancient_ruby.h:8:14: error: ‘struct RString’ has no member named ‘ptr’ RSTRING(str)->ptr[len] = '\0'; ^~ In file included from accept.c:93:0: /snap/ruby/231/include/ruby-2.7.0/ruby/backward/rubysig.h: At top level: /snap/ruby/231/include/ruby-2.7.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp] #warning rubysig.h is obsolete ^~~~~~~ accept.c: In function ‘thread_accept’: accept.c:104:2: error: ‘TRAP_BEG’ undeclared (first use in this function) TRAP_BEG; ^~~~~~~~ accept.c:104:2: note: each undeclared identifier is reported only once for each function it appears in accept.c:106:2: error: ‘TRAP_END’ undeclared (first use in this function); did you mean ‘TRAP_BEG’? TRAP_END; ^~~~~~~~ TRAP_BEG Makefile:244: recipe for target 'accept.o' failed make: *** [accept.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/ubuntu/.gem/gems/kgio-2.11.3 for inspection. Results logged to /home/ubuntu/.gem/extensions/x86_64-linux/2.7.0/kgio-2.11.3/gem_make.out
Finally, for stackprof:
ubuntu@juju-87625f-hloeung-66:~$ gem install stackprof -v '0.2.16' --source 'https://rubygems.org/' Fetching stackprof-0.2.16.gem Building native extensions. This could take a while... ERROR: Error installing stackprof: ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.gem/gems/stackprof-0.2.16/ext/stackprof/snap/bin/ruby -I /snap/ruby/231/lib/ruby/2.7.0 -r ./siteconf20211025-4178-1dtvnzk.rb extconf.rb checking for rb_postponed_job_register_one()... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/snap/ruby/231/bin/$(RUBY_BASE_NAME) extconf.rb:8:in `
': missing API: are you using ruby 2.1+? (RuntimeError) To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ubuntu/.gem/extensions/x86_64-linux/2.7.0/stackprof-0.2.16/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ubuntu/.gem/gems/stackprof-0.2.16 for inspection. Results logged to /home/ubuntu/.gem/extensions/x86_64-linux/2.7.0/stackprof-0.2.16/gem_make.out ubuntu@juju-87625f-hloeung-66:~$:
The last successful collection of these were from Jan 7th so I think it may be related to the recent core18 to core20 change - https://github.com/ruby/snap.ruby/pull/26
It's possible it's commits around then, I'm not sure.
For stackprof, https://paste.ubuntu.com/p/mbpjvRzf7j/:
//snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to
__open64_nocancel@GLIBC_PRIVATE' /snap/ruby/237/lib/libruby.so: undefined reference tolog2@GLIBC_2.29' //snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to__libc_fcntl64@GLIBC_PRIVATE' //snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to__write_nocancel@GLIBC_PRIVATE' /snap/ruby/237/lib/libruby.so: undefined reference tolog@GLIBC_2.29' //snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to__twalk_r@GLIBC_PRIVATE' /snap/ruby/237/lib/libruby.so: undefined reference topow@GLIBC_2.29' /snap/ruby/237/lib/libruby.so: undefined reference toexp@GLIBC_2.29' /snap/ruby/237/lib/libruby.so: undefined reference to `statx@GLIBC_2.28' collect2: error: ld returned 1 exit status
Similar to what's reported in https://github.com/ruby/snap.ruby/issues/14
@hsbt ?
@hloeung From what I've learned in https://github.com/brianmario/mysql2/issues/1100 and similar issues: gems with native extensions might fail to build because the ruby snap (and thus the Ruby binaries) were built with different – likely newer – versions of GLIBC. If my understanding is correct, all track versions of the Ruby snap are now built on core20 bases. So if you cannot upgrade your Bionic host to 20.04, I think you're out of luck using the ruby snap to compile native gem extensions.
Hi, I am getting basically the same on 22.04 when trying to use the Snap version (as that would sound like the easiest approach for running latest Ruby - apt repos only have 3.1 and I need 3.2 now)
LD_LIBRARY_PATH=.:/snap/ruby/317/lib "gcc -o conftest -I/snap/ruby/317/include/ruby-3.2.0/x86_64-linux -I/snap/ruby/317/include/ruby-3.2.0/ruby/backward -I/snap/ruby/317/include/ruby-3.2.0 -I. -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/snap/ruby/317/lib -Wl,-rpath,/snap/ruby/317/lib -L. -L/build/snapcraft-ruby-2c41636617a6ccb92a530f6f568ec82e/parts/ruby/install/usr/lib -L/build/snapcraft-ruby-2c41636617a6ccb92a530f6f568ec82e/parts/ruby/install/usr/lib/x86_64-linux-gnu -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/snap/ruby/317/lib -L/snap/ruby/317/lib -lruby -lm -lpthread -lc"
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libdl.so.2: undefined reference to `_dl_sym@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_dlclose@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_allocate_rtsig_private@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/librt.so.1: undefined reference to `__libc_dlsym@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_siglongjmp@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_thread_freeres@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_current_sigrtmax_private@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libdl.so.2: undefined reference to `_dl_vsym@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_current_sigrtmin_private@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `_dl_make_stack_executable@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_longjmp@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/librt.so.1: undefined reference to `__libc_dlopen_mode@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libdl.so.2: undefined reference to `_dl_addr@GLIBC_PRIVATE'
/usr/bin/ld: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined reference to `__libc_pthread_init@GLIBC_PRIVATE'
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 */