Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: 'resolv.h' file not found on macOS / nix #24767

Open
kyleconroy opened this issue Dec 19, 2024 · 0 comments
Open

fatal error: 'resolv.h' file not found on macOS / nix #24767

kyleconroy opened this issue Dec 19, 2024 · 0 comments
Labels

Comments

@kyleconroy
Copy link

Description of the bug:

Hey there Bazel team! I've run into a issue that I can't solve. I'm building a Go project with the following setup:

  • macOS 14.7.1
  • devenv 1.3.1
  • Bazel 8.0.0

When trying to build my project, the resolv.h header can't be found.

$ bazelisk build //hello
INFO: Analyzed target //hello:hello (104 packages loaded, 5659 targets configured).
ERROR: /private/var/tmp/_bazel_kyle/c3d7894f4cdf3c1bcc4683dd549d8b70/external/rules_go~/BUILD.bazel:42:7: GoStdlib external/rules_go~/stdlib_/pkg failed: (Exit 1): builder failed: error executing GoStdlib command (from target @@rules_go~//:stdlib) bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_go~~go_sdk~devenv-bazel-go-broken__download_0/builder_reset/builder stdlib -sdk ... (remaining 13 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
# net/internal/cgotest
bazel-out/darwin_arm64-fastbuild/bin/external/rules_go~/stdlib_/src/net/internal/cgotest/resstate.go:10:10: fatal error: 'resolv.h' file not found
#include <resolv.h>
         ^~~~~~~~~~
1 error generated.
stdlib: error running subcommand external/rules_go~~go_sdk~devenv-bazel-go-broken__download_0/bin/go: exit status 1
Target //hello:hello failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 27.889s, Critical Path: 12.49s
INFO: 8 processes: 7 internal, 1 darwin-sandbox.
ERROR: Build did NOT complete successfully

I'm confident this is a strange interaction with between Bazel and Nix / devenv, but I'm not having much success figuring out what that interaction is. Would appreciate any help solving the issue!

Which category does this issue belong to?

C++ Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

This requires a nix installation and devenv.sh.

git clone https://github.com/kyleconroy/devenv-bazel-go-broken
cd devenv-bazel-go-broken
devenv shell
bazelisk build //hello

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

release 8.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

[email protected]:kyleconroy/devenv-bazel-go-broken.git
11bd0e334a2ecc44e11ac0b81bdba922b6524640

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

I've opened up an issue (cachix/devenv#1099) on devenv, as I'm not sure where the bug is happening.

I ran into a similar bug back in April and found a few Bazel issues that might be related

Any other information, logs, or outputs that you want to share?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants