-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
0.25 gratuitously breaks cc_common.compile/link #8226
Comments
Hi Shams, this was under an experimental flag and was never supported. Unfortunately, from what I can see there was a bug in the flag implementation that let you use this in aspects. To fix it, change:
to:
0.25 still has the whitelisting and there are some bugs. But that example in particular should be fine. You will have to pass the flag --experimental_cc_skylark_api_enabled_packages followed by any packages that you want to allow this in. This is easy to change and we won't be delaying the release because of this. |
|
The functions do exist with a different signature. See my reply above. |
Yes, making those changes and passing the command line argument results in: |
Because the body of the function being invoked consists of |
(For the record, the changes in your reply had all ready been attempted prior to filing the bug, hence the "method invocation returned None" in the original bug description) |
I see, you are right. Those API methods were not supposed to be usable in Bazel at all, they were experimental. I'm sorry you were bit by this. I'm afraid you will have to wait for the next release. |
Intentional or not, they have been available since at least 0.22 and not documented as requiring any flag for use (or even marked experimental): https://docs.bazel.build/versions/0.22.0/skylark/lib/cc_common.html#compile While we've come to accept Bazel's inherent instability at this stage of development, the wholesale removal of documented, working (if deprecated) APIs with no warning or compatibility is unprecedented so far and downright hostile. |
The flag was there. As I said this was due to a bug. You didn't see the error message when trying this from a rule and not an aspect? |
I don't doubt that the flag was there but the flag, unlike the API itself, is never mentioned in any documentation. As we only ever had need of the |
hey @shahms, we're working on creating a patch release to fix this issue, hang tight :) |
It appears that 0.24.1 has been removed from the PPA ... could you at least restore that, please? (My apt-fu isn't good, so I might have missed something; but |
I also got the I tried reducing it to a minimal test case and got the same crash even when using it from a rule instead of an aspect: #build_defs.bzl
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
def _foo_rule_impl(ctx):
src = ctx.new_file(ctx.genfiles_dir, "foo.c")
hdr = ctx.new_file(ctx.genfiles_dir, "foo.h")
toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
cc_toolchain = toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
(compilation_context, compilation_outputs) = cc_common.compile(
actions = ctx.actions,
name = "foo",
feature_configuration = feature_configuration,
cc_toolchain = toolchain,
srcs = [src],
public_hdrs = [hdr],
compilation_contexts = [],
)
return []
foo_rule = rule(
output_to_genfiles = True,
implementation = _foo_rule_impl,
attrs = {
"_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"),
"deps": attr.label_list(),
},
)
# WORKSPACE
workspace(name = "foo_project")
# BUILD
load(":build_defs.bzl", "foo_rule")
foo_rule(name = "foo") Output:
Will the patch release fix this issue also? |
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address #8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. Adding a commit which reintroduces the implementation for cc_common.compile and cc_common.link #8226
Part of the problem is that there are some "experimental" flags that are widely used and unlikely to disappear; for example, |
(unrelated to the issue at hand) @kamahen: Experimental flags that are widely used are a problem. https://docs.bazel.build/versions/master/backward-compatibility.html is very clear that:
And Bazel team follows this policy, very likely to your disadvantage. Therefore the right procedure is to work with the experimental flag owner to stabilize the behavior and remove the flag. |
It seems this issue can be closed now that 0.25.1 with the fix is already released? |
Yeah, I've migrated Kythe for the relevant changes and that part works. Currently fighting some unrelated JDK issues. |
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address #8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. Adding a commit which reintroduces the implementation for cc_common.compile and cc_common.link #8226
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address #8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary * Add fix for #8254 * Add fix for #8280
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address bazelbuild#8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary * Add fix for bazelbuild#8254 * Add fix for bazelbuild#8280
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address #8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary + 6549ac5: Release 0.25.2 (2019-05-10) + 0ff19c6: Fix StandaloneTestStrategy.appendStderr Incompatible changes: - Flip --incompatible_windows_escape_jvm_flags to true. See #7486 This release contains contributions from many people at Google, as well as George Gensure, Keith Smiley, Robert Sayre.
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address bazelbuild#8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary * Add fix for bazelbuild#8254 * Add fix for bazelbuild#8280
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address bazelbuild#8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary + 6549ac5: Release 0.25.2 (2019-05-10) + 0ff19c6: Fix StandaloneTestStrategy.appendStderr Incompatible changes: - Flip --incompatible_windows_escape_jvm_flags to true. See bazelbuild#7486 This release contains contributions from many people at Google, as well as George Gensure, Keith Smiley, Robert Sayre.
Baseline: 0366246 Cherry picks: + 3f7f255: Windows: fix native test wrapper's arg. escaping + afeb8d0: Flip --incompatible_windows_escape_jvm_flags + 4299b65: Sort DirectoryNode children to ensure validity. + 231270c: Conditionally use deprecated signature for initWithContentsOfURL + 75a3a53: Add http_archive entries for testing with various JDK versions. + 4a6354a: Now that ubuntu1804 uses JDK 11, remove explicit ubuntu1804_java11 tests. + ae102fb: Fix wrong name of ubuntu1804_javabase9 task. + 0020a97: Remove @executable_path/Frameworks from rpaths + 130f86d: Download stderr/stdout to a temporary FileOutErr + 2ab3866: Release 0.25.0 (2019-05-01) + ed48a4a5fddbd93b057c3aa726e15720d79dcf8f: Add implementation to removed methods to address bazelbuild#8226 + 81aefe7: Remove unsupported cpu attribute from cc_toolchains. + cccced1: Release 0.25.1 (2019-05-07) + 0900660d67b53a56a13d1fa16a788e4cecbb1c0e: Use package identifier instead of package name + 85a5a2b: Configure @androidsdk//:emulator_x86 and :emulator_arm to point to the unified emulator binary + 6549ac5: Release 0.25.2 (2019-05-10) + 0ff19c6: Fix StandaloneTestStrategy.appendStderr Incompatible changes: - Flip --incompatible_windows_escape_jvm_flags to true. See bazelbuild#7486 This release contains contributions from many people at Google, as well as George Gensure, Keith Smiley, Robert Sayre.
Description of the problem / feature request:
Commit 976876d changed the API for
cc_common.compile
andcc_common.link
in a backwards incompatible way (fine), but also entirely removed the implementation. This would be sort of fine had that deleted implementation not persisted into a release version, but it has done so.This has broken a number of Kythe tests with no recourse but to blacklist 0.25.
Feature requests: what underlying problem are you trying to solve with this feature?
Not gratuitously breaking users of older in-the-progress-of-changing APIs with no recourse but to blacklist that release.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Take a previously working use of the old API (say https://github.com/kythe/kythe/blob/8cd2434b921b32bc2f941431c563cfabc6b384f9/tools/build_rules/verifier_test/cc_indexer_test.bzl#L152) and update it to the new API. Watch as the rule fails with:
What operating system are you running Bazel on?
Debian GNU/Linux rodete
What's the output of
bazel info release
?release 0.25.0
Have you found anything relevant by searching the web?
Yes, I found the commit which broke things.
The text was updated successfully, but these errors were encountered: