vere icon indicating copy to clipboard operation
vere copied to clipboard

bazel build fails on macOS when some of our external dependencies are also present in `/usr/local/include` or other system directories

Open matthew-levan opened this issue 1 year ago • 1 comments

@pkova @mopfel-winrux @tadad @mikolajpp and I have experienced this with gmp, openssl, and others. The workaround for now is to remove/move the overlapping files in the system directory and build again.

Here's an example of an error message we can see when there's a /usr/local/include/openssl folder on the system. Bazel should be ignoring this folder and using our own bundled openssl to statically link it, but it doesn't for some reason.

We should probably find a command that explicitly directs Bazel to ignore system-level files and folders for some (or all) external dependencies. cc: @mcevoypeter

matt@mbp14 vere % bazel build :urbit
INFO: Analyzed target //:urbit (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_matt/657ca343b546ec28817b7a65bf3b8da7/external/aes_siv/BUILD.bazel:10:11: Compiling aes_siv.c failed: undeclared inclusion(s) in rule '@aes_siv//:aes_siv':
this rule is missing dependency declarations for the following files included by 'aes_siv.c':
  '/usr/local/include/openssl/cmac.h'
  '/usr/local/include/openssl/evp.h'
  '/usr/local/include/openssl/opensslconf.h'
  '/usr/local/include/openssl/opensslv.h'
  '/usr/local/include/openssl/ossl_typ.h'
  '/usr/local/include/openssl/e_os2.h'
  '/usr/local/include/openssl/symhacks.h'
  '/usr/local/include/openssl/bio.h'
  '/usr/local/include/openssl/crypto.h'
  '/usr/local/include/openssl/safestack.h'
  '/usr/local/include/openssl/stack.h'
  '/usr/local/include/openssl/cryptoerr.h'
  '/usr/local/include/openssl/bioerr.h'
  '/usr/local/include/openssl/evperr.h'
  '/usr/local/include/openssl/objects.h'
  '/usr/local/include/openssl/obj_mac.h'
  '/usr/local/include/openssl/asn1.h'
  '/usr/local/include/openssl/asn1err.h'
  '/usr/local/include/openssl/bn.h'
  '/usr/local/include/openssl/bnerr.h'
  '/usr/local/include/openssl/objectserr.h'
Target //pkg/vere:urbit failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.615s, Critical Path: 0.44s
INFO: 10 processes: 9 internal, 1 darwin-sandbox.
FAILED: Build did NOT complete successfully

matthew-levan avatar Jun 05 '23 18:06 matthew-levan

Update: my MacBook had /usr/local/include/openssl and /usr/local/include/aes_siv.h for some reason (probably installed via some other package I installed on my machine via Homebrew or other), and this was confusing our build system (sadly). Once I removed these two, the build works again. @mopfel-winrux try looking in your /usr/local/include for any gmp-related files/directories and see what happens when you move them.

matthew-levan avatar Jun 07 '23 14:06 matthew-levan