toolchains_llvm icon indicating copy to clipboard operation
toolchains_llvm copied to clipboard

Toolchain not detected in rules_foreign_cc

Open mering opened this issue 1 year ago • 4 comments

When using the local toolchain, everything builds fine. When using the hermetic tool chain from this repo, some build systems fail to use the compiler for a simple test program.

Reproduction example in https://github.com/bazel-contrib/rules_foreign_cc/pull/1295.

mering avatar Oct 01 '24 18:10 mering

The linked thread has lots of useful information on how to get ffmpeg to build, thanks for linking it.

I'll close this issue since the problems are due to ffmpeg using an opinionated configure script rather than any issue we could fix in toolchains_llvm.

fmeum avatar Oct 21 '24 07:10 fmeum

There are things which should be fixed on the toolchain side. For example the $AR and $STRIP environment variable are not populated.

Without them, one has to do hacky stuff like the following for meson builds like libdav1d:

    env = {
        "AR": "$$EXT_BUILD_ROOT/external/toolchains_llvm~~llvm~llvm_toolchain/bin/llvm-ar",
        "STRIP": "$$EXT_BUILD_ROOT/external/toolchains_llvm~~llvm~llvm_toolchain/bin/llvm-strip",
    }

or

    env = {
        "AR": "$$EXT_BUILD_ROOT/$$(dirname $(LD))/llvm-ar",
        "STRIP": "$$EXT_BUILD_ROOT/$$(dirname $(LD))/llvm-strip",
    }

@fmeum could you please reopen? Thanks!

mering avatar Oct 21 '24 08:10 mering

That's a good point. Are we not adding them to the tools dict or does rules_foreign_cc not read them from there? Either should be easy to fix.

fmeum avatar Oct 21 '24 09:10 fmeum

That's a good point. Are we not adding them to the tools dict or does rules_foreign_cc not read them from there? Either should be easy to fix.

It's on my list to debug this further.

mering avatar Oct 21 '24 10:10 mering