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

Can't require gsl on Alpine Linux - Error relocating gsl_native.so: gsl_multifit_fdfsolver_jac: symbol not found #40

Open
georgephillips opened this issue Sep 4, 2016 · 4 comments
Labels

Comments

@georgephillips
Copy link

georgephillips commented Sep 4, 2016

I am running alpine in a docker image and running ruby code. This successfully installs all packages but fails when I try require gsl. 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 nmatrix gsl
ADD scripts/gsl-test.rb test.rb
RUN ruby test.rb

The test file is:

require 'gsl'

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
 ---> Using cache
 ---> b7f66d6f2bd7
Step 2 : RUN gsl-config --cflags
 ---> Using cache
 ---> b5acc8868a74
Step 3 : RUN gem install --no-document nmatrix gsl
 ---> Using cache
 ---> 2623683a706e
Step 4 : ADD scripts/gsl-test.rb test.rb
 ---> e4388f952198
Removing intermediate container 743340a3be60
Step 5 : RUN ruby test.rb
 ---> Running in c53a34ece153
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl_native.so: gsl_multifit_fdfsolver_jac: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl_native.so (LoadError)
        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/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
        from /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl.rb:11: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:1:in `<main>'
The command '/bin/sh -c ruby test.rb' returned a non-zero code: 1

Any assistance would be greatly appreciated.

@georgephillips
Copy link
Author

Any able to help on this? Is there anything I can provide to further debug?

@errm
Copy link

errm commented Jan 31, 2017

I am seeing a similar, but not identical error.

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so: gsl_sf_legendre_Plm_array: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so (LoadError)

repro follows

Dockerfile

FROM alpine:3.5

RUN apk add --no-cache \
  gsl-dev \
  build-base \
  ruby \
  ruby-dev

RUN gem install --no-document gsl

RUN ruby -e "require 'gsl'"

output from docker build

Sending build context to Docker daemon 2.048 kB
Step 1/4 : FROM alpine:3.5
 ---> 88e169ea8f46
Step 2/4 : RUN apk add --no-cache   gsl-dev   build-base   ruby   ruby-dev
 ---> Running in 15651547edfe
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
(1/34) Upgrading musl (1.1.15-r5 -> 1.1.15-r6)
(2/34) Installing binutils-libs (2.27-r0)
(3/34) Installing binutils (2.27-r0)
(4/34) Installing gmp (6.1.1-r0)
(5/34) Installing isl (0.17.1-r0)
(6/34) Installing libgomp (6.2.1-r1)
(7/34) Installing libatomic (6.2.1-r1)
(8/34) Installing pkgconf (1.0.2-r0)
(9/34) Installing libgcc (6.2.1-r1)
(10/34) Installing mpfr3 (3.1.5-r0)
(11/34) Installing mpc1 (1.0.3-r0)
(12/34) Installing libstdc++ (6.2.1-r1)
(13/34) Installing gcc (6.2.1-r1)
(14/34) Installing make (4.2.1-r0)
(15/34) Installing musl-dev (1.1.15-r6)
(16/34) Installing libc-dev (0.7-r1)
(17/34) Installing fortify-headers (0.8-r0)
(18/34) Installing g++ (6.2.1-r1)
(19/34) Installing build-base (0.4-r1)
(20/34) Installing gsl (2.2.1-r0)
(21/34) Installing gsl-dev (2.2.1-r0)
(22/34) Upgrading musl-utils (1.1.15-r5 -> 1.1.15-r6)
(23/34) Installing libffi (3.2.1-r2)
(24/34) Installing gdbm (1.12-r0)
(25/34) Installing ncurses-terminfo-base (6.0-r7)
(26/34) Installing ncurses-terminfo (6.0-r7)
(27/34) Installing ncurses-libs (6.0-r7)
(28/34) Installing readline (6.3.008-r4)
(29/34) Installing yaml (0.1.7-r0)
(30/34) Installing ruby-libs (2.3.3-r0)
(31/34) Installing ruby (2.3.3-r0)
(32/34) Installing libgmpxx (6.1.1-r0)
(33/34) Installing gmp-dev (6.1.1-r0)
(34/34) Installing ruby-dev (2.3.3-r0)
Executing busybox-1.25.1-r0.trigger
OK: 194 MiB in 43 packages
 ---> e9fcef35f552
Removing intermediate container 15651547edfe
Step 3/4 : RUN gem install --no-document gsl
 ---> Running in 5523ef7e4cf3
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.2
1 gem installed
 ---> e50b8ec95f6a
Removing intermediate container 5523ef7e4cf3
Step 4/4 : RUN ruby -e "require 'gsl'"
 ---> Running in b770253835db
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so: gsl_sf_legendre_Plm_array: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so (LoadError)
	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/gsl-2.1.0.2/lib/gsl.rb:11: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 -e:1:in `<main>'
The command '/bin/sh -c ruby -e "require 'gsl'"' returned a non-zero code: 1

@errm
Copy link

errm commented Jan 31, 2017

Interestingly things seem to work with alpine:3.4 (gsl 1.16) and gem version 1.16.0.6 but fail if the gem is upgraded to 2.1.0.2

working:

FROM alpine:3.4

RUN apk add --no-cache \
  gsl-dev \
  build-base \
  ruby \
  ruby-dev \
  ca-certificates

RUN gem install --no-document gsl -v 1.16.0.6

RUN ruby -e "require 'gsl'"

Fails:

FROM alpine:3.4

RUN apk add --no-cache \
  gsl-dev \
  build-base \
  ruby \
  ruby-dev \
  ca-certificates

RUN gem install --no-document gsl -v 2.1.0.2

RUN ruby -e "require 'gsl'"

with:

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so: gsl_multifit_fdfsolver_jac: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so (LoadError)
	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/gsl-2.1.0.2/lib/gsl.rb:11: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 -e:1:in `<main>'

alpine 3.5 (gsl 2.2.1) will not install gem version 1.16.0.6 as expected and 2.1.0.2 fails with:

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so: gsl_sf_legendre_Plm_array: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so (LoadError)
	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/gsl-2.1.0.2/lib/gsl.rb:11: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 -e:1:in `<main>'

so there seems to be some incompatibility with gsl 2.2.1

I tried building an alpine package for gsl 2.1 and 2.0 but these both seem to fail with the same error (despite apparent compatibility with this version in the gem README)

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so: gsl_sf_legendre_Plm_array: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.2/lib/gsl_native.so (LoadError)
	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/gsl-2.1.0.2/lib/gsl.rb:11: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 -e:1:in `<main>'

@errm
Copy link

errm commented Jan 31, 2017

The issue seems to be the use of deprecated functions, in debian/ubuntu the package is patched to be included. When I patch the alpine package to do the same everything works as expected...

So a few points:
a) I am not sure if alpine will want to accept this patch to their gsl package ...
b) The README needs to be updated to make clear that unless gsl is patched to undefine GSL_DISABLE_DEPRECATED the gem is not compatible with gsl > 1.9
c) It seems that gem version ~ 2.1 is not compatible with gsl 1.9
d) Fixing #41 would be the best long term solution...

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

No branches or pull requests

3 participants