Project

General

Profile

nio4r gem, compiler failed to build with native extension (trying to install redmine_knowledgebase plugin)

Added by Herold Gray over 3 years ago

installed Redmine 4.2 on Ubuntu server 20.04.
No issue with installation, redmine is up and running correctly:

Environment:
  Redmine version                4.2.0.stable
  Ruby version                   2.5.8-p224 (2020-03-31) [x86_64-linux]
  Rails version                  5.2.5
  Environment                    production
  Database adapter               Mysql2

However when trying to install knowledgebase plugin i get compiler build error with nio4r gem:

bruno@Vostro:~/redmine-4.1.1-8/apps/redmine/htdocs/plugins$ git clone git://github.com/alexbevi/redmine_knowledgebase.git
bundle install --no-deployment

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32.
The dependency ffi (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32

Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.....
Fetching rake 13.0.3
Installing rake 13.0.3
Fetching concurrent-ruby 1.1.8
Installing concurrent-ruby 1.1.8
Fetching i18n 1.8.9
Installing i18n 1.8.9
Fetching minitest 5.14.4
Installing minitest 5.14.4
Using thread_safe 0.3.6
Fetching tzinfo 1.2.9
Installing tzinfo 1.2.9
Fetching activesupport 5.2.5
Installing activesupport 5.2.5
Using builder 3.2.4
Fetching erubi 1.10.0
Installing erubi 1.10.0
Fetching mini_portile2 2.5.0
Installing mini_portile2 2.5.0
Fetching racc 1.5.2
Installing racc 1.5.2 with native extensions
Fetching nokogiri 1.11.2 (x86_64-linux)
Installing nokogiri 1.11.2 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Fetching loofah 2.9.0
Installing loofah 2.9.0
Using rails-html-sanitizer 1.3.0
Fetching actionview 5.2.5
Installing actionview 5.2.5
Using rack 2.2.3
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.5
Installing actionpack 5.2.5
Fetching nio4r 2.5.7

Installing nio4r 2.5.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/bruno/redmine-4.2.0-0/ruby/lib/ruby/gems/2.5.0/gems/nio4r-2.5.7/ext/nio4r
/home/bruno/redmine-4.2.0-0/ruby/bin/ruby -r ./siteconf20210329-18642-1yfhj63.rb extconf.rb
checking for unistd.h... yes
checking for linux/aio_abi.h... yes
checking for linux/io_uring.h... yes
checking for sys/select.h... yes
checking for port_event_t in poll.h... no
checking for sys/epoll.h... yes
checking for sys/event.h... no
checking for port_event_t in port.h... no
checking for sys/resource.h... yes
creating Makefile

current directory: /home/bruno/redmine-4.2.0-0/ruby/lib/ruby/gems/2.5.0/gems/nio4r-2.5.7/ext/nio4r
make "DESTDIR=" clean

current directory: /home/bruno/redmine-4.2.0-0/ruby/lib/ruby/gems/2.5.0/gems/nio4r-2.5.7/ext/nio4r
make "DESTDIR=" 
compiling bytebuffer.c
compiling monitor.c
compiling nio4r_ext.c
In file included from nio4r_ext.c:6:
../libev/ev.c:2136:31: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’
2136 | EV_API_DECL struct ev_loop ev_default_loop_ptr = 0; / needs to be initialised to make it a definition
despite extern */
| ^~~~~~~~~~~~~~~~~~~
../libev/ev.c: In function ‘ev_time’:
../libev/ev.c:2172:7: internal compiler error: Illegal instruction
2172 | return EV_TS_GET (ts);
| ^~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
make: *** [Makefile:243: nio4r_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/bruno/redmine-4.2.0-0/ruby/lib/ruby/gems/2.5.0/gems/nio4r-2.5.7 for
inspection.
Results logged to
/home/bruno/redmine-4.2.0-0/ruby/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/nio4r-2.5.7/gem_make.out_

An error occurred while installing nio4r (2.5.7), and Bundler cannot continue.
Make sure that gem install nio4r -v '2.5.7' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile:
redmine_crm was resolved to 0.0.54, which depends on
rails was resolved to 5.2.5, which depends on
actioncable was resolved to 5.2.5, which depends on nio4r

Same compiler build errors when trying to install gem nio4r directly before bundling:
gem install nio4r -v '2.5.7' --source 'https://rubygems.org/'

.../gems/2.5.0/extensions/x86_64-linux/2.5.0-static/nio4r-2.5.7/mkmf.log error log:

...
conftest.c:6:9: error: unknown type name ‘port_event_t’
...
conftest.c:3:10: fatal error: sys/event.h: No such file or directory
...
conftest.c:3:10: fatal error: port.h: No such file or directory
...

Any insights to fix errors ?
Thanks


Replies (1)

RE: nio4r gem, compiler failed to build with native extension (trying to install redmine_knowledgebase plugin) - Added by Pavel Rosický over 3 years ago

It looks like a bug in your compiler, this part is acually relevant

../libev/ev.c: In function ‘ev_time’:
../libev/ev.c:2172:7: internal compiler error: Illegal instruction
2172 | return EV_TS_GET (ts);

could you share your env config? it might be helpful to investigate what's wrong

gcc --version
* and
ruby -e "require 'rbconfig'; puts RbConfig::CONFIG" 

are you able to install any previous version of nio4r?

gem install nio4r -v 2.5.4

I think you should report it to the maintainer https://github.com/socketry/nio4r/issues , there's a pretty low chance anyone could be able to help you here. It's not a bug in Redmine or Redmine plugins. They just use a dependency that doesn't work with your environment for some reason.

    (1-1/1)