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

incompatible_linkopts_to_linklibs: Move C++ toolchain's default LINKOPTS to LINKLIBS #10905

Closed
oquenchil opened this issue Mar 5, 2020 · 1 comment
Assignees
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules

Comments

@oquenchil
Copy link
Contributor

oquenchil commented Mar 5, 2020

unix_cc_configure used to have the default BAZEL_LINKOPTS [-lstdc++:-lm] and no default BAZEL_LINKLIBS which should have been the other way around. Flags in the former appear first in the command line before user linked libraries and the latter appears last. Because of this, the incompatible change #7687 started causing issues for many people (#9254)

Flag: --incompatible_linkopts_to_linklibs

This is an incompatible change because many people override the default BAZEL_LINKOPTS and the default BAZEL_LINKLIBS. For example, they may have BAZEL_LINKOPTS="-lc++:-lm", so with this change they would have both -lc++ and -lstdc++ in the command line.

Migration
If you were using BAZEL_LINKOPTS to add libraries, make sure you use BAZEL_LINKLIBS now.

Workaround till flag is flipped
Set the BAZEL_LINKOPTS and BAZEL_LINKLIBS variables yourself. You can do that in the bazelrc file with --repo_env

@oquenchil oquenchil self-assigned this Mar 5, 2020
@oquenchil oquenchil added incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules labels Mar 5, 2020
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Mar 6, 2020
Default linker flags contains flags like -lstdc++ which should come after the
user libraries. The library flags are removed from default linker flags and added to link_libs instead which comes after user libraries.

See #9254

Incompatible flag bug: bazelbuild/bazel#10905

I introduce a new method to repositories ctx that allows checking the value of a Starlark semantic option from a repository rule.

RELNOTES:none
PiperOrigin-RevId: 299336105
Change-Id: I81b9ee0c72e2a2252b406f1c584997389a530e40
bazel-io pushed a commit that referenced this issue Mar 6, 2020
Default linker flags contains flags like -lstdc++ which should come after the
user libraries. The library flags are removed from default linker flags and added to link_libs instead which comes after user libraries.

See #9254

Incompatible flag bug: #10905

I introduce a new method to repositories ctx that allows checking the value of a Starlark semantic option from a repository rule.

RELNOTES:none
PiperOrigin-RevId: 299336105
benjaminp added a commit to benjaminp/bazel that referenced this issue Oct 22, 2020
benjaminp added a commit to benjaminp/bazel that referenced this issue Oct 22, 2020
benjaminp added a commit to benjaminp/bazel that referenced this issue Oct 22, 2020
bazel-io pushed a commit that referenced this issue Oct 26, 2020
#10905

Closes #12334.

PiperOrigin-RevId: 339056354
@philwo
Copy link
Member

philwo commented Nov 18, 2020

Closing, because this flag has been flipped.

@philwo philwo closed this as completed Nov 18, 2020
stolyaroleh added a commit to stolyaroleh/pesto that referenced this issue Feb 26, 2021
copybara-service bot pushed a commit that referenced this issue Aug 24, 2022
…klibs

The incompatible flag was flipped in 2020 (#10905) and is the only flag for which repository_ctx.flag_enabled is used. This CL removes the flag, the Starlark code that checks the flag, and the flag_enabled method itself.

PiperOrigin-RevId: 469715344
Change-Id: I0e7198c6d5a99b1bd947c8fda830a2c394eb38b1
aiuto pushed a commit to aiuto/bazel that referenced this issue Oct 12, 2022
…klibs

The incompatible flag was flipped in 2020 (bazelbuild#10905) and is the only flag for which repository_ctx.flag_enabled is used. This CL removes the flag, the Starlark code that checks the flag, and the flag_enabled method itself.

PiperOrigin-RevId: 469715344
Change-Id: I0e7198c6d5a99b1bd947c8fda830a2c394eb38b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

No branches or pull requests

6 participants