Skip to content

cc_library rule should support additional_linker_inputs option #17788

@nicholasjng

Description

@nicholasjng

Description of the bug:

Relevant discussion: https://groups.google.com/g/bazel-discuss/c/1VFvNBDqzVU

I am trying to pass a (pre-generated) linker response file to a cc_library rule on MacOS, and was pointed to the additional_linker_inputs option in case of a cc_binary, which would allow me to make the file available to the linker.

Unfortunately, it seems the cc_library rule does not support the additional_linker_inputs option. So this can also be considered a feature request for linker file input support for cc_library rules.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

The desired end result (adapted from the thread):

filegroup(
    name = "linker_response_file",
    srcs = ["linker_response_file.sym"],
)

cc_library(
    name = "main",
    srcs = ["main.cc"],
    additional_linker_inputs = [":linker_response_file.sym"],  # <- throws an ERROR: no such attribute 'additional_linker_inputs' in 'cc_library' rule
    linkopts = ["-Wl,@$(location :linker_response_file.sym)"],
)

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 6.1.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

This is a follow-up to https://groups.google.com/g/bazel-discuss/c/1VFvNBDqzVU

(The commenter there told me to open this bug report, but the message does not seem to appear for some reason.)

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)team-Rules-CPPIssues for C++ rulestype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions