rb-sys icon indicating copy to clipboard operation
rb-sys copied to clipboard

Failed to build for release on Windows latest runner: `defines.h:43:11: fatal error: 'strings.h' file not found\n")`

Open setoelkahfi opened this issue 1 year ago • 1 comments

I have a Tauri project and got a compilation error on Windows's latest runner:

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

Initially, I thought it was because of a mismatch in the Ruby version, which used version 3.0.0 by setup-ruby action. Now it's the correct ruby, but it still has the same errors. Any clue?

setoelkahfi avatar Aug 17 '24 16:08 setoelkahfi

So you have a link to the build? It looks like it's having issues finding the correct header files for some reason, which should be configured

ianks avatar Aug 17 '24 18:08 ianks

@ianks, it's a private repo. But I can share the workflow file sometime today. I posted the question on SO as well with a more detailed description.

setoelkahfi avatar Aug 19 '24 06:08 setoelkahfi

@ianks updated to include my workflow file. Now I remember, I haven't tried adding some dependency like for the Ubuntu one.

setoelkahfi avatar Aug 19 '24 20:08 setoelkahfi

I didn't solve this; instead, I removed magnus from my crate dependency since I don't use it. I used it on a Ruby gem with a Rust extension.

setoelkahfi avatar Aug 27 '24 19:08 setoelkahfi

this is not completed ;-; I still have this

Xyndra avatar Nov 12 '24 18:11 Xyndra