huacnlee / rucaptcha

Captcha Gem for Rails, which generates captcha image by Rust.
https://huacnlee.github.io/rucaptcha
MIT License
695 stars 133 forks source link

升级rucaptcha错误 #104

Closed athxx closed 1 year ago

athxx commented 1 year ago

今天执行 bundle update 时候,rucaptcha升级错误,错误信息如下, 该怎么解决?

Caused by:
process didn't exit successfully:
`/var/lib/gems/3.0.0/gems/rucaptcha-3.2.1/ext/rucaptcha/target/release/build/rb-sys-5e63242e1ce267d6/build-script-main`
(exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=RUBY
  cargo:rerun-if-env-changed=RBCONFIG_RUBY_PROGRAM_VERSION
  cargo:rerun-if-env-changed=RBCONFIG_platform
  cargo:rerun-if-env-changed=RBCONFIG_arch
  cargo:rerun-if-env-changed=RUBY_ROOT
  cargo:rerun-if-env-changed=RUBY_VERSION
  cargo:rerun-if-env-changed=RUBY
  cargo:rerun-if-changed=build/features.rs
  cargo:rerun-if-changed=build/main.rs
  cargo:rerun-if-changed=build/version.rs
  cargo:rerun-if-changed=build/ruby_macros.rs
  cargo:rerun-if-env-changed=RUBY_STATIC
  cargo:rerun-if-env-changed=RBCONFIG_ENABLE_SHARED
  cargo:rerun-if-env-changed=RBCONFIG_rubyhdrdir
  cargo:rerun-if-env-changed=RBCONFIG_rubyarchhdrdir
  cargo:rerun-if-env-changed=RBCONFIG_CPPFLAGS

  --- stderr
Using bindgen with clang args: ["-I/usr/include/ruby-3.0.0", "-I/usr/include/x86_64-linux-gnu/ruby-3.0.0",
"-fms-extensions", "-O3", "-ggdb3", "-Wall", "-Wextra", "-Wdeprecated-declarations", "-Wduplicated-cond",
"-Wimplicit-function-declaration", "-Wimplicit-int", "-Wmisleading-indentation", "-Wpointer-arith", "-Wwrite-strings",
"-Wimplicit-fallthrough=0", "-Wmissing-noreturn", "-Wno-cast-function-type", "-Wno-constant-logical-operand",
"-Wno-long-long", "-Wno-missing-field-initializers", "-Wno-overlength-strings", "-Wno-packed-bitfield-compat",
"-Wno-parentheses-equality", "-Wno-self-assign", "-Wno-tautological-compare", "-Wno-unused-parameter",
"-Wno-unused-value", "-Wsuggest-attribute=format", "-Wsuggest-attribute=noreturn", "-Wunused-variable", "-Wdate-time",
"-D_FORTIFY_SOURCE=2"]
thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching:
['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to
a path where one of these files can be found (invalid: [])"',
/var/lib/gems/3.0.0/gems/rucaptcha-3.2.1/ext/rucaptcha/.rb-sys/stable/cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.62.0/./lib.rs:2402:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:551: target/release/librucaptcha.so] Error 101

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/3.0.0/gems/rucaptcha-3.2.1 for inspection.
Results logged to /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/rucaptcha-3.2.1/gem_make.out

  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:95:in `run'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:44:in `block in make'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:36:in `each'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:36:in `make'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:63:in `block in build'
  /usr/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:161:in `build_extension'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:192:in `each'
  /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:192:in `build_extensions'
  /usr/lib/ruby/vendor_ruby/rubygems/installer.rb:847:in `build_extensions'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/source/rubygems.rb:202:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/installer/gem_installer.rb:54:in `install'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/worker.rb:62:in `apply_func'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/worker.rb:57:in `block in process_queue'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/worker.rb:54:in `loop'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/worker.rb:54:in `process_queue'
  /var/lib/gems/3.0.0/gems/bundler-2.4.19/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing rucaptcha (3.2.1), and Bundler cannot continue.

In Gemfile:
  rucaptcha
huacnlee commented 1 year ago
bundle config

看看,是不是设置了 force_ruby_platformtrue

你需要避免走源代码编译 RuCaptcha 在发布的时候已经带了预编译的文件,为各个常见的平台支持。

3.2.1 - June 09, 2023 x86_64-linux-musl (3.3 MB) 3.2.1 - June 09, 2023 x86_64-linux (3.3 MB) 3.2.1 - June 09, 2023 aarch64-linux (3.2 MB) 3.2.1 - June 09, 2023 x86_64-darwin (1.6 MB) 3.2.1 - June 09, 2023 arm64-darwin (1.6 MB) 3.2.1 - June 09, 2023 (110.5 KB)

走源代码编译的话得需要完整的开发环境 Rust 和一些相关的编译环境。

可以参考 Nokogiri 这个说明,类似的:

https://nokogiri.org/tutorials/installing_nokogiri.html#why-would-i-not-want-to-use-a-native-gem

athxx commented 1 year ago
bundle config

看看,是不是设置了 force_ruby_platformtrue

你需要避免走源代码编译 RuCaptcha 在发布的时候已经带了预编译的文件,为各个常见的平台支持。

3.2.1 - June 09, 2023 x86_64-linux-musl (3.3 MB) 3.2.1 - June 09, 2023 x86_64-linux (3.3 MB) 3.2.1 - June 09, 2023 aarch64-linux (3.2 MB) 3.2.1 - June 09, 2023 x86_64-darwin (1.6 MB) 3.2.1 - June 09, 2023 arm64-darwin (1.6 MB) 3.2.1 - June 09, 2023 (110.5 KB)

走源代码编译的话得需要完整的开发环境 Rust 和一些相关的编译环境。

可以参考 Nokogiri 这个说明,类似的:

https://nokogiri.org/tutorials/installing_nokogiri.html#why-would-i-not-want-to-use-a-native-gem

已解决,谢谢