OpenSSL 1.1.1t 실패로 인해 Ubuntu 20.04에 Ruby 2.7.7을 설치하지 못함

OpenSSL 1.1.1t 실패로 인해 Ubuntu 20.04에 Ruby 2.7.7을 설치하지 못함
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

이 오류... "시스템 openssl 버전을 찾을 수 없습니다. openssl 헤더가 설치되어 있는지 확인하세요."... 헤더와 함께 OpenSSL 1.1.1t를 수동으로 설치해야 하지만 이를 수행하는 방법을 잘 모르겠습니다.

답변1

  $ 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

이 명령은 빌드 실패의 원인이 되는 누락된 헤더를 설치합니다.

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

이제 설치가 작동합니다 ...

  $ rbenv install 2.7.7
  $ rbenv global 2.7.7

감사합니다www.techiediaries.com답변을 위해:

관련 정보