Skip to content

Building Sed bzlmod with gcc-toolchain fails for nl_langinfo.c symbols 'ALTMON_*' #212

@mmellin

Description

@mmellin

I am trying to build the Sed bazel module via Bazel 7 & 8 and gcc-toolchain v0.9.0 on an Ubuntu 24.04 host. With the toolchain active the build fails. Without using the gcc-toolchain it succeeds.

Errors seen:

$ bazel build @sed//:sed
...truncated

external/sed+/lib/nl_langinfo.c: In function 'nl_langinfo':
external/sed+/lib/nl_langinfo.c:474:12: error: 'ALTMON_1' undeclared (first use in this function); did you mean 'ABMON_1'?
  474 |       case ALTMON_1:
      |            ^~~~~~~~
      |            ABMON_1
external/sed+/lib/nl_langinfo.c:474:12: note: each undeclared identifier is reported only once for each function it appears in
external/sed+/lib/nl_langinfo.c:475:12: error: 'ALTMON_2' undeclared (first use in this function); did you mean 'ABMON_2'?
  475 |       case ALTMON_2:
      |            ^~~~~~~~
      |            ABMON_2
...truncated
$ cat MODULE.bazel
module(name="example")

bazel_dep(name = "sed", version = "4.9.bcr.3")

bazel_dep(name = "gcc_toolchain", version = "0.9.0")
gcc_toolchains = use_extension("@gcc_toolchain//toolchain:module_extensions.bzl", "gcc_toolchains", dev_dependency = True)

[
    [
        gcc_toolchains.toolchain(
            name = "gcc_toolchain_{}".format(arch),
            gcc_version = "13.4.0",
            target_arch = arch,
        ),
        use_repo(gcc_toolchains, "gcc_toolchain_{}".format(arch)),
        register_toolchains(
            "@gcc_toolchain_{}//:cc_toolchain".format(arch),
            dev_dependency = True,
        ),
    ]
    for arch in [
        "aarch64",
        # "armv7",
        "x86_64",
    ]
]

I have tried naively using --copt=-D_GNU_SOURCE with no luck.

Is this issue expected or is there a workaround? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions