I have been using ruby 2.6.2 on Ubuntu 19.10 and earlier. I've tried reinstalling rbenv and ruby-build a few times through apt-get. Same behavior when installing them in Linuxbrew.
Build log: https://pastebin.com/raw/V2D7MCET
Error message:
Downloading ruby-2.6.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.2.tar.bz2
Installing ruby-2.6.2...
ruby-build: using readline from homebrew
BUILD FAILED (Pop 20.04 using ruby-build 20200401-11-g12af1c3)
Inspect or clean up the working tree at /tmp/ruby-build.20200516094327.1190408.SfAlY9
Results logged to /tmp/ruby-build.20200516094327.1190408.log
Last 10 log lines:
transform_mjit_header: SKIPPED to transform getchar_unlocked
transform_mjit_header: SKIPPED to transform getc_unlocked
transform_mjit_header: SKIPPED to transform fgetc_unlocked
transform_mjit_header: SKIPPED to transform getchar
ln -sf ../../../.ext/include/x86_64-linux/rb_mjit_min_header-2.6.2.h include/ruby-2.6.0/x86_64-linux/rb_mjit_min_header-2.6.2.h
linking shared-library libruby.so.2.6.2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgmp.a(lt4-clear.o): relocation R_X86_64_PC32 against symbol `__gmp_free_func' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:297: libruby.so.2.6.2] Error 1
Many thanks.
Same error when trying to build ruby 2.7.0. Not sure whether I need to reinstall dev tools? Remove Linuxbrew? I don't know what I don't know here, so I'm open for suggestions.
Build log: https://pastebin.com/raw/L0M3qJ20
$ rbenv install 2.7.0
Downloading ruby-2.7.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
Installing ruby-2.7.0...
ruby-build: using readline from homebrew
BUILD FAILED (Pop 20.04 using ruby-build 20200401-11-g12af1c3)
Inspect or clean up the working tree at /tmp/ruby-build.20200516095108.1207639.YI6YOJ
Results logged to /tmp/ruby-build.20200516095108.1207639.log
Last 10 log lines:
transform_mjit_header: SKIPPED to transform getchar_unlocked
transform_mjit_header: SKIPPED to transform getc_unlocked
transform_mjit_header: SKIPPED to transform fgetc_unlocked
transform_mjit_header: SKIPPED to transform getchar
linking shared-library libruby.so.2.7.0
ln -sf ../../../.ext/include/x86_64-linux/rb_mjit_min_header-2.7.0.h include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.0.h
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgmp.a(lt4-clear.o): relocation R_X86_64_PC32 against symbol `__gmp_free_func' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:300: libruby.so.2.7.0] Error 1
@jbrains Thanks, It was the ruby core issue maybe. I investigate it.
I can build Ruby 2.6.6 directly from source--it succeeds. (./configure && make)
When I try rbenv build 2.6.6, it fails in the same way as in my previous comments.
Finally, I try to download exactly the same archive of Ruby 2.6.6 that ruby-build downloads, from https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2, then I can build it directly--it succeeds.
So maybe there is some environment difference when ruby-build runs!
I am using ruby-build as an rbenv plugin now, but I remember the behavior was the same for ruby-build as a standalone program.
I have the same behavior even using ruby-build as a standalone program.
Interesting! Suddenly everything works and I don't know what has made the difference.
same problem here with ruby 2.7.1.
This is this is wired.
I had a similar problem while installing ruby using rbenv on WSL2. Here's how I solved the issue:
Install aptitude, a package installer. sudo apt install aptitude
sudo aptitude install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
Now aptitudeshould ask you whether you want to install packages with option a, option b, and so on. You might want to go through each possible choice by saying 'no' until you reach the end, re-run the command and make an "educated" choice.
The answer was posted on StackExchange by Nat Azodnem
Most helpful comment
same problem here with ruby 2.7.1.
This is this is wired.