postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.91k stars 255 forks source link

`ruby-install ruby` fails when there's not an existing Ruby interpreter on the system #372

Open judofyr opened 4 years ago

judofyr commented 4 years ago

I just got this error:

[tons of lines]
>>> Installing ruby 2.7.1 ...
    BASERUBY = echo executable host ruby is required.  use --with-baseruby option.; false
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -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 -std=gnu99
    XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0
    CPPFLAGS =
    DLDFLAGS = -Wl,--compress-debug-sections=zlib -fstack-protector-strong -pie
    SOLIBS = -lz -lpthread -lrt -lrt -ldl -lcrypt -lm
    LANG =
    LC_ALL =
    LC_CTYPE =
    MFLAGS =
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

generating id.h
executable host ruby is required. use --with-baseruby option.
uncommon.mk:1055: recipe for target 'id.h' failed

I found some old forum post which suggests that the issue is that we're cleaning before compiling, and the cleanup deletes files which are needed for the compilation:

https://github.com/postmodern/ruby-install/blob/402cbdeaffb99d105ecd9b93c75828b32f0f382f/bin/ruby-install#L47-L51

Is it possible for the cleanup step to be moved further down? Maybe even after the install step?

postmodern commented 4 years ago

We could remove the clean step entirely and just hope that ./configure and the Makefile are smart enough to regenerate any pre-existing artifacts?

judofyr commented 4 years ago

Ah, so the purpose of the clean step is to handle the case where you've tried to compile it once and you're trying again? Then it will use the same directory?

if so, maybe it's better to remove the cleaning step and instead support --clean which will re-download. Seems like a more sensible "clean" operation than make clean.

postmodern commented 4 years ago

@judofyr could you do a quick test in your environment to whether make clean is the culprit? That forum post mentioned make distclean which is different. If make clean is being problematic, then it will need to be removed.