github / semantic

Parsing, analyzing, and comparing source code across many languages
8.94k stars 454 forks source link

Bazel build fails on Big Sur #644

Open kdeding opened 3 years ago

kdeding commented 3 years ago

Following the instructions on README to build github/semantic on MacOS Big Sur (with bazel 4.0.0 or 3.0.0), I got the following errors.

After googling around, tried this command: bazel build --copt="-Wno-error=execute_or_fail_loudly" //.... But it didn't help at all.

Have been stuck on this for the last two days. Would appreciate any help to get around this, because this library can really help me do what I want to.

Many thanks, Kurt

~/apps/semantic master bazel build //... 
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 9a0d62b1-447e-4459-b21e-59ea4add91c8
INFO: Call stack for the definition of repository 'rules_haskell_ghc_darwin_amd64' which is a _ghc_bindist (rule definition at /private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl:362:16):
 - <builtin>
 - /private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl:494:5
 - /private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl:534:9
 - /private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/toolchain.bzl:333:5
 - /Users/kurtk/apps/semantic/WORKSPACE:39:1
INFO: Repository 'rules_haskell_ghc_darwin_amd64' used the following cache hits instead of downloading the corresponding file.
 * Hash 'edb772b00c0d7f18bb56ad27765162ee09c508104d40f82128c9114a02f6cfc2' for https://downloads.haskell.org/~ghc/8.10.2/ghc-8.10.2-x86_64-apple-darwin.tar.xz
If the definition of 'rules_haskell_ghc_darwin_amd64' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'rules_haskell_ghc_darwin_amd64':
   Traceback (most recent call last):
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl", line 292
        execute_or_fail_loudly(ctx, <1 more arguments>)
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/private/workspace_utils.bzl", line 18, in execute_or_fail_loudly
        fail(<1 more arguments>)
Command failed: ./patch_bins
sed: bin/ghc: in-place editing only works for regular files
sed: bin/ghc-pkg: in-place editing only works for regular files
sed: bin/ghci: in-place editing only works for regular files
sed: bin/haddock: in-place editing only works for regular files
sed: bin/runghc: in-place editing only works for regular files
sed: bin/runhaskell: in-place editing only works for regular files
ERROR: /Users/kurtk/apps/semantic/BUILD.bazel:54:1: //:process depends on @rules_haskell_ghc_darwin_amd64//:toolchain-impl in repository @rules_haskell_ghc_darwin_amd64 which failed to fetch. no such package '@rules_haskell_ghc_darwin_amd64//': Traceback (most recent call last):
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl", line 292
        execute_or_fail_loudly(ctx, <1 more arguments>)
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/private/workspace_utils.bzl", line 18, in execute_or_fail_loudly
        fail(<1 more arguments>)
Command failed: ./patch_bins
sed: bin/ghc: in-place editing only works for regular files
sed: bin/ghc-pkg: in-place editing only works for regular files
sed: bin/ghci: in-place editing only works for regular files
sed: bin/haddock: in-place editing only works for regular files
sed: bin/runghc: in-place editing only works for regular files
sed: bin/runhaskell: in-place editing only works for regular files
ERROR: Analysis of target '//:process' failed; build aborted: no such package '@rules_haskell_ghc_darwin_amd64//': Traceback (most recent call last):
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/ghc_bindist.bzl", line 292
        execute_or_fail_loudly(ctx, <1 more arguments>)
    File "/private/var/tmp/_bazel_kurtk/5dcfd34ad3073278f929b526764173ae/external/rules_haskell/haskell/private/workspace_utils.bzl", line 18, in execute_or_fail_loudly
        fail(<1 more arguments>)
Command failed: ./patch_bins
sed: bin/ghc: in-place editing only works for regular files
sed: bin/ghc-pkg: in-place editing only works for regular files
sed: bin/ghci: in-place editing only works for regular files
sed: bin/haddock: in-place editing only works for regular files
sed: bin/runghc: in-place editing only works for regular files
sed: bin/runhaskell: in-place editing only works for regular files
INFO: Elapsed time: 112.588s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (62 packages loaded, 43 targets configured)
kdeding commented 3 years ago

I got the build working using cabal. I suppose it's just bazel that gives the trouble.

patrickt commented 3 years ago

Hmm, interesting. Might be worth trying to upgrade the version of rules_haskell that we target; I don’t think Big Sur had come out when we last updated it, and it looks like there is some problem with the GHC bindist. Is this running on Apple Silicon?

kdeding commented 3 years ago

Thanks for the tip. My machine is an Intel MacBook Pro.