bazelbuild/bazel

`aquery` of `CppLink` outputs extraneous param file path

Open

#17,536 opened on Feb 20, 2023

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Java (4,465 forks)batch import
P3help wantedteam-Rules-CPPtype: bug

Repository metrics

Stars
 (25,384 stars)
PR merge metrics
 (Avg merge 22d 20h) (77 merged PRs in 30d)

Description

Description of the bug:

In aquery outputs, by default command line arguments are expanded, but for CppLink action, the result contains both the expanded arguments and the param file path.

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

foo.cc

int main() { return 0; }

BUILD

cc_binary(
    name='foo',
    srcs=['foo.cc']
)

Run:

bazel aquery --output=text 'mnemonic(CppLink, //:foo)'
action 'Linking foo'
  Mnemonic: CppLink
  Target: //:foo
  Configuration: darwin-fastbuild
  Execution platform: @local_config_platform//:host
  ActionKey: 3b8a3654f4da51780786de7e6765419b258a366ceaf520aedcd03ac382f7366a
  Inputs: [bazel-out/darwin-fastbuild/bin/_objs/foo/foo.o, bazel-out/darwin-fastbuild/bin/foo-2.params, external/local_config_cc/cc_wrapper.sh, external/local_config_cc/libtool, external/local_config_cc/libtool_check_unique, external/local_config_cc/make_hashed_objlist.py, external/local_config_cc/wrapped_clang, external/local_config_cc/wrapped_clang_pp, external/local_config_cc/xcrunwrapper.sh]
  Outputs: [bazel-out/darwin-fastbuild/bin/foo]
  ExecutionInfo: {requires-darwin: '', supports-xcode-requirements-set: ''}
  Command Line: (exec external/local_config_cc/cc_wrapper.sh \
    -lc++ \
    -fobjc-link-runtime \
    -Wl,-S \
    -o \
    bazel-out/darwin-fastbuild/bin/foo \
    bazel-out/darwin-fastbuild/bin/_objs/foo/foo.o \
    -headerpad_max_install_names \
    -no-canonical-prefixes \
    -target \
    x86_64-apple-macosx12.3 \
    -Xlinker \
    -no_deduplicate \
    -lc++ \
    -target \
    x86_64-apple-macosx12.3 \
    @bazel-out/darwin-fastbuild/bin/foo-2.params)
# Configuration: a42135a42aad3da7e3af209ce54745fb0d0306dc29e1f3dc84d7d58372421fc9
# Execution platform: @local_config_platform//:host
  ExecutionInfo: {requires-darwin: '', supports-xcode-requirements-set: ''}

The command line arguments from the param file are already expanded, but there is still a @bazel-out/darwin-fastbuild/bin/foo-2.params argument at the end.

This doesn't reproduce for param files created by Starlark rules.

Which operating system are you running Bazel on?

macOS and Linux

What is the output of bazel info release?

release 6.0.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?

No response

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

No response

Contributor guide