lxc / ruby-lxc

ruby bindings for liblxc
https://linuxcontainers.org/lxc
GNU Lesser General Public License v2.1
133 stars 29 forks source link

gem fails to install on ubuntu 18.04 #43

Closed dann1 closed 6 years ago

dann1 commented 6 years ago

Hello, I followed the instructions installing the required packages and when I issue gem install ruby-gems I get errors.

root@lxc-node:~# gem install ruby-lxc
Building native extensions. This could take a while...
ERROR:  Error installing ruby-lxc:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/ruby-lxc-1.2.2/ext/lxc
/usr/bin/ruby2.5 -r ./siteconf20180704-29573-1h4z7yu.rb extconf.rb
checking for lxc_container_new() in -llxc... yes
checking for lxc/lxccontainer.h... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_blocking_region()... no
creating Makefile

current directory: /var/lib/gems/2.5.0/gems/ruby-lxc-1.2.2/ext/lxc
make "DESTDIR=" clean

current directory: /var/lib/gems/2.5.0/gems/ruby-lxc-1.2.2/ext/lxc
make "DESTDIR="
compiling lxc.c
In file included from /usr/include/lxc/lxccontainer.h:31:0,
                 from lxc.c:4:
lxc.c: In function ‘lxc_attach_parse_options’:
lxc.c:572:41: error: ‘EBADF’ undeclared (first use in this function)
     lxc_attach_options_t default_opts = LXC_ATTACH_OPTIONS_DEFAULT;
                                         ^
lxc.c:572:41: note: each undeclared identifier is reported only once for each function it appears in
Makefile:242: recipe for target 'lxc.o' failed
make: *** [lxc.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.5.0/gems/ruby-lxc-1.2.2 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/ruby-lxc-1.2.2/gem_make.out

On Ubuntu 16.04 things work flawlessly

akosiaris commented 6 years ago

Met the same issue. That's because 18.04 ships with LXC 3.0 and I guess this gem hasn't yet been updated. The build problem at least is fixed in 0eb378c291 but is not yet in a release. I 've done locally the gem fetch, gem unpack, gem spec, add missing line, gem build dance and it seems to build fine. Unsure yet however of how compatible the gem is with LXC 3.x

dann1 commented 6 years ago

OK, nice to know, is the gem still supported?

akosiaris commented 6 years ago

I guess that's a question for @andrenth.

dann1 commented 6 years ago

Tried, the local build, it works. However still scared because of the possible death (development stopped almost two years before the last commit)

andrenth commented 6 years ago

Hi

There’s LXC 3.0 and also the ruby version update. For example, the error above is about rb_thread_blocking_region not being found, so I suspect that has to be reviewed too.

Unfortunately I don’t have the time to commit to this review at this moment, but I would gladly accept a PR and release a new version.

akosiaris commented 6 years ago

For what is worth, I 've been using a locally built ruby gem with an LXC 3.0.1 infrastructure with just the patch from 0eb378c without issues for the last 4 days.

aither64 commented 6 years ago

@andrenth, so I've taken a look at rb_thread_blocking_region and I don't think any change is needed. rb_thread_blocking_region was removed in Ruby 2.2 and the replacement is supposed to be rb_thread_call_without_gvl. ruby-lxc already prefers that to rb_thread_blocking_region, so it will only be used by older Ruby versions, but even Ruby 1.9 supports rb_thread_call_without_gvl.

andrenth commented 6 years ago

Ok, that's great. I've just pushed version 1.2.3 to rubygems.org :)