0
ubuntu$ rbenv install 2.7.7
To follow progress, use 'tail -f /tmp/ruby-build.20230330011330.8040.log' or pass --verbose
No system openssl version was found, ensure openssl headers are installed (https://github.com/rbenv/ruby-build/wiki#suggested-build-environment)
Downloading openssl-1.1.1t.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b
Installing openssl-1.1.1t...

BUILD FAILED (Ubuntu 22.04 using ruby-build 20230309-1-gf3c1ccc)

Inspect or clean up the working tree at /tmp/ruby-build.20230330011330.8040.QBCH0Y
Results logged to /tmp/ruby-build.20230330011330.8040.log

Last 10 log lines:
gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/home/ubuntu/.rbenv/versions/2.7.7/openssl/ssl\"" -DENGINESDIR="\"/home/ubuntu/.rbenv/versions/2.7.7/openssl/lib/engines-1.1\"" -DZLIB -DZLIB_SHARED -DNDEBUG -I/home/ubuntu/.rbenv/versions/2.7.7/include  -MMD -MF crypto/comp/c_zlib.d.tmp -MT crypto/comp/c_zlib.o -c -o crypto/comp/c_zlib.o crypto/comp/c_zlib.c
gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/home/ubuntu/.rbenv/versions/2.7.7/openssl/ssl\"" -DENGINESDIR="\"/home/ubuntu/.rbenv/versions/2.7.7/openssl/lib/engines-1.1\"" -DZLIB -DZLIB_SHARED -DNDEBUG -I/home/ubuntu/.rbenv/versions/2.7.7/include  -MMD -MF crypto/comp/comp_err.d.tmp -MT crypto/comp/comp_err.o -c -o crypto/comp/comp_err.o crypto/comp/comp_err.c
crypto/comp/c_zlib.c:35:11: fatal error: zlib.h: No such file or directory
   35 | # include <zlib.h>
      |           ^~~~~~~~
compilation terminated.
make[1]: *** [Makefile:2185: crypto/comp/c_zlib.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/ruby-build.20230330011330.8040.QBCH0Y/openssl-1.1.1t'
make: *** [Makefile:174: all] Error 2

This error ... "No system openssl version was found, ensure openssl headers are installed" ... suggests that I need to manually install OpenSSL 1.1.1t with headers but unsure how to do this.

1 Answer 1

0
  $ git clone https://github.com/rbenv/rbenv.git ~/.rbenv

  $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  $ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
  $ . ~/.bashrc

  $ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

This command installs the missing headers that cause the build to fail.

  $ sudo apt-get install -y libreadline-dev zlib1g-dev

Now the install should work ...

  $ rbenv install 2.7.7
  $ rbenv global 2.7.7

Kudos to www.techiediaries.com for the answer:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .