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

Bazel 7 breaks cmake rule #1143

Closed
shmuelamit opened this issue Dec 20, 2023 · 1 comment
Closed

Bazel 7 breaks cmake rule #1143

shmuelamit opened this issue Dec 20, 2023 · 1 comment

Comments

@shmuelamit
Copy link

Here's the setup to reproduce:
libevent.BUILD:

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

filegroup(
    name = "srcs",
    srcs = glob(["**"]),
)

cmake(
    name = "libevent",
    lib_source = ":srcs",
    visibility = ["//visibility:public"],
    build_args = ["-j 128"]
)

WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
        name = "libevent",
        build_file = "//:libevent.BUILD",
        sha256 = "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb",
        strip_prefix = "libevent-2.1.12-stable",
        url = "https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz",
)

MODULE.bazel:

module(name = "test", version = "1.0.0")

bazel_dep(name = "rules_foreign_cc", version = "0.10.1")

Along with an empty build file, when building with Bazel 6.4.0 the rule works flawlessly, however when building with Bazel 7 it causes broken symlinks in header files:

 $ bazel build @libevent
INFO: Analyzed target @@libevent//:libevent (0 packages loaded, 0 targets configured).
ERROR: /home/redacted/.cache/bazel/_bazel_redacted/8014adbd25095e36dd44091c6403d684/external/libevent/BUILD.bazel:8:6: Error while validating output TreeArtifact File:[[<execution_root>]bazel-out/k8-fastbuild/bin]external/libevent/libevent/include : Failed to resolve relative path evdns.h inside TreeArtifact /home/redacted/.cache/bazel/_bazel_redacted/8014adbd25095e36dd44091c6403d684/execroot/_main/bazel-out/k8-fastbuild/bin/external/libevent/libevent/include. The associated file is either missing or is an invalid symlink.
ERROR: /home/redacted/.cache/bazel/_bazel_redacted/8014adbd25095e36dd44091c6403d684/external/libevent/BUILD.bazel:8:6: Foreign Cc - CMake: Building libevent failed: not all outputs were created or valid
Target @@libevent//:libevent failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.408s, Critical Path: 9.18s
INFO: 2 processes: 1 internal, 1 linux-sandbox.
ERROR: Build did NOT complete successfully
 $ ls -l /home/redacted/.cache/bazel/_bazel_redacted/8014adbd25095e36dd44091c6403d684/execroot/_main/bazel-out/k8-fastbuild/bin/external/libevent/libevent/include
total 4
lrwxrwxrwx. 1 redacted redacted   41 Dec 20 13:28 evdns.h -> /tmp/bazel-source-roots/1/include/evdns.h
drwxr-xr-x. 2 redacted redacted 4096 Dec 20 13:28 event2
lrwxrwxrwx. 1 redacted redacted   41 Dec 20 13:28 event.h -> /tmp/bazel-source-roots/1/include/event.h
lrwxrwxrwx. 1 redacted redacted   42 Dec 20 13:28 evhttp.h -> /tmp/bazel-source-roots/1/include/evhttp.h
lrwxrwxrwx. 1 redacted redacted   41 Dec 20 13:28 evrpc.h -> /tmp/bazel-source-roots/1/include/evrpc.h
lrwxrwxrwx. 1 redacted redacted   42 Dec 20 13:28 evutil.h -> /tmp/bazel-source-roots/1/include/evutil.h
@jsharpe
Copy link
Member

jsharpe commented Dec 20, 2023

Duplicate of #1129 - see workarounds in that issue.

@jsharpe jsharpe closed this as completed Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants