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

Installation of Snappy failing on Alpine despite system dependencies being installed #38

Open
garybethea opened this issue Feb 16, 2021 · 3 comments

Comments

@garybethea
Copy link

Alpine installation log:

(1/1) Upgrading apk-tools (2.10.4-r3 -> 2.10.5-r0)
Executing busybox-1.31.1-r9.trigger
Continuing the upgrade transaction with new apk-tools:
(1/10) Upgrading musl (1.1.24-r2 -> 1.1.24-r3)
(2/10) Upgrading libcrypto1.1 (1.1.1d-r3 -> 1.1.1i-r0)
(3/10) Upgrading ncurses-terminfo-base (6.1_p20200118-r2 -> 6.1_p20200118-r4)
(4/10) Upgrading ncurses-libs (6.1_p20200118-r2 -> 6.1_p20200118-r4)
(5/10) Upgrading libssl1.1 (1.1.1d-r3 -> 1.1.1i-r0)
(6/10) Upgrading ca-certificates-cacert (20191127-r1 -> 20191127-r2)
(7/10) Upgrading ca-certificates (20191127-r1 -> 20191127-r2)
(8/10) Upgrading libgcc (9.2.0-r4 -> 9.3.0-r0)
(9/10) Upgrading libstdc++ (9.2.0-r4 -> 9.3.0-r0)
(10/10) Upgrading musl-utils (1.1.24-r2 -> 1.1.24-r3)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 19 MiB in 36 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/45) Installing m4 (1.4.18-r1)
(2/45) Installing libbz2 (1.0.8-r1)
(3/45) Installing perl (5.30.3-r0)
(4/45) Installing autoconf (2.69-r2)
(5/45) Installing automake (1.16.1-r0)
(6/45) Installing bash (5.0.11-r1)
Executing bash-5.0.11-r1.post-install
(7/45) Installing binutils (2.33.1-r0)
(8/45) Installing libmagic (5.37-r1)
(9/45) Installing file (5.37-r1)
(10/45) Installing isl (0.18-r0)
(11/45) Installing libgomp (9.3.0-r0)
(12/45) Installing libatomic (9.3.0-r0)
(13/45) Installing mpfr4 (4.0.2-r1)
(14/45) Installing mpc1 (1.1.0-r1)
(15/45) Installing gcc (9.3.0-r0)
(16/45) Installing musl-dev (1.1.24-r3)
(17/45) Installing libc-dev (0.7.2-r0)
(18/45) Installing g++ (9.3.0-r0)
(19/45) Installing make (4.2.1-r2)
(20/45) Installing fortify-headers (1.1-r0)
(21/45) Installing build-base (0.5-r1)
(22/45) Installing nghttp2-libs (1.40.0-r1)
(23/45) Installing libcurl (7.67.0-r3)
(24/45) Installing expat (2.2.9-r1)
(25/45) Installing pcre2 (10.34-r1)
(26/45) Installing git (2.24.3-r0)
(27/45) Installing perl-error (0.17028-r0)
(28/45) Installing perl-git (2.24.3-r0)
(29/45) Installing git-perl (2.24.3-r0)
(30/45) Installing less (551-r0)
(31/45) Installing libexecinfo (1.1-r1)
(32/45) Installing libltdl (2.4.6-r7)
(33/45) Installing libtool (2.4.6-r7)
(34/45) Installing c-ares (1.15.0-r0)
(35/45) Installing libuv (1.34.0-r0)
(36/45) Installing nodejs-current (13.1.0-r0)
(37/45) Installing openssl-dev (1.1.1i-r0)
(38/45) Installing db (5.3.28-r1)
(39/45) Installing libsasl (2.1.27-r5)
(40/45) Installing libldap (2.4.48-r3)
(41/45) Installing libpq (12.5-r0)
(42/45) Installing postgresql-libs (12.5-r0)
(43/45) Installing postgresql-dev (12.5-r0)
(44/45) Installing snappy (1.1.7-r1)
(45/45) Installing tzdata (2021a-r0)

Fails on gem install with the message:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/snappy-0.2.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.6.0 -r
./siteconf20210216-26-1tjmftx.rb extconf.rb
checking for -lsnappy... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Looks like it's looking for a package called lsnappy not mentioned in the Readme.

@miyucy
Copy link
Owner

miyucy commented Feb 17, 2021

Ah, I see. perhap need snappy-dev?

FROM ruby:alpine
RUN apk add snappy-dev make gcc g++ libc-dev
require "bundler/inline"
gemfile do
  source "https://rubygems.org"
  gem "snappy"
end
p Snappy.inflate(Snappy.deflate(File.read("/etc/os-release"))) == File.read("/etc/os-release")
cat <<EOF | docker build -t snappy -
> FROM ruby:alpine
RUN apk add snappy-dev make gcc g++ libc-dev
EOF
[+] Building 0.1s (6/6) FINISHED                                                                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 104B                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/ruby:alpine                                                                                                                        0.0s
 => [1/2] FROM docker.io/library/ruby:alpine                                                                                                                                          0.0s
 => CACHED [2/2] RUN apk add snappy-dev make gcc g++ libc-dev                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                               0.0s
 => => writing image sha256:5721543b590ea86e84dfd89f67c0478b8097b27cec68b286e34478c14155a004                                                                                          0.0s
 => => naming to docker.io/library/snappy 
docker run -it --rm snappy
irb(main):001:0> require "bundler/inline"
=> true
irb(main):002:1* gemfile do
irb(main):003:1*   source "https://rubygems.org"
irb(main):004:1*   gem "snappy"
irb(main):005:0> end
=> [<Bundler::Dependency type=:runtime name="snappy" requirements=">= 0">]
irb(main):006:0> p Snappy.inflate(Snappy.deflate(File.read("/etc/os-release"))) == File.read("/etc/os-release")
true
=> true
irb(main):007:0> 

@miyucy
Copy link
Owner

miyucy commented Feb 17, 2021

Or, need cmake (if wants to build from source)

cat <<EOF | docker build -t snappy -
FROM ruby:alpine
RUN apk add make gcc g++ libc-dev cmake
EOF
[+] Building 16.5s (6/6) FINISHED                                                                                                                                                          
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 99B                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/ruby:alpine                                                                                                                        0.0s
 => CACHED [1/2] FROM docker.io/library/ruby:alpine                                                                                                                                   0.0s
 => [2/2] RUN apk add make gcc g++ libc-dev cmake                                                                                                                                    15.1s
 => exporting to image                                                                                                                                                                1.3s 
 => => exporting layers                                                                                                                                                               1.3s 
 => => writing image sha256:acc951c81ee1d8122f235b39354807e54a4800f38cb336e7044f9cb5706b046b                                                                                          0.0s 
 => => naming to docker.io/library/snappy    

docker run -it --rm snappy          
irb(main):001:0> require "bundler/inline"
=> true
irb(main):002:1* gemfile do
irb(main):003:1*   source "https://rubygems.org"
irb(main):004:1*   gem "snappy"
irb(main):005:1* end
=> [<Bundler::Dependency type=:runtime name="snappy" requirements=">= 0">]
irb(main):006:0> p Snappy.inflate(Snappy.deflate(File.read("/etc/os-release"))) == File.read("/etc/os-release")
true
=> true
irb(main):007:0> 

@miyucy
Copy link
Owner

miyucy commented Feb 17, 2021

So, Could you try with apk add snappy-dev or apk add cmake ?

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

No branches or pull requests

2 participants