Project

General

Profile

Backport #8071

Ruby 2.0 ./configure fails with syntax error on Illumos distributions

Added by psanford (Peter Sanford) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:53293]

Description

Trying to build Ruby 2.0 on Illumos distributions, ./configure fails with the following syntax error:

./configure: line 2780: syntax error at line 19075: `(' unexpected

The problem code is in this function:

shvar_to_cpp() {
local var="$1" val="$2"
local exec_prefix_pat="echo \"${exec_prefix}\" | sed 's/\\./\\\\./g'"
local arch_pat="echo \"${arch}\" | sed 's/\\./\\\\./g'"
local sitearch_pat="echo \"${sitearch}\" | sed 's/\\./\\\\./g'"
val="echo '"'"${val}"'"' |
sed \
-e 's/\${\([A-Z][A-Z_]*\)}/"\1"/g' \
-e 's|\${sitearchlibdir}|'"${sitearchlibdir}|g" \
-e 's|\${sitearchincludedir}|'"${sitearchincludedir}|g" \
-e 's|\${archlibdir}|'"${archlibdir}|g" \
-e 's|\${archincludedir}|'"${archincludedir}|g" \
-e 's|\${libdir}|'"${libdir}|g" \
-e 's/\${ruby_version}/"RUBY_LIB_VERSION"/g' \
-e 's/\${arch}/"arch"/g' \
-e 's/\${sitearch}/"arch"/g' \
-e 's/\${vendorarchdir}/"RUBY_VENDOR_ARCH_LIB"/g' \
-e 's/\${sitearchdir}/"RUBY_SITE_ARCH_LIB"/g' \
-e 's/\${vendorlibdir}/"RUBY_VENDOR_LIB2"/g' \
-e 's/\${sitelibdir}/"RUBY_SITE_LIB2"/g' \
-e 's/\${vendordir}/"RUBY_VENDOR_LIB"/g' \
-e 's/\${sitedir}/"RUBY_SITE_LIB"/g' \
-e 's/\${rubylibdir}/"RUBY_LIB"/g' \
-e 's/\${rubylibprefix}/"RUBY_LIB_PREFIX"/g' \
-e 's/\${rubyarchprefix}/"RUBY_ARCH_PREFIX_FOR(arch)"/g' \
-e 's/\${rubysitearchprefix}/"RUBY_SITEARCH_PREFIX_FOR(arch)"/g' \
-e 's/\${exec_prefix}/"RUBY_EXEC_PREFIX"/g' \
-e "s|${exec_prefix_pat}/|"'"RUBY_EXEC_PREFIX"/|g' \
-e "s|${arch_pat}|"'"arch"|g' \
-e "s|${sitearch_pat}|"'"sitearch"|g' \
-e 's|^\"NONE/|RUBY_EXEC_PREFIX\"/|' \
-e 's|^\"NONE\"|\"'"${prefix}"'\"|' \
-e 's/^\"\"\(.\)/\1/;s/\(.\)\"\"$/\1/'
"
eval $var='"$val"'
}

Specifically these two lines:
-e 's/\${rubyarchprefix}/"RUBY_ARCH_PREFIX_FOR(arch)"/g' \
-e 's/\${rubysitearchprefix}/"RUBY_SITEARCH_PREFIX_FOR(arch)"/g' \

I tested this on both SmartOS and OmniOS. On both of these distributions /bin/sh is ksh93.

I was able to work around this problem by using the GNU version of sh or bash instead of /bin/sh.


Related issues

Related to Backport200 - Backport #7959: configure contains non-portable shell codeRejectedActions
Has duplicate Backport200 - Backport #8387: Compiling Ruby 2.0 on SunOSClosed05/10/2013Actions

Associated revisions

Revision 120e2219
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 39741
Added by nobu (Nobuyoshi Nakada) over 6 years ago

configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]

Revision 1c0abbf0
Added by nagachika (Tomoyuki Chikanaga) over 6 years ago

merge revision(s) 39636,39741,40454: [Backport #8071] [Backport #8387]

    configure.in: suppress error messages

    * configure.in: suppress error messages, rm: cannot remove

'conftest.dSYM', from AC_EGREP_CPP with CFLAGS=-g on Darwin.
* configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
available on old shells.

    * configure.in (shvar_to_cpp): escape quotes for old shells.
      [Bug #7959] [Bug #8071]

    * configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
      autoconf 2.69 or earlier on darwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40647
Added by nagachika (Tomoyuki Chikanaga) over 6 years ago

merge revision(s) 39636,39741,40454: [Backport #8071] [Backport #8387]

configure.in: suppress error messages

* configure.in: suppress error messages, rm: cannot remove

'conftest.dSYM', from AC_EGREP_CPP with CFLAGS=-g on Darwin.
* configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
available on old shells.

* configure.in (shvar_to_cpp): escape quotes for old shells.
  [Bug #7959] [Bug #8071]

* configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
  autoconf 2.69 or earlier on darwin.

History

#1

Updated by kernigh (George Koehler) over 6 years ago

This bug looks almost like bug #7959 (configure problem with OpenBSD). This bug might not be exactly the same, so I don't know if the fix for bug #7959 would also fix this bug.

Updated by luislavena (Luis Lavena) over 6 years ago

  • Category set to build
  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
RubyInstaller CI seems to be suffering something related to this too:

http://ci.rubyinstaller.org/job/ruby-2_0_0-x64-build/35/console

../configure: line 19620: syntax error near unexpected token [_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\'
../configure: line 19620:
s/\([$as_cr_alnum]*_cv[_$as_cr_alnum]\)=\(.\)/\1='\2'/p"'
=end

#3

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39741.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


configure.in: fix for old shells

  • configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not available on old shells.
  • configure.in (shvar_to_cpp): escape quotes for old shells. [Bug #7959] [Bug #8071]
#4

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Category deleted (build)
  • Status changed from Closed to Assigned
  • Assignee changed from nobu (Nobuyoshi Nakada) to nagachika (Tomoyuki Chikanaga)
#5

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40647.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39636,39741,40454: [Backport #8071] [Backport #8387]

configure.in: suppress error messages

* configure.in: suppress error messages, rm: cannot remove

'conftest.dSYM', from AC_EGREP_CPP with CFLAGS=-g on Darwin.
* configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
available on old shells.

* configure.in (shvar_to_cpp): escape quotes for old shells.
  [Bug #7959] [Bug #8071]

* configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
  autoconf 2.69 or earlier on darwin.

Also available in: Atom PDF