0
0

More than 3 years have passed since last update.

rbenv で make test を追加する方法

Last updated at Posted at 2019-10-29

Ruby 1.8.7-p385 を GCC8.2.1(CentOS8標準)でコンパイルするとmake testが通らなかった。

make testが失敗する

スクリーンショット_2019-10-30_07-43-28.png

スクリーンショット_2019-10-30_07-41-57.png

動作確認

make test 成功

CentOS 7 の compat-gcc-44 でビルドしたもの

b = 10**80
正常
p b
100000000000000000000000000000000000000000000000000000000000000000000000000000000

make test 失敗

  • CentOS 8 の GCC8.2.1 (CentOS8標準)
b = 10**80
0になる・・・
p b
0
0除算エラー
a = b * 9 * 7
p a.modulo(b)
-:4:in `modulo': divided by 0 (ZeroDivisionError)
        from -:4

make test 失敗 その2

  • GCC 6.5.0 でビルドした場合、core dump吐いて終了
# ./ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
# ./ruby
b = 10**80
p b
Floating point exception (core dumped)

rbenvメモ

  • rbenv でインストールすると make test がされないので注意。
# -k を付けて rbenv install を実行すると ソースが残る。
/root/.rbenv/bin/rbenv install 1.8.7-p375 -k

cd /root/.rbenv/sources/1.8.7-p375/ruby-1.8.7-p375/

make test

rbenvについて

cd /root/.rbenv/plugins/ruby-build/bin/

# インストールスクリプト
rbenv-install

# rbenv-install が ruby-buildを呼ぶ。ここで make される
ruby-build

ここで make が行われる

スクリーンショット_2019-10-30_08-09-03.png

修正

ruby-build
@@ -592,6 +592,8 @@

   { "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
   } >&4 2>&1
+
+  "$MAKE" test >&4 2>&1
 }

 build_package_standard_install() {
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0