Opened 6 years ago

Closed 4 years ago

#58255 closed defect (fixed)

ruby +universal: config.h: error: invalid suffix on literal; C++11 requires a space between literal and identifier

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: kimuraw (kimura wataru)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: ruby19 ruby21 ruby22 ruby23 ruby24 ruby25 ruby26

Description

When installed with the +universal variant, most of the ruby ports install a config.h that is incompatible with C++11, at least in recent versions of clang; this causes software that compiles ruby modules with C++11 to fail:

:info:build /opt/local/include/ruby-2.1.0/universal-darwin17/ruby/config.h:340:31: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
:info:build #define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
:info:build                               ^
:info:build
:info:build /opt/local/include/ruby-2.1.0/universal-darwin17/ruby/config.h:341:35: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
:info:build #define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
:info:build                                   ^
:info:build
:info:build /opt/local/include/ruby-2.1.0/universal-darwin17/ruby/config.h:341:55: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
:info:build #define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
:info:build                                                       ^
:info:build
:info:build 3 errors generated.
$ port installed | grep 'ruby.*+universal'
  ruby @1.8.7-p374_7+universal (active)
  ruby19 @1.9.3-p551_8+doc+universal (active)
  ruby20 @2.0.0-p648_6+universal (active)
  ruby21 @2.1.9_5+universal (active)
  ruby22 @2.2.10_3+universal (active)
  ruby23 @2.3.8_2+universal (active)
  ruby24 @2.4.5_2+universal (active)
  ruby25 @2.5.3_2+universal (active)
  ruby26 @2.6.1_0+universal (active)
$ grep universal /opt/local/include/ruby*/*/ruby/config.h
/opt/local/include/ruby-1.9.1/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-1.9.1/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.1.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.1.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.2.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.2.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.3.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.3.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.4.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.4.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.5.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.5.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.6.0/universal-darwin17/ruby/config.h:#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
/opt/local/include/ruby-2.6.0/universal-darwin17/ruby/config.h:#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS

ruby and ruby20 seem to be unaffected. But the other ports are.

Even the versions of ruby Apple ships with macOS exhibit this problem.

I imagine the fix is as simple as adding spaces where needed.

The problem needs to be reported to the developers of ruby so that they can fix it in all of the supported versions of ruby, but we'll probably need to backport the patch to those versions that we have in MacPorts that are no longer supported.

Change History (1)

comment:1 Changed 4 years ago by kimuraw (kimura wataru)

Resolution: fixed
Status: assignedclosed

In b5cdf65240aee3a151601292cf269e27717f22f0/macports-ports (master):

lang/ruby26 .. ruby19: fix "invalid suffix on literal" with C++11

insert spaces between literal and identifier in config.h.

before
#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS

after
#define RUBY_ARCH "universal-" RUBY_PLATFORM_OS
#define RUBY_PLATFORM "universal." RUBY_PLATFORM_CPU "-" RUBY_PLATFORM_OS

note: ruby-2.5 or earlier, configure does not accept "--with-arch=arm64"

Closes: #58255

Note: See TracTickets for help on using tickets.