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

Expose as_executable in ctx.host_fragments.cpp #5494

Closed
mboes opened this issue Jun 29, 2018 · 2 comments
Closed

Expose as_executable in ctx.host_fragments.cpp #5494

mboes opened this issue Jun 29, 2018 · 2 comments

Comments

@mboes
Copy link
Contributor

mboes commented Jun 29, 2018

Description of the feature request:

ctx.host_fragments.cpp already contains fields such as compiler_executable, nm_executable etc pointing to the locations of said executable detected by Bazel. We propose to add ctx.host_fragments.cpp.as_executable to that set for the assembler.

Feature requests: what underlying problem are you trying to solve with this feature?

Older versions of GCC call an as executable that it expects to be on the path. In hermetic builds with no default user environment, (i.e. with no /usr/bin in PATH), we expose in the PATH a folder with symlinks to exactly those executables that are necessary for the build. But it's hard to do if Bazel doesn't tell us where the assembler is. It already tells us where gcc, ar, nm etc are. So it shouldn't be very onerous to expose as as well.

What operating system are you running Bazel on?

ubuntu 16.04

What's the output of bazel info release?

0.15.0

Have you found anything relevant by searching the web?

Nothing in the issue tracker.

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

cc @iphydf

mboes added a commit to tweag/rules_haskell that referenced this issue Jun 29, 2018
@hlopko
Copy link
Member

hlopko commented Jun 29, 2018

New C++ toolchain Skylark API is already submitted at HEAD, so it will be available in the next release. Then you can get path to ar by:

load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "CPP_LINK_STATIC_LIBRARY_ACTION_NAME")

cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
    cc_toolchain = cc_toolchain,
    requested_features = ctx.features,
    unsupported_features = ctx.disabled_features)
archive_variables = cc_common.create_link_build_variables(
    feature_configuration = feature_configuration,
    cc_toolchain = cc_toolchain,
    is_using_linker = false)
archiver = cc_common.get_tool_for_action(
    feature_configuration = feature_configuration,
    action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME)
archive_command_line = cc_common.get_command_line(
    feature_configuration = feature_configuration,
    action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
    variables = archive_variables)

@hlopko
Copy link
Member

hlopko commented Jun 29, 2018

#4571 is the tracking bug. Therefore I'll close this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants