cc_library broken in bazel 5?

52 views
Skip to first unread message

Gregg Reynolds

unread,
Sep 13, 2022, 10:40:58 AM9/13/22
to bazel-discuss
I've discovered the hard way that:

Under 4.2.0, cc_library produced both .a and .so files. Under 5 and above it only produces the .a file.

This breaks my ruleset.  (It also breaks the documentation.) Is it a bug?

Thanks,

Gregg

Tobias Werth

unread,
Sep 13, 2022, 10:56:22 AM9/13/22
to Gregg Reynolds, Pedro Liberal Fernandez, bazel-discuss
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAO40Mi%3D0tT2oOx3MQkS30xuC8VBn_F5NserCiNZQ%2B%2BsLYJ5k2w%40mail.gmail.com.


--

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 

     

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

Pedro Liberal Fernandez

unread,
Sep 13, 2022, 11:10:03 AM9/13/22
to Tobias Werth, Gregg Reynolds, bazel-discuss
Can you provide code? Your rule's code and an example build file. There is no general breakage or we would have noticed before. It might still be a bug in Bazel and if it is, it would be due to some specific interaction with your rule.


Gregg Reynolds

unread,
Sep 13, 2022, 12:05:50 PM9/13/22
to Pedro Liberal Fernandez, Tobias Werth, bazel-discuss

cc_library(
    name = "alpha",
    srcs = [
        "alpha.c",
        "alpha.h",
    ],
    linkstatic = False
)

alpha.h:
#include <stdio.h>
int my_int_fn();
char* my_str_fn();

alpha.c:
#include <stdio.h>
#include "alpha.h"
int my_int = 17;
int my_int_fn()
{
    return my_int;
}
char *my_str = "hello";
char* my_str_fn()
{
    return my_str;
}

$ bazel version
Bazelisk version: development
Build label: 4.2.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Aug 18 12:54:03 2021 (1629291243)
Build timestamp: 1629291243
Build timestamp as int: 1629291243
$ bazel build interop/ffi/case110/cclibs:alpha
INFO: Analyzed target //interop/ffi/case110/cclibs:alpha (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //interop/ffi/case110/cclibs:alpha up-to-date:
  bazel-bin/interop/ffi/case110/cclibs/libalpha.a
  bazel-bin/interop/ffi/case110/cclibs/libalpha.so

$ bazel version
Bazelisk version: development
Starting local Bazel server and connecting to it...
Build label: 5.3.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Aug 23 00:55:02 2022 (1661216102)
Build timestamp: 1661216102
Build timestamp as int: 1661216102
$ bazel build interop/ffi/case110/cclibs:alpha
INFO: Analyzed target //interop/ffi/case110/cclibs:alpha (53 packages loaded, 397 targets configured).
INFO: Found 1 target...
Target //interop/ffi/case110/cclibs:alpha up-to-date:
  bazel-bin/interop/ffi/case110/cclibs/libalpha.a
INFO: Elapsed time: 14.022s, Critical Path: 0.37s

Gregg Reynolds

unread,
Sep 13, 2022, 12:18:29 PM9/13/22
to Pedro Liberal Fernandez, Tobias Werth, bazel-discuss
Is it possible some other ruleset might be interfering?  For example I download rules_foreign_cc and skylib.  My own rules have code to manipulate CcInfo providers using cc_common APIs. Maybe there's some kind of state in the rules that I'm corrupting?

Gregg

On Tue, Sep 13, 2022 at 10:10 AM Pedro Liberal Fernandez <p...@google.com> wrote:

Gregg Reynolds

unread,
Sep 13, 2022, 2:47:06 PM9/13/22
to Pedro Liberal Fernandez, Tobias Werth, bazel-discuss
Just to be sure I created an mwe with no external dependencies and filed an issue: https://github.com/bazelbuild/bazel/issues/16271

On Tue, Sep 13, 2022 at 10:10 AM Pedro Liberal Fernandez <p...@google.com> wrote:

Konstantin

unread,
Nov 12, 2022, 4:56:56 PM11/12/22
to bazel-discuss
I'd suspect some change in the --output_groups flag default value or somehow explicitly set one.
Reply all
Reply to author
Forward
0 new messages