KyleMayes / clang-sys

Rust bindings for libclang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warnings appear even if libclang is found

hug-dev opened this issue · comments

That might be a duplicate (or subset of) #93.

If llvm-config is not available on the path, the run_llvm_config function in the build script will generate two warnings:

warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

Those are print even if libclang is eventually found by the build script, using the hardcoded search library directories.

To solve this I propose the following solution (inspired by what was said in #93):

  • in run_llvm_config, if LLVM_CONFIG_PATH is not set, check if the llvm-config command is available on the PATH.
  • if it is, continue the function as it is currently doing
  • if it is not, return None of this function, without any warnings (or an info if that exists in cargo builds?).

If you are OK with this proposal, I am happy to make a pull-request for this.

This has been addressed in v1.0.0, now failure to execute commands (both llvm-config and xcode-select) is only reported as a Cargo warning when the build script fails to find an instance of libclang.