-
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
java.lang.IllegalStateException from rule using new C++ toolchain + returning CcInfo #7136
Comments
I see that you are passing a .o file. We want to eventually allow .o files to be passed to the linking API as well, but for now could you try to create a .a file with an action that calls the archiver? |
Thanks -- performing a static link fixed the failing input validation crash, and allowed the resulting For those following along at home, here's the rules required to run out_a = ctx.actions.declare_file("{}.a".format(ctx.attr.name))
ar = cc_common.get_tool_for_action(
feature_configuration = features,
action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
)
ar_vars = cc_common.create_link_variables(
cc_toolchain = cc_toolchain,
feature_configuration = features,
output_file = out_a.path,
is_using_linker = False,
is_static_linking_mode=True,
)
ar_argv = cc_common.get_memory_inefficient_command_line(
feature_configuration = features,
action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
variables = ar_vars,
)
ar_env = cc_common.get_environment_variables(
feature_configuration = features,
action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
variables = ar_vars,
)
ctx.actions.run(
inputs = depset([out_obj]) + ctx.attr._cc_toolchain[DefaultInfo].files,
outputs = [out_a],
executable = ar,
arguments = ar_argv + [out_obj.path],
mnemonic = "StaticLink",
progress_message = "testing cc toolchain",
env = ar_env,
) |
We have a mechanism in the c++ toolchain how to configure the extension used, and setters are going to be exposed to Starlark for #5380 in https://source.bazel.build/bazel/+/2dccff01ae0711fa6729fd149ed66845ec6b0f54:tools/cpp/cc_toolchain_config_lib.bzl;l=509. TIL getters are not exposed, and they should be. If you need this, please file a new issue, and we'll reprioritize. Thanks for testing the API! |
OK, filed #7170 for file extension accessors. |
Using the new C++ Starlark API (#4570, #7036), I get a large Java stack trace when trying to build a hello world -ish
cc_library
equivalent.Version + environment: Bazel 0.22rc1 on macOS 10.12.6.
Stack trace:
rule (trimmed let me know if you want the whole thing):
BUILD file:
The text was updated successfully, but these errors were encountered: