Closed Bug 1526857 Opened 5 years ago Closed 5 years ago

Improve bindgen configuration wrt clang

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox69 fixed)

RESOLVED FIXED
mozilla69
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.

Blocks: 1487552

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.

Can we get this reviewed?

Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/ccd1356fc8f1
Improve bindgen configuration wrt clang. r=chmanchester
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

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.

This make by mac build succeed, thanks!

See Also: → 1495672
See Also: → 1557419
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: