toland / patron

Ruby HTTP client based on libcurl
http://toland.github.com/patron/
MIT License
541 stars 74 forks source link

"checking for ruby/thread.h... *** extconf.rb failed ***" when installing on google/cloud-sdk:alpine docker image #183

Closed Nakilon closed 3 years ago

Nakilon commented 3 years ago
$ docker run -ti google/cloud-sdk:alpine sh -c "apk add ruby ruby-dev curl-dev && gem install patron"
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/17) Upgrading libcrypto1.1 (1.1.1g-r0 -> 1.1.1j-r0)
(2/17) Upgrading libssl1.1 (1.1.1g-r0 -> 1.1.1j-r0)
(3/17) Upgrading nghttp2-libs (1.40.0-r0 -> 1.40.0-r1)
(4/17) Upgrading libcurl (7.67.0-r0 -> 7.67.0-r3)
(5/17) Installing pkgconf (1.6.3-r0)
(6/17) Installing openssl-dev (1.1.1j-r0)
(7/17) Installing nghttp2-dev (1.40.0-r1)
(8/17) Installing zlib-dev (1.2.11-r3)
(9/17) Installing curl-dev (7.67.0-r3)
(10/17) Installing yaml (0.2.2-r1)
(11/17) Installing ruby-libs (2.6.6-r3)
(12/17) Installing ruby (2.6.6-r3)
(13/17) Installing libgcc (9.3.0-r0)
(14/17) Installing libstdc++ (9.3.0-r0)
(15/17) Installing libgmpxx (6.1.2-r1)
(16/17) Installing gmp-dev (6.1.2-r1)
(17/17) Installing ruby-dev (2.6.6-r3)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r1.trigger
OK: 123 MiB in 72 packages
Fetching patron-0.13.3.gem
Building native extensions. This could take a while...
ERROR:  Error installing patron:
    ERROR: Failed to build gem native extension.
​
    current directory: /usr/lib/ruby/gems/2.6.0/gems/patron-0.13.3/ext/patron
/usr/bin/ruby -I /usr/lib/ruby/2.6.0 -r ./siteconf20210301-1-i4huh8.rb extconf.rb
checking for curl-config... yes
checking for ruby/thread.h... *** 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.
​
Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)
    --with-curl-dir
    --without-curl-dir
    --with-curl-include
    --without-curl-include=${curl-dir}/include
    --with-curl-lib
    --without-curl-lib=${curl-dir}/lib
    --with-curl-config
    --without-curl-config
/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.6.0/mkmf.rb:601:in `try_cpp'
    from /usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
    from /usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
    from extconf.rb:23:in `<main>'
​
To see why this extension failed to compile, please check the mkmf.log which can be found here:
​
  /usr/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/patron-0.13.3/mkmf.log
​
extconf failed, exit code 1
​
Gem files will remain installed in /usr/lib/ruby/gems/2.6.0/gems/patron-0.13.3 for inspection.
Results logged to /usr/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/patron-0.13.3/gem_make.out

​​ mkmf.log:

find_executable: checking for curl-config... -------------------- yes
​
--------------------
​
"gcc -o conftest -I/usr/include/ruby-2.6.0/x86_64-linux-musl -I/usr/include/ruby-2.6.0/ruby/backward -I/usr/include/ruby-2.6.0 -I. -Os -fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing   -Os -fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC  -pedantic -Wall conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -lruby  -lm   -lc -lcurl -lnghttp2 -lssl -lcrypto -lssl -lcrypto -lz"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
Nakilon commented 3 years ago

Never mind. apk add build-base