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

Fail to build github.com/mattn/go-sqlite3 with Bazel 3.7.0 #2685

Closed
eugene-dounar opened this issue Oct 22, 2020 · 3 comments · Fixed by #2687
Closed

Fail to build github.com/mattn/go-sqlite3 with Bazel 3.7.0 #2685

eugene-dounar opened this issue Oct 22, 2020 · 3 comments · Fixed by #2687

Comments

@eugene-dounar
Copy link

Upgraded Bazel from 3.6.0 to 3.7.0 and some dependencies relying on cgo started failing. Downgrading to 3.6.0 fixes the issue.
Similar to #526

What version of rules_go are you using?

Tested on 0.21.7 and 0.24.4

What version of gazelle are you using?

Tested on 0.21.1 and 0.22.2

What version of Bazel are you using?

Only 3.7.0, previous versions work just fine

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Linux/amd64

What did you do?

Run bazel build //... in a empty project with Bazel 3.7.0 and Bazel 3.6.0
Project gist: https://gist.github.com/eugene-dounar/e8d1d6ab16f7e02d7f97e85229f3916c

What did you expect to see?

Successfull build on 3.7.0

What did you see instead?

» bazel build //...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:hello (37 packages loaded, 6977 targets configured).
INFO: Found 1 target...
ERROR: /home/eugene/.cache/bazel/_bazel_eugene/27a27482e8ad76ae681f75b00800d023/external/com_github_mattn_go_sqlite3/BUILD.bazel:3:11: GoCompilePkg external/com_github_mattn_go_sqlite3/go-sqlite3.a failed (Exit 1): builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src external/com_github_mattn_go_sqlite3/backup.go -src ... (remaining 63 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src external/com_github_mattn_go_sqlite3/backup.go -src ... (remaining 63 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
/home/eugene/.cache/bazel/_bazel_eugene/27a27482e8ad76ae681f75b00800d023/sandbox/linux-sandbox/1/execroot/test/external/com_github_mattn_go_sqlite3/backup.go:10:10: fatal error: sqlite3-binding.h: No such file or directory
   10 | #include <sqlite3-binding.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
compilepkg: error running the following subcommand: exit status 2
PATH=/usr/bin:/bin \
CGO_ENABLED=1 \
GOARCH=amd64 \
GOPATH= \
TMPDIR=/tmp \
GOROOT_FINAL=GOROOT \
CC=/usr/bin/gcc \
GOOS=linux \
GOROOT=external/go_sdk \
CGO_LDFLAGS="-fuse-ld=gold -Wl,-no-as-needed -Wl,-z,relro,-z,now -B/usr/bin -pass-exit-codes -lm -ldl -pthread" \
external/go_sdk/pkg/tool/linux_amd64/cgo -srcdir /home/eugene/.cache/bazel/_bazel_eugene/27a27482e8ad76ae681f75b00800d023/sandbox/linux-sandbox/1/execroot/test/external/com_github_mattn_go_sqlite3 -objdir /tmp/rules_go_work-010215423 -importpath github.com/mattn/go-sqlite3 -- -I com_github_mattn_go_sqlite3 -iquote external/com_github_mattn_go_sqlite3 -iquote . -iquote /home/eugene/.cache/bazel/_bazel_eugene/27a27482e8ad76ae681f75b00800d023/sandbox/linux-sandbox/1/execroot/test/external/com_github_mattn_go_sqlite3 -iquote /tmp/rules_go_work-010215423 -U_FORTIFY_SOURCE -fstack-protector -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -DHAVE_USLEEP=1 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_DISABLE_INTRINSIC -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4_UNICODE61 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_OMIT_DEPRECATED -DSQLITE_THREADSAFE=1 -DSQLITE_TRACE_SIZE_LIMIT=15 -Wno-deprecated-declarations -std=gnu99 -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1 -I. -fPIC backup.go callback.go error.go sqlite3.go sqlite3_context.go sqlite3_load_extension.go sqlite3_opt_userauth_omit.go sqlite3_other.go sqlite3_type.go
Target //:hello failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 20.518s, Critical Path: 0.11s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
@kristiandrucker
Copy link

Got the same issue

@jayconrod
Copy link
Contributor

Confirmed this is broken.

Looking into whether this is a Bazel regression or a newly exposed rules_go bug.

jayconrod pushed a commit to jayconrod/rules_go that referenced this issue Oct 23, 2020
The go command uses -I for package directories, which makes
directories available for "" and <> includes. We should do the same.

We no longer use ctx.build_file_path, since that directory might not
actually provide any build files, and its value changed in Bazel
3.7.0.

Fixes bazelbuild#2685
jayconrod pushed a commit that referenced this issue Oct 23, 2020
The go command uses -I for package directories, which makes
directories available for "" and <> includes. We should do the same.

We no longer use ctx.build_file_path, since that directory might not
actually provide any build files, and its value changed in Bazel
3.7.0.

Fixes #2685
@jayconrod
Copy link
Contributor

Please check if #2687 solves this for you. If so, I'll tag a point release next week.

bazelbuild/bazel#12344 is the upstream issue.

jayconrod pushed a commit that referenced this issue Oct 26, 2020
The go command uses -I for package directories, which makes
directories available for "" and <> includes. We should do the same.

We no longer use ctx.build_file_path, since that directory might not
actually provide any build files, and its value changed in Bazel
3.7.0.

Fixes #2685
jayconrod pushed a commit that referenced this issue Oct 26, 2020
The go command uses -I for package directories, which makes
directories available for "" and <> includes. We should do the same.

We no longer use ctx.build_file_path, since that directory might not
actually provide any build files, and its value changed in Bazel
3.7.0.

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

Successfully merging a pull request may close this issue.

3 participants