How to install the bootsnap gem?

@sam I managed to install the snappy gem by executing apt install libsnappy-dev, but I’m not sure what’s missing in order to install the bootsnap gem on my Ubuntu 16.10 machine. What’s the trick to get this working? :wink:

I’m getting the following error:
error: enumerator value for ‘RUBY_FL_USER19’ is not an integer constant expression [-Werror=pedantic]

The complete logfile:

current directory: /home/gerhard/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bootsnap-0.2.10/ext/bootsnap
/home/gerhard/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20170425-62270-exmesk.rb extconf.rb
creating Makefile

current directory: /home/gerhard/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bootsnap-0.2.10/ext/bootsnap
make "DESTDIR=" clean

current directory: /home/gerhard/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bootsnap-0.2.10/ext/bootsnap
make "DESTDIR="
compiling bootsnap.c
In file included from /home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby.h:33:0,
                 from bootsnap.h:6,
                 from bootsnap.c:1:
/home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:834:45: error: enumerator value for ‘RUBY_FL_USER19’ is not an integer constant expression [-Werror=pedantic]
 #define RUBY_FL_USER_N(n) RUBY_FL_USER##n = (1<<(RUBY_FL_USHIFT+n))
                                             ^
/home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:855:5: note: in expansion of macro ‘RUBY_FL_USER_N’
     RUBY_FL_USER_N(19),
     ^~~~~~~~~~~~~~
In file included from /home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:1985:0,
                 from /home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby.h:33,
                 from bootsnap.h:6,
                 from bootsnap.c:1:
/home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:922:29: error: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void rb_timespec_now(struct timespec *);
                             ^~~~~~~~
/home/gerhard/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:925:41: error: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 VALUE rb_time_timespec_new(const struct timespec *, int);
                                         ^~~~~~~~
cc1: error: unrecognized command line option ‘-Wno-keyword-macro’ [-Werror]
cc1: all warnings being treated as errors
Makefile:238: recipe for target 'bootsnap.o' failed
make: *** [bootsnap.o] Error 1

make failed, exit code 2
3 Likes

Ouch,

Do you mind opening this issue here:

https://github.com/Shopify/bootsnap/issues

I just commented bootsnap out for now :frowning: Gemfile does not support a clean way to avoid installing a gem on a specific platform

3 Likes

Interesting, this installs fine on our CI and docker image… I wonder if this is cause you are not using gcc?

Well, gcc is installed… Tomorrow I’ll take a closer look and test it in another VM.
I’ll submit a bug report if it doesn’t work there either.

A repro would be awesome, @burke has been super responsive.

3 Likes

I tried installing it on a fresh Ubuntu 17.04, but it fails with the same error.

https://github.com/Shopify/bootsnap/issues/15

3 Likes

@burke fixed the problem in version 0.2.12. It’s now possible to install the bootsnap gem on Linux.

On Ubuntu developers must install the libsnappy-dev package, otherwise the installation of the snappy gem will fail.

I submitted a PR which updates the script used in the Beginners Guide to Install Discourse on Ubuntu for Development accordingly.

https://github.com/techAPJ/install-rails/pull/4

4 Likes