Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libclang is not sufficient. fatal error: 'stdarg.h' file not found #350

Open
sliiser opened this issue Apr 5, 2024 · 0 comments
Open

libclang is not sufficient. fatal error: 'stdarg.h' file not found #350

sliiser opened this issue Apr 5, 2024 · 0 comments

Comments

@sliiser
Copy link
Contributor

sliiser commented Apr 5, 2024

I'm not sure if this issue belongs here in rb-sys, in libclang-rb or oxy-test. Let me know if I should post this elsewhere.

The README suggest using the libclang gem. However, this is not sufficient and crashes if clang is not installed.

Reproducible example

# Dockerfile
FROM ruby:3.3

RUN apt-get update
# RUN apt-get install -y clang

RUN echo "source 'https://rubygems.org'" > Gemfile

# Install only libclang first to ensure it is installed before oxy-test is installed,
# otherwise getting libclang not found errors.
RUN echo "gem 'libclang'" >> Gemfile
RUN bundle install

RUN echo "gem 'oxi-test', git: 'https://github.com/oxidize-rb/oxi-test.git'" >> Gemfile
RUN bundle install

Expected result:

rb-sys and oxi-test are installed.

This actually happens if RUN apt-get install -y clang above is uncommented. But, if clang is installed explicitly, then the libclang dependency is unnecessary.

Actual result:

Installing rb_sys 0.9.91
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
Compiling rb-sys v0.9.85
error: failed to run custom build command for `rb-sys v0.9.85`
Caused by:
process didn't exit successfully:
`/usr/local/bundle/bundler/gems/oxi-test-402571cd5ea1/ext/target/release/build/rb-sys-dd447c18433d495f/build-script-main`
...
thread 'main' panicked at
/usr/local/bundle/bundler/gems/oxi-test-402571cd5ea1/ext/.rb-sys/stable/cargo/registry/src/index.crates.io-6f17d22bba15001f/rb-sys-0.9.85/build/main.rs:55:6:
generate bindings: ClangDiagnostic("/usr/local/include/ruby-3.3.0/ruby/ruby.h:23:10: fatal error: 'stdarg.h' file not found\n")
...

Reproducible in both my local (arm64-darwin, meaning docker running aarch64-linux) and in CI buildkit (x86_64-linux)

Potential duplicate of #268 but slightly different error and has reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant