oxidize-rb / rb-sys

Easily build Ruby native extensions in Rust
https://oxidize-rb.github.io/rb-sys/
Apache License 2.0
222 stars 34 forks source link

Version 0.9.89 causes installation failures in Docker #336

Closed JamesChevalier closed 6 months ago

JamesChevalier commented 6 months ago

Continuing on from https://github.com/oxidize-rb/rb-sys/issues/330

This does work if you change each Ruby version specification to 3.2.3 ... it's just 3.3 that's failing now.

Dockerfile:

FROM ruby:3.3
WORKDIR /app
RUN apt-get update -qq && \
    apt-get upgrade -y && \
    apt-get install -y libclang-dev
COPY Gemfile /app/
RUN bundle install

Gemfile:

source "https://rubygems.org"
ruby "3.3"
gem "tzf"
Full Error: ``` ... a ton of "cargo:rerun-if-env-changed" lines... 26.91 --- stderr 26.91 INFO: using bindgen with clang args: ["-I/usr/local/include/ruby-3.3.0", 26.91 "-I/usr/local/include/ruby-3.3.0/aarch64-linux", "-fms-extensions", "-O3", 26.91 "-fno-fast-math", "-ggdb3", "-Wall", "-Wextra", "-Wdeprecated-declarations", 26.91 "-Wdiv-by-zero", "-Wduplicated-cond", "-Wimplicit-function-declaration", 26.91 "-Wimplicit-int", "-Wpointer-arith", "-Wwrite-strings", 26.91 "-Wold-style-definition", "-Wimplicit-fallthrough=0", "-Wmissing-noreturn", 26.91 "-Wno-cast-function-type", "-Wno-constant-logical-operand", "-Wno-long-long", 26.91 "-Wno-missing-field-initializers", "-Wno-overlength-strings", 26.91 "-Wno-packed-bitfield-compat", "-Wno-parentheses-equality", "-Wno-self-assign", 26.91 "-Wno-tautological-compare", "-Wno-unused-parameter", "-Wno-unused-value", 26.91 "-Wsuggest-attribute=format", "-Wsuggest-attribute=noreturn", 26.91 "-Wunused-variable", "-Wmisleading-indentation", "-Wundef"] 26.91 clang diag: warning: unknown warning option '-Wduplicated-cond' 26.91 [-Wunknown-warning-option] 26.91 clang diag: warning: unknown warning option '-Wimplicit-fallthrough=0'; did 26.91 you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option] 26.91 clang diag: warning: unknown warning option '-Wno-packed-bitfield-compat' 26.91 [-Wunknown-warning-option] 26.91 clang diag: warning: unknown warning option '-Wsuggest-attribute=format'; did 26.91 you mean '-Wproperty-attribute-mismatch'? [-Wunknown-warning-option] 26.91 clang diag: warning: unknown warning option '-Wsuggest-attribute=noreturn' 26.91 [-Wunknown-warning-option] 26.91 error: 'rustfmt' is not installed for the toolchain 26.91 'stable-aarch64-unknown-linux-gnu' 26.91 To install, run `rustup component add rustfmt` 26.91 Failed to run rustfmt: Internal rustfmt error (non-fatal, continuing) 26.91 error: 'rustfmt' is not installed for the toolchain 26.91 'stable-aarch64-unknown-linux-gnu' 26.91 To install, run `rustup component add rustfmt` 26.91 thread 'main' panicked at 26.91 /usr/local/bundle/gems/tzf-0.4.5/ext/tzf/.rb-sys/stable/cargo/registry/src/index.crates.io-6f17d22bba15001f/rb-sys-0.9.82/build/main.rs:64:59: 26.91 called `Result::unwrap()` on an `Err` value: "Stable API is needed but could 26.91 not find a candidate. Try enabling the `stable-api-compiled-fallback` feature in 26.91 rb-sys." 26.91 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 26.91 make: *** [Makefile:566: target/release/libtzf.so] Error 101 26.91 26.91 make failed, exit code 2 26.91 26.91 Gem files will remain installed in /usr/local/bundle/gems/tzf-0.4.5 for 26.91 inspection. 26.91 Results logged to 26.91 /usr/local/bundle/extensions/aarch64-linux/3.3.0/tzf-0.4.5/gem_make.out 26.91 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `each' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `make' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in `build' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in 26.91 build_extensions' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions' 26.91 /usr/local/lib/ruby/3.3.0/rubygems/installer.rb:852:in `build_extensions' 26.91 /usr/local/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:76:in 26.91 `build_extensions' 26.91 /usr/local/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:28:in `install' 26.91 /usr/local/lib/ruby/3.3.0/bundler/source/rubygems.rb:205:in `install' 26.91 /usr/local/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:54:in `install' 26.91 /usr/local/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:16:in 26.91 `install_from_spec' 26.91 /usr/local/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:132:in 26.91 `do_install' 26.91 /usr/local/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:123:in 26.91 `block in worker_pool' 26.91 /usr/local/lib/ruby/3.3.0/bundler/worker.rb:62:in `apply_func' 26.91 /usr/local/lib/ruby/3.3.0/bundler/worker.rb:57:in `block in process_queue' 26.91 :187:in `loop' 26.91 /usr/local/lib/ruby/3.3.0/bundler/worker.rb:54:in `process_queue' 26.91 /usr/local/lib/ruby/3.3.0/bundler/worker.rb:90:in `block (2 levels) in 26.91 create_threads' 26.91 26.91 An error occurred while installing tzf (0.4.5), and Bundler cannot continue. 26.91 26.91 In Gemfile: 26.91 tzf ------ Dockerfile:7 -------------------- 5 | apt-get install -y libclang-dev 6 | COPY Gemfile /app/ 7 | >>> RUN bundle install 8 | -------------------- ERROR: failed to solve: process "/bin/sh -c bundle install" did not complete successfully: exit code: 5 ```
ianks commented 6 months ago

what version of the crate (in cargo.lock) are you using? make sure that's upgraded as well

JamesChevalier commented 6 months ago

I wasn't sure what you were referring to at first, because neither of the two files I'm working with mention crate/cargo. After commenting out the tzf installation in the Gemfile & accessing the Docker container via shell, I noticed the tzf gem folder contains a Cargo.lock file.

That file was recently updated in a commit with the message "Update for rbz_sys 0.9.89": https://github.com/HarlemSquirrel/tzf-rb/commit/f06d89d60d079ae75051c8c6f1de59655a4d3dc5

I was able to confirm a good build by specifying gem "tzf", git: "https://github.com/HarlemSquirrel/tzf-rb", branch: :main in the Gemfile.