Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error with non-trivial designated initializers when installing unf_ext (0.0.9) on Ruby 2.3.1 on Linux #74

Closed
ABHIJITH-EA opened this issue Nov 13, 2023 · 16 comments · Fixed by #75 or chef/chef#14115

Comments

@ABHIJITH-EA
Copy link

ABHIJITH-EA commented Nov 13, 2023

Issue Summary

I am encountering an issue while trying to install the unf_ext gem. The installation fails with a compilation error, and I believe it might be related to non-trivial designated initializers.

Environment

  • Ruby version: 2.3.1
  • Operating system: Linux
  • Installation command: gem install unf_ext -v 0.0.9

Error Message

Building native extensions. This could take a while...
ERROR: Error installing unf_ext:
ERROR: Failed to build gem native extension.

current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
/opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20231113-4568-rh260p.rb extconf.rb
checking for main() in -lstdc++... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/unf_ext-0.0.9/mkmf.log

current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR=" clean

current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR="
compiling unf.cc
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
   };
   ^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
make: *** [unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9 for inspection.
Results logged to /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/unf_ext-0.0.9/gem_make.out

Additional Information

I have checked the mkmf.log file, and it seems to be pointing to an issue with non-trivial designated initializers. I am using Ruby 2.3.1 on a Linux system, and the installation command used is as mentioned above.

@meineerde
Copy link

This appears to be caused by #72 along with a specific (?) version of g++.

@ABHIJITH-EA Please add details about your specific operating system (i.e. distribution and version) as well as your specific g++ version.

@ABHIJITH-EA
Copy link
Author

@meineerde
Thanks for the response. Here are the details:
OS: Amazon Linux AMI 2016.09 (Based on RHEL)
g++ Version: 4.8.3 20140911 (Red Hat 4.8.3-9)

@ABHIJITH-EA ABHIJITH-EA closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
@ABHIJITH-EA ABHIJITH-EA reopened this Nov 13, 2023
@vbatychko-modeln
Copy link

vbatychko-modeln commented Nov 13, 2023

I have the same issue on Amazon Linux II,
$ g++ --version
g++ (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)
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.

compiling unf.cc
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
   };
   ^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
make: *** [unf.o] Error 1

...

An error occurred while installing unf_ext (0.0.9), and Bundler cannot continue

@vibro
Copy link

vibro commented Nov 13, 2023

We're also seeing this on Centos7:

$  cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
$  g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 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.

Error message is same as above

compiling unf.cc
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not
supported
   };
   ^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not
supported
make: *** [unf.o] Error 1

@jepalenz
Copy link

jepalenz commented Nov 13, 2023

Another one here in Linux machine:

$ gcc --version
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)
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.

Ruby version: 3.2.2

@NZaur
Copy link

NZaur commented Nov 13, 2023

g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 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.

ruby -v
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-linux]

@koppen
Copy link

koppen commented Nov 13, 2023

And another combo:

$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Ruby 3.0.1

@ahasunos
Copy link

Similar issue with el7, debian9, ubuntu 16 and ubuntu 18 using ruby 3.1.0

@APeter0807
Copy link

Also observed on Amazon Linux 2 running the following Ruby/GCC combination:

ruby 2.3.5p376
gcc (GCC) 7.3.1

@acLebert
Copy link

Same issue causing all of our pipelines to fail to deploy.

Ruby ruby 2.6.6p146

Will update when I get a resp back from our Infru regarding out GCC combo we use.

@loudgazelle
Copy link

adding to the group:

ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
Oracle Linux Server release 7.9
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)
12:11:07 $ cat /opt/chef/embedded/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/unf_ext-0.0.9/gem_make.out
current directory: /opt/chef/embedded/lib/ruby/gems/2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
/opt/chef/embedded/bin/ruby -I /opt/chef/embedded/lib/ruby/2.7.0 -r ./siteconf20231113-2927-omq67z.rb extconf.rb
checking for -lstdc++... yes
creating Makefile

current directory: /opt/chef/embedded/lib/ruby/gems/2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR=" clean

current directory: /opt/chef/embedded/lib/ruby/gems/2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR="
compiling unf.cc
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
   };
   ^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
make: *** [unf.o] Error 1

make failed, exit code 2

@lemsx1
Copy link

lemsx1 commented Nov 13, 2023

+1

any workarounds?

@lemsx1
Copy link

lemsx1 commented Nov 13, 2023

This patch fixed the issue for me ^^^

Can the offending gem be removed from rubygems.org?

@davidplappert
Copy link

Just ran into this issue.

@onurkoncaoglu
Copy link

onurkoncaoglu commented Nov 14, 2023

+1 here,

Installing unf_ext 0.0.9 (was 0.0.8.2) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/rvm/gems/ruby-2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
/usr/local/rvm/rubies/ruby-2.7.0/bin/ruby -I
/usr/local/rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0 -r
./siteconf20231114-5774-ujxoi3.rb extconf.rb
checking for -lstdc++... yes
creating Makefile

current directory: /usr/local/rvm/gems/ruby-2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.7.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR="
compiling unf.cc
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not
supported
   };
   ^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not
supported
make: *** [unf.o] Error 1

make failed, exit code 2

@clintmod
Copy link

Unitl the fix is published you can pin your project to the old version by adding this to your Gemfile

gem 'unf_ext', '= 0.0.8'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.