Project

General

Profile

Actions

Bug #16845

closed

Building Ruby with system Ruby 1.8.7 results in make failing due to syntax error in ./tool/lib/vcs.rb

Added by ErikSwan (Erik Swan) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:98241]

Description

Hello,

I am trying to build Ruby 2.7.1 from source on a RHEL 6.9 system, which has ruby 1.8.7 as the existing system Ruby. When I run make, I get an error about a syntax error in ./tool/lib/vcs.rb, which is called by ./tool/file2lastrev.rb. I am guessing this is because vcs.rb uses Ruby syntax that was introduced in a newer Ruby version, and is not valid in 1.8.7, resulting in a runtime error.

Here is a snippet of the error:

./tool/file2lastrev.rb:10:in `require': /tmp/eswan/ruby-2.7.1/tool/lib/vcs.rb:471: syntax error, unexpected ',', expecting ']' (SyntaxError)
      last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', ref]]).rstrip
                                           ^
/tmp/eswan/ruby-2.7.1/tool/lib/vcs.rb:471: syntax error, unexpected ',', expecting kEND

Steps to reproduce:

  1. Obtain a RHEL 6.8 or 6.9 system (this is also reproducible on 6.8, and might be reproducible on all 6.x)
  2. Confirm /usr/bin/ruby --version reports Ruby 1.8.7.
  3. Download and extract the Ruby 2.7.1 source archive.
  4. Run ./configure
  5. Run ./make

Expected behavior:

make should run correctly without any errors.

Actual behavior:

The Makefile errors out when trying to run ./tool/file2lastrev.rb with the existing system Ruby.

A shell log showing steps to reproduce and the output of configure and make is attached.


Files

ruby_build_error.log (573 KB) ruby_build_error.log ErikSwan (Erik Swan), 05/09/2020 10:55 PM
ruby_build_error_with_-p.log (572 KB) ruby_build_error_with_-p.log ErikSwan (Erik Swan), 05/10/2020 03:57 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Misc #16671: BASERUBY version policyClosedhsbt (Hiroshi SHIBATA)Actions
Actions #1

Updated by ErikSwan (Erik Swan) almost 4 years ago

  • File ruby_build_error.log ruby_build_error.log added
  • Subject changed from Building Ruby with old existing system Ruby results in make error with ./tool/file2lastrev.rb to Building Ruby with system Ruby 1.8.7 results in make failing due to syntax error in ./tool/file2lastrev.rb
  • Description updated (diff)

Updated by ErikSwan (Erik Swan) almost 4 years ago

From looking through the ChangeLog, it seems there have been a few changes regarding whether file2lastrev.rb needs to be run with BASERUBY or not, and what version BASERUBY is expected to be:

doc/ChangeLog-2.3.0
34-Thu Dec 24 15:01:38 2015  sorah (Shota Fukumori)  <her@sorah.jp>
35-
36: * tool/file2lastrev.rb: Fix ArgumentError to work on Ruby 1.8.7.
37-

doc/ChangeLog-2.1.0
1400-Thu Nov 28 13:56:05 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>
1401-
1402:   * common.mk (Doxyfile): tool/file2lastrev.rb needs running with
1403-     BASERUBY since r43617.  [ruby-dev:47823] [Bug #9169]
1404-

doc/ChangeLog-1.9.3
16418-Thu Apr 15 21:54:39 2010  Tanaka Akira  <akr@fsij.org>
16419-
16420:  * tool/file2lastrev.rb: use backtick for ruby 1.8.
16421-
16422-Thu Apr 15 21:13:29 2010  NARUSE, Yui  <naruse@ruby-lang.org>
16423-
16424:  * tool/file2lastrev.rb: this should run with ruby 1.8.
16425-

ChangeLog
39876-commit 6b5e712361cca8559ed66d5c1106e888c5971d39
39877-  Author: Takashi Kokubun <takashikkbn@gmail.com>
39878-  Date:   2019-05-29 08:22:02 +0900
39879-
39880-    Make tool/vcs.rb compliant to BASERUBY
39881-
39882-    People seem to consider BASERUBY is either 1.8 or 1.9 now. Since this
39883:    file may be executed by BASERUBY from file2lastrev.rb, I think we should
39884-    not rely on Ruby 2.0 in this file for now.
39885-
39886-commit e1f62d7f0e33de81a194f26a2c57e14e38d9de52
39887-  Author: Takashi Kokubun <takashikkbn@gmail.com>
39888-  Date:   2019-05-29 07:46:44 +0900
39889-
39890:    Check the result of file2lastrev.rb if HAVE_BASERUBY
39891-
39892-    is yes.
39893-
39894:    We ignored the failure status of file2lastrev.rb on 73da429c36c, but it
39895-    was for an environment without BASERUBY. I think we should skip running
39896:    file2lastrev.rb on HAVE_BASERUBY=no, and run it and check the status on
39897-    HAVE_BASERUBY=yes.
39898-
39899:    Otherwise we may have an ignored arbitrary error of file2lastrev.rb on
39900-    HAVE_BASERUBY=yes environment.
39901-
Actions #3

Updated by hsbt (Hiroshi SHIBATA) almost 4 years ago

  • Related to Misc #16671: BASERUBY version policy added

Updated by ErikSwan (Erik Swan) almost 4 years ago

  • Subject changed from Building Ruby with system Ruby 1.8.7 results in make failing due to syntax error in ./tool/file2lastrev.rb to Building Ruby with system Ruby 1.8.7 results in make failing due to syntax error in ./tool/lib/vcs.rb
  • Description updated (diff)

I have updated the title and description to correct where the syntax error is located. It is located in ./tool/lib/vcs.rb, which is called by ./tool/file2lastrev.rb.

From looking at the related issue that Shibata-san linked, it looks like an easy workaround for this is to run ./configure with --with-baseruby=no, since having a BASERUBY seems like it isn't required in most cases when building from the tarball.

Updated by shyouhei (Shyouhei Urabe) almost 4 years ago

It sounds to me that the root cause of this problem is released tarball having BASERUBY dependency.

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

The timestamps in tarball are aligned to avoid to remake files which need BASERUBY.
But extracting without -p option disables it.

04:48 PM [eswan@rndssh1(RnD):/tmp/eswan]$ tar -xJvf ruby-2.7.1.tar.xz

Updated by ErikSwan (Erik Swan) almost 4 years ago

Maybe I am missing something, but I get the same result with -p. Log is attached.

The tar manpage suggests -p is about preserving permissions, not timestamps.

And it looks like the timestamps are preserved even if I don't use the -p option:

09:56 AM [eswan@rndssh1(RnD):/tmp/eswan]$ tar -xJf ruby-2.7.1.tar.xz
09:56 AM [eswan@rndssh1(RnD):/tmp/eswan]$ ll ruby-2.7.1/ | head
total 12M
-rw-r--r--  1 eswan eswan 2.1K Mar 31 04:44 aclocal.m4
-rw-r--r--  1 eswan eswan  71K Mar 31 04:44 addr2line.c
-rw-r--r--  1 eswan eswan  442 Mar 31 04:44 addr2line.h
-rw-r--r--  1 eswan eswan 3.8K Mar 31 04:44 appveyor.yml
-rw-r--r--  1 eswan eswan 179K Mar 31 04:44 array.c
-rw-r--r--  1 eswan eswan  22K Mar 31 04:44 ast.c
-rw-r--r--  1 eswan eswan 4.5K Mar 31 04:44 ast.rb
-rw-r--r--  1 eswan eswan 1.8K Mar 31 04:44 ast.rbinc
drwxr-xr-x  2 eswan eswan 4.0K Mar 31 04:44 basictest/

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

OK, since e1f62d7f0e3, if HAVE_BASERUBY=yes then file2lastrev.rb must succeed.

Actions #9

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|c89c3801b985916b6fb6726aab966d28371dfaaa.


BASERUBY have to be 1.9 or later at least [Bug #16845]

Many tools under tool directory haven't worked with ruby 1.8.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0