SciRuby / nmatrix

Dense and sparse linear algebra library for Ruby via SciRuby
Other
469 stars 133 forks source link

NMatrix installs but fails to be required on Alpine Linux #540

Closed georgephillips closed 8 years ago

georgephillips commented 8 years ago

I am running alpine in a docker image and running ruby code. This successfully installs all packages but fails when I try require nmatrix. I have stripped out many of the additional libraries to find a minimal test.

Here is the Dockerfile:

FROM alpine:3.4

RUN apk upgrade --update \
    && apk add libatomic readline readline-dev libxml2 libxml2-dev \
        libxslt libxslt-dev zlib-dev zlib ruby yaml \
        yaml-dev libffi-dev build-base git nodejs \
        ruby-io-console ruby-irb ruby-json ruby-rake \
        make gsl gsl-dev \
        gcc g++ libffi-dev ruby-dev tzdata

RUN gsl-config --cflags
RUN gem install --no-document narray nmatrix gsl
ADD scripts/gsl-test.rb test.rb
RUN ruby test.rb

The test file is:

require 'nmatrix'

Running docker build . produces the following output:

Sending build context to Docker daemon    20 MB
Step 0 : FROM alpine:3.4
 ---> ad84c222f6a3
Step 1 : RUN apk upgrade --update       && apk add libatomic readline readline-dev libxml2 libxml2-dev      libxslt libxslt-dev zlib-dev zlib ruby yaml         yaml-dev libffi-dev build-base git nodejs           ruby-io-console ruby-irb ruby-json ruby-rake    make gsl gsl-dev                gcc g++ libffi-dev ruby-dev tzdata
 ---> Running in c907945badf9
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/3) Upgrading musl (1.1.14-r10 -> 1.1.14-r11)
(2/3) Upgrading busybox (1.24.2-r9 -> 1.24.2-r11)
Executing busybox-1.24.2-r11.post-upgrade
(3/3) Upgrading musl-utils (1.1.14-r10 -> 1.1.14-r11)
Executing busybox-1.24.2-r11.trigger
OK: 5 MiB in 11 packages
(1/57) Installing binutils-libs (2.26-r0)
(2/57) Installing binutils (2.26-r0)
(3/57) Installing gmp (6.1.0-r0)
(4/57) Installing isl (0.14.1-r0)
(5/57) Installing libgomp (5.3.0-r0)
(6/57) Installing libatomic (5.3.0-r0)
(7/57) Installing libgcc (5.3.0-r0)
(8/57) Installing pkgconf (0.9.12-r0)
(9/57) Installing pkgconfig (0.25-r1)
(10/57) Installing mpfr3 (3.1.2-r0)
(11/57) Installing mpc1 (1.0.3-r0)
(12/57) Installing libstdc++ (5.3.0-r0)
(13/57) Installing gcc (5.3.0-r0)
(14/57) Installing make (4.1-r1)
(15/57) Installing musl-dev (1.1.14-r11)
(16/57) Installing libc-dev (0.7-r0)
(17/57) Installing fortify-headers (0.8-r0)
(18/57) Installing g++ (5.3.0-r0)
(19/57) Installing build-base (0.4-r1)
(20/57) Installing ca-certificates (20160104-r4)
(21/57) Installing libssh2 (1.7.0-r0)
(22/57) Installing libcurl (7.50.1-r0)
(23/57) Installing expat (2.1.1-r1)
(24/57) Installing pcre (8.38-r1)
(25/57) Installing git (2.8.3-r0)
(26/57) Installing gsl (1.16-r0)
(27/57) Installing gsl-dev (1.16-r0)
(28/57) Installing libffi (3.2.1-r2)
(29/57) Installing libffi-dev (3.2.1-r2)
(30/57) Installing libxml2 (2.9.4-r0)
(31/57) Installing zlib-dev (1.2.8-r2)
(32/57) Installing libxml2-dev (2.9.4-r0)
(33/57) Installing libgpg-error (1.22-r0)
(34/57) Installing libgcrypt (1.7.0-r0)
(35/57) Installing libxslt (1.1.29-r0)
(36/57) Installing libxslt-dev (1.1.29-r0)
(37/57) Installing libuv (1.9.1-r0)
(38/57) Installing nodejs (6.2.0-r0)
(39/57) Installing ncurses-terminfo-base (6.0-r7)
(40/57) Installing ncurses-terminfo (6.0-r7)
(41/57) Installing ncurses-libs (6.0-r7)
(42/57) Installing readline (6.3.008-r4)
(43/57) Installing readline-dev (6.3.008-r4)
(44/57) Installing libedit (20150325.3.1-r3)
(45/57) Installing gdbm (1.11-r1)
(46/57) Installing yaml (0.1.6-r1)
(47/57) Installing ruby-libs (2.3.1-r0)
(48/57) Installing ruby (2.3.1-r0)
(49/57) Installing libgmpxx (6.1.0-r0)
(50/57) Installing gmp-dev (6.1.0-r0)
(51/57) Installing ruby-dev (2.3.1-r0)
(52/57) Installing ruby-io-console (2.3.1-r0)
(53/57) Installing ruby-irb (2.3.1-r0)
(54/57) Installing ruby-json (2.3.1-r0)
(55/57) Installing ruby-rake (2.3.1-r0)
(56/57) Installing tzdata (2016d-r0)
(57/57) Installing yaml-dev (0.1.6-r1)
Executing busybox-1.24.2-r11.trigger
Executing ca-certificates-20160104-r4.trigger
OK: 254 MiB in 68 packages
 ---> c01272a06100
Removing intermediate container c907945badf9
Step 2 : RUN gsl-config --cflags
 ---> Running in 1581edf34c84
-I/usr/include
 ---> 426b0214eb08
Removing intermediate container 1581edf34c84
Step 3 : RUN gem install --no-document narray nmatrix gsl
 ---> Running in 685d77346510
Building native extensions.  This could take a while...
Successfully installed narray-0.6.1.2
Successfully installed backports-3.6.8
Successfully installed packable-1.3.8
Building native extensions.  This could take a while...
***********************************************************
Welcome to SciRuby: Tools for Scientific Computing in Ruby!

NMatrix requires a C compiler, and has been tested only
with GCC 4.6+. We are happy to accept contributions
which improve the portability of this project.

If you are upgrading from NMatrix 0.1.0 and rely on
ATLAS features, please check the README.

Faster matrix calculations and more advanced linear
algebra features are available by installing either
the nmatrix-atlas or nmatrix-lapacke plugins.

More explicit instructions for NMatrix and SciRuby should
be available on the SciRuby website, sciruby.com, or
through our mailing list (which can be found on our web-
site).

Thanks for trying out NMatrix! Happy coding!

***********************************************************
Successfully installed nmatrix-0.2.3
Building native extensions.  This could take a while...

    gsl can be installed with or without narray support. Please install
    narray before and reinstall gsl if it is missing.

    gsl is also now compatible with NMatrix. Please install nmatrix before
    installing gsl.

Successfully installed gsl-2.1.0.1
5 gems installed
 ---> b97742119f16
Removing intermediate container 685d77346510
Step 4 : ADD scripts/gsl-test.rb test.rb
 ---> 02fb3361d498
Removing intermediate container 7920a6d7f1b6
Step 5 : RUN ruby test.rb
 ---> Running in 8e4974e907fb
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': superclass mismatch for class NMatrix (TypeError)
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.3/lib/nmatrix/nmatrix.rb:38:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.3/lib/nmatrix.rb:28:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from test.rb:2:in `<main>'
The command '/bin/sh -c ruby test.rb' returned a non-zero code: 1

Any assistance would be greatly appreciated.

wlevine commented 8 years ago

Is this a conflict between narray and nmatrix? Can you see what happens when you don't install narray?

wlevine commented 8 years ago

You can also trying doing require 'nmatrix/nmatrix' if you also need narray to be installed. See https://github.com/SciRuby/nmatrix#narray-compatibility

Let us know if this works.

georgephillips commented 8 years ago

Removing narray works perfectly, I can now require nmatrix. Sadly I got an error with gsl now but i'll make a different issue for that. Thanks for the help.

georgephillips commented 8 years ago

I created the new issue at https://github.com/SciRuby/rb-gsl/issues/40. In case anyone is hitting the same issues. Thanks again for your help.