Improve bindgen configuration wrt clang
Categories
(Firefox Build System :: General, enhancement)
Tracking
(firefox69 fixed)
| Tracking | Status | |
|---|---|---|
| firefox69 | --- | fixed |
People
(Reporter: glandium, Assigned: glandium)
References
Details
Attachments
(1 file)
Historically, the bindgen configuration has been using a compiler that is not the build compiler (gcc or msvc), and does its own detection for clang. However, now that clang/clang-cl is the default, it can end up using a different version as shown in bug 1526497. The situation should be improved.
| Assignee | ||
Comment 2•6 years ago
|
||
The current setup for bindgen relies on either finding clang/libclang
from the output of llvm-config, or from the paths given via the
configure flags --with-clang-path/--with-libclang-path.
One very common problem is that the llvm-config we end up using does
not correspond to the clang used for compilation, which has some
undesirable side effect, like failing to build.
So instead of relying on llvm-config, we do the following:
- when the compiler is clang, we just use that
- when the compiler is clang-cl, we use clang from the same directory
- otherwise, we either try to find clang in PATH, or rely on
--with-clang-path.
Once clang is found, we try to deduce the location of the corresponding
libclang via the output of clang -print-search-dirs, or rely on
--with-libclang-path.
Comment 3•6 years ago
|
||
Can we get this reviewed?
Comment 5•6 years ago
|
||
| bugherder | ||
Comment 6•6 years ago
|
||
I can't build anymore. Somehow this causes
ERROR: Could not find libclang to generate rust bindings for C/C++. Please install the necessary packages, run mach bootstrap, or use --with-libclang-path to give the path containing it.
And running ./mach bootstrap does not help.
Comment 7•6 years ago
|
||
This make by mac build succeed, thanks!
Description
•