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

cc_shared_library does not compile and link linkstamp sources #21724

Open
jsharpe opened this issue Mar 18, 2024 · 0 comments
Open

cc_shared_library does not compile and link linkstamp sources #21724

jsharpe opened this issue Mar 18, 2024 · 0 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug

Comments

@jsharpe
Copy link

jsharpe commented Mar 18, 2024

Description of the bug:

A cc_shared_library target doesn't compile the sources specified in linkstamp.

Which category does this issue belong to?

No response

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

BUILD:

cc_library(
    name = "version",
    srcs = ["version.cxx"],
    linkstamp = "version_linkstamp.cxx",
    alwayslink = 1,
)

cc_shared_library(
    name = "test",
    deps = [":version"],
)

bazel aquery -s --stamp --noenable_bzlmod //:test

gives:

action 'SolibSymlink _solib_k8/_U/libtest.so'
  Mnemonic: SolibSymlink
  Target: //:test
  Configuration: k8-fastbuild
  Execution platform: @local_config_platform//:host
  ActionKey: dea27c87bf681bed1845147d29145302f10c43a4d839c75d56887803254c7d59
  Inputs: [bazel-out/k8-fastbuild/bin/libtest.so]
  Outputs: [bazel-out/k8-fastbuild/bin/_solib_k8/_U/libtest.so]

action 'Writing file libtest.so-2.params'
  Mnemonic: FileWrite
  Target: //:test
  Configuration: k8-fastbuild
  Execution platform: @local_config_platform//:host
  ActionKey: 13f1694227a557cc705feae875a03db9fc92221b21255217196fc083908ca313
  Inputs: []
  Outputs: [bazel-out/k8-fastbuild/bin/libtest.so-2.params]

action 'Linking libtest.so'
  Mnemonic: CppLink
  Target: //:test
  Configuration: k8-fastbuild
  Execution platform: @local_config_platform//:host
  ActionKey: 0013ef3f2498529f58e54504110c5e396aad4caa69d9239ab44fa7d15347ec21
  Inputs: [bazel-out/k8-fastbuild/bin/_objs/version/version.pic.o, bazel-out/k8-fastbuild/bin/libtest.so-2.params, external/bazel_tools/tools/cpp/build_interface_so, external/bazel_tools/tools/cpp/link_dynamic_library.sh, external/local_config_cc/builtin_include_directory_paths]
  Outputs: [bazel-out/k8-fastbuild/bin/libtest.so]
  Command Line: (exec /usr/bin/gcc \
    -shared \
    -o \
    bazel-out/k8-fastbuild/bin/libtest.so \
    -Wl,-S \
    '-fuse-ld=gold' \
    -B/usr/bin \
    -Wl,-no-as-needed \
    -Wl,-z,relro,-z,now \
    -pass-exit-codes \
    bazel-out/k8-fastbuild/bin/_objs/version/version.pic.o \
    -Wl,--push-state,-as-needed \
    -lstdc++ \
    -Wl,--pop-state \
    -Wl,--push-state,-as-needed \
    -lm \
    -Wl,--pop-state)
# Configuration: a303d5046449e9530d714fc2c7dc28fdb07b7a8e6efa4dfa99bd28400c123431
# Execution platform: @@local_config_platform//:host

Which operating system are you running Bazel on?

Ubuntu 22.04

What is the output of bazel info release?

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

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

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

@sgowroji sgowroji added the team-Rules-CPP Issues for C++ rules label Mar 18, 2024
@comius comius added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Mar 21, 2024
jsharpe added a commit to jsharpe/bazel that referenced this issue Apr 22, 2024
Adds missing stamp argument to call to `cc_common.link` in
`cc_shared_library`. Fixes bazelbuild#21724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants