rb-sys 无法在 Windows 上构建最新版本:define.h:43:11:致命错误:找不到“strings.h”文件 ”)

问题描述 投票:0回答:1

我有一个 Tauri 项目,在 GitHub 操作上的 Windows 最新运行器上遇到编译错误:

error: failed to run custom build command for `rb-sys v0.9.100`
Caused by:
  process didn't exit successfully: `D:\adesktop\src-tauri\target\release\build\rb-sys-ef992799c55b6db2\build-script-main` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=RUBY
  cargo:rerun-if-env-changed=RBCONFIG_CROSS_COMPILING
  cargo:rerun-if-env-changed=RBCONFIG_RUBY_PROGRAM_VERSION
  cargo:rerun-if-env-changed=RBCONFIG_platform
  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\stable_api_config.rs
  cargo:rerun-if-changed=build\version.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
  cargo:rerun-if-env-changed=RBCONFIG_rubyhdrdir
  #include "ruby/re.h"
  #endif
  #ifdef HAVE_RUBY_REGEX_H
  #include "ruby/regex.h"
  #endif
  #ifdef HAVE_RUBY_RUBY_H
  #include "ruby/ruby.h"
  #endif
  #ifdef HAVE_RUBY_ST_H
  #include "ruby/st.h"
  #endif
  #ifdef HAVE_RUBY_THREAD_H
  #include "ruby/thread.h"
  #endif
  #ifdef HAVE_RUBY_THREAD_NATIVE_H
  #include "ruby/thread_native.h"
  #endif
  #ifdef HAVE_RUBY_UTIL_H
  #include "ruby/util.h"
  #endif
  #ifdef HAVE_RUBY_VERSION_H
  #include "ruby/version.h"
  #endif
  #ifdef HAVE_RUBY_VM_H
  #include "ruby/vm.h"
  #endif
  #ifdef HAVE_RUBY_WIN32_H
  #include "ruby/win32.h"
  #endif
  #ifdef HAVE_RUBY_IO_BUFFER_H
  #include "ruby/io/buffer.h"
  #endif
  struct rb_sys__Opaque__RString { struct RString dummy; };
  struct rb_sys__Opaque__RArray { struct RArray dummy; };
  warning: unknown warning option '-Wduplicated-cond' [-Wunknown-warning-option]
  warning: unknown warning option '-Wimplicit-fallthrough=0'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-packed-bitfield-compat'; did you mean '-Wno-padded-bitfield'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wsuggest-attribute=format'; did you mean '-Wproperty-attribute-mismatch'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wsuggest-attribute=noreturn' [-Wunknown-warning-option]
  warning: unknown warning option '-Wduplicated-cond' [-Wunknown-warning-option]
  warning: unknown warning option '-Wimplicit-fallthrough=0'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-packed-bitfield-compat'; did you mean '-Wno-padded-bitfield'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wsuggest-attribute=format'; did you mean '-Wproperty-attribute-mismatch'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wsuggest-attribute=noreturn' [-Wunknown-warning-option]
  C:/hostedtoolcache/windows/Ruby/3.2.2/x64/include/ruby-3.2.0\ruby\defines.h:43:11: fatal error: 'strings.h' file not found
  clang diag: warning: unknown warning option '-Wduplicated-cond' [-Wunknown-warning-option]
  clang diag: warning: unknown warning option '-Wimplicit-fallthrough=0'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option]
  clang diag: warning: unknown warning option '-Wno-packed-bitfield-compat'; did you mean '-Wno-padded-bitfield'? [-Wunknown-warning-option]
  clang diag: warning: unknown warning option '-Wsuggest-attribute=format'; did you mean '-Wproperty-attribute-mismatch'? [-Wunknown-warning-option]
  clang diag: warning: unknown warning option '-Wsuggest-attribute=noreturn' [-Wunknown-warning-option]
  thread 'main' panicked at C:\Users\runneradmin/.cargo\registry\src\index.crates.io-6f17d22bba15001f\rb-sys-0.9.100\build/main.rs:55:6:
  generate bindings: ClangDiagnostic("C:/hostedtoolcache/windows/Ruby/3.2.2/x64/include/ruby-3.2.0\\ruby\\defines.h:43:11: fatal error: 'strings.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
       Error failed to build app: failed to build app
Error: Command failed with exit code 1: npm run release build

最初,我以为这是因为 Ruby 版本不匹配,通过 setup-ruby action 使用了 3.0.0 版本。现在它是正确的 ruby,但它仍然有相同的错误。

我有几个

Cargo.toml
文件。我的主要
Cargo.toml
:

[build-dependencies]
tauri-build = { version = "1.5", features = [] }

[dependencies]
anyhow = "1"
chrono = "0.4.31"
futures = "0.3"
home = "0.5.4"
hound = "3"
log = "^0.4"
once_cell = "1.18.0"
reqwest = { version = "0.12", features = ["json"] }
ringbuf = "0.3"
rodio = "0.19"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
serde_repr = "0.1"
tauri = { version = "1.7.1", features = [] }
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1", features = ["colored"] }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
url-builder = "0.1.1"
uri-template-system = "=0.1.0"

# Local crates
crate_error_codes = { path = "./../../../lib/crate_error_codes" }
crate_models = { path = "./../../../lib/crate_models" }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = ["tauri/custom-protocol"]

板条箱错误代码:

[package]
name = "crate_error_codes"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_repr = "0.1"
tsync = "1"
magnus = { version = "0.6.2" }
strum = "0.26"
strum_macros = "0.26"

板条箱模型:

[package]
name = "crate_models"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_repr = "0.1"
tsync = "1"

有什么线索吗?

ruby rust rubygems
1个回答
0
投票

这是由于

magnus
,我不再在我的项目中使用它。所以,对我来说,解决方案是删除它,构建工作就像一个魅力。

© www.soinside.com 2019 - 2024. All rights reserved.