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

Add llvm-config to distribution #434

Open
clin1234 opened this issue Jun 20, 2024 · 1 comment
Open

Add llvm-config to distribution #434

clin1234 opened this issue Jun 20, 2024 · 1 comment

Comments

@clin1234
Copy link

I'm trying to compile a Rust package, specifically ClangQL, that relies on a crate that, in turn, relies on a few features not included by default:

The following warnings were emitted during compilation:

warning: [email protected]: could not execute `llvm-config` one or more times, if the LLVM_CONFIG_PATH environment variable is set to a full path to valid `llvm-config` executable it will be used to try to find an instance of `libclang` on your system: "couldn't execute `llvm-config --prefix` (path=llvm-config) (error: program not found)"

error: failed to run custom build command for `clang-sys v1.8.1`

Caused by:
  process didn't exit successfully: `C:\Users\0BAC~1\AppData\Local\Temp\cargo-install7y9kS3\release\build\clang-sys-4522d44d0baf573c\build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=could not execute `llvm-config` one or more times, if the LLVM_CONFIG_PATH environment variable is set to a full path to valid `llvm-config` executable it will be used to try to find an instance of `libclang` on your system: "couldn't execute `llvm-config --prefix` (path=llvm-config) (error: program not found)"

  --- stderr
  thread 'main' panicked at C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-sys-1.8.1\build\dynamic.rs:225:45:
  called `Result::unwrap()` on an `Err` value: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `clangql v0.6.0 (https://github.com/AmrDeveloper/ClangQL#7e4e2add)`, intermediate artifacts can be found at `C:\Users\0BAC~1\AppData\Local\Temp\cargo-install7y9kS3`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
@mstorsjo
Copy link
Owner

Sorry, in most cases, if something requires llvm-config, it usually also intends to compile and link against the Clang/LLVM libraries - so it probably wouldn't be enough to just add the lone llvm-config binary, but it would also require including all the headers and link libraries. That increases the size of the distribution packages quite significantly.

It's quite straightforward to try this out for yourself, though, add --full-llvm to the invocation of build-cross-tools.sh (or the invocations of build-all.sh to have it included for the unix packages) in .github/workflows/build.yml, enable github actions on your fork of the repo, and push this modification to a branch in your fork.

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

2 participants