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

Building fails with Bazel #1520

Closed
tagatac opened this issue Feb 22, 2023 · 3 comments
Closed

Building fails with Bazel #1520

tagatac opened this issue Feb 22, 2023 · 3 comments
Labels

Comments

@tagatac
Copy link

tagatac commented Feb 22, 2023

Describe the bug
Building a project with Bazel on Linux fails with

external/com_github_jackc_pgx_v5/internal/nbconn/nbconn.go:379:12: c.realNonblockingWrite undefined (type *NetConn has no field or method realNonblockingWrite)
external/com_github_jackc_pgx_v5/internal/nbconn/nbconn.go:412:12: c.realNonblockingRead undefined (type *NetConn has no field or method realNonblockingRead)

Steps to reproduce

  1. Create a go project that uses pgx v5.
  2. Compile the project with bazel: bazel build ./...

Expected behavior
The build succeeds.

Actual behavior

ERROR: /home/tag/.cache/bazel/_bazel_tag/e379d280809b10b9e36a69cb312affe2/external/com_github_jackc_pgx_v5/internal/nbconn/BUILD.bazel:3:11: GoCompilePkg external/com_github_jackc_pgx_v5/internal/nbconn/nbconn.a failed: (Exit 1): builder failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src external/com_github_jackc_pgx_v5/internal/nbconn/bufferqueue.go ... (remaining 26 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_github_jackc_pgx_v5/internal/nbconn/nbconn.go:379:12: c.realNonblockingWrite undefined (type *NetConn has no field or method realNonblockingWrite)
external/com_github_jackc_pgx_v5/internal/nbconn/nbconn.go:412:12: c.realNonblockingRead undefined (type *NetConn has no field or method realNonblockingRead)
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2

Version

  • Go: $ go version -> go version go1.19.5 linux/amd64
  • PostgreSQL: $ psql --no-psqlrc --tuples-only -c 'select version()' -> psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "tag" does not exist
  • pgx: $ grep 'github.com/jackc/pgx/v[0-9]' go.mod -> github.com/jackc/pgx/v5 v5.3.0

Additional context
The project builds fine with v5.2.0. This is probably related to cf78472

@tagatac tagatac added the bug label Feb 22, 2023
@jackc
Copy link
Owner

jackc commented Feb 23, 2023

I don't know anything about bazil, does building in that not considered unix?

@arashpayan
Copy link

arashpayan commented Feb 25, 2023

I just ran into this problem in a project that uses bazel once I upgraded from v4 to v5. It compiles fine with go build so this is a bazel bug. @jackc, you should feel free to close this issue if you like.

@tagatac
Copy link
Author

tagatac commented Mar 2, 2023

It does look like this is indeed a Bazel issue: bazel-contrib/bazel-gazelle#1465

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

3 participants