bazel-contrib / toolchains_llvm

LLVM toolchain for bazel
Apache License 2.0
291 stars 209 forks source link

Linux NixOS distribution not supported #58

Closed Magicking closed 2 years ago

Magicking commented 4 years ago

As stated in title NixOS doesn't seem to be available.

[magicking@broken:~/prysm]$ bazel build //beacon-chain
INFO: Call stack for the definition of repository 'llvm_toolchain' which is a llvm_toolchain (rule definition at /home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_b
azel_toolchain/toolchain/rules.bzl:24:18):
 - /home/magicking/prysm/WORKSPACE:29:1
ERROR: An error occurred during the fetch of repository 'llvm_toolchain':
   Traceback (most recent call last):
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/configure.bzl", line 102
                _download_llvm_preconfigured(rctx)
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/llvm_distributions.bzl", line 120, in _download_llvm_preconfigure
d
                fail(("Failed to detect host OS versi...)))
Failed to detect host OS version: 

Unsupported linux distribution and version: nixos, 19.09.2255.68d2f8325c3
ERROR: no such package '@llvm_toolchain//': Traceback (most recent call last):
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/configure.bzl", line 102
                _download_llvm_preconfigured(rctx)
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/llvm_distributions.bzl", line 120, in _download_llvm_preconfigure
d
                fail(("Failed to detect host OS versi...)))
Failed to detect host OS version: 

Unsupported linux distribution and version: nixos, 19.09.2255.68d2f8325c3
ERROR: no such package '@llvm_toolchain//': Traceback (most recent call last):
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/configure.bzl", line 102
                _download_llvm_preconfigured(rctx)
        File "/home/magicking/.cache/bazel/_bazel_magicking/144ef05f66c65de4e325e5d8dc387e85/external/com_grail_bazel_toolchain/toolchain/internal/llvm_distributions.bzl", line 120, in _download_llvm_preconfigure
d
                fail(("Failed to detect host OS versi...)))
Failed to detect host OS version: 

Unsupported linux distribution and version: nixos, 19.09.2255.68d2f8325c3

I'm new to Bazel, what file(s) I may have to look into to submit a patch to make it available?

Cheers,

siddharthab commented 2 years ago

Sorry for the delay.

I think pre-built LLVM distributions don't support Alpine linux (on which NixOS is based) directly. So I am not sure it is going to be easy. You can build your own LLVM toolchain and use that as the urls attribute to the llvm_toolchain rule to provide your own pre-built binaries instead of the official LLVM releases.

You can also take a chance with the binaries released for the other OSes. The file to change the mapping would be llvm_release_name.py.

siddharthab commented 2 years ago

I am going to close this issue. But please feel free to reopen.