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

Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script/tool (related to fission feature) #25336

Open
trzeciak opened this issue Feb 19, 2025 · 2 comments

Comments

@trzeciak
Copy link

Description of the feature request:

As the title says, the action to combine dwo files into dwp files is not configured to provide environment variables, take a look at the latest source code, the action named CcGenerateDwp is declared here LINK:

    ctx.actions.run(
        mnemonic = "CcGenerateDwp",
        tools = packager["tools"],
        executable = packager["executable"],
        toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
        arguments = [packager["arguments"]],
        inputs = packager["inputs"],
        outputs = packager["outputs"],
    )

As you can see, the env variable is not declared for this action.
The same applies to CcGenerateIntermediateDwp action.

For comparison, I found the CppArchive action where the env variable is set LINK:

    env = cc_common.get_environment_variables(
        feature_configuration = feature_configuration,
        action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
        variables = archiver_variables,
    )
    …
    ctx.actions.run(
        executable = archiver_path,
        toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
        arguments = [args],
        env = env,
        inputs = depset(
            direct = object_files,
            transitive = [
                cc_toolchain.all_files,
            ],
        ),
        use_default_shell_env = True,
        outputs = [output_file],
        mnemonic = "CppArchive",
    )

I would expect there should be an option to set env's variables for the dwp tool as well.

Which category does this issue belong to?

C++ Rules

What underlying problem are you trying to solve with this feature?

I ran into this when trying to implement debug fission functionality in the emsdk-bazel-toolchain. Here's a link to the PR discussion thread: emscripten-core/emsdk#1531 (comment)

Which operating system are you running Bazel on?

macOS, linux and windows

What is the output of bazel info release?

release 7.5.0, release 5.4.0, release 6.4.0, release 8.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 ?


Have you found anything relevant by searching the web?

I initially asked on bazel-slack, but no response: https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1739488236571719,
Then I started analyzing it in PR to emsdk: emscripten-core/emsdk#1531 (comment)

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

I'm submitting this as a feature request, even though it looks a bit like a bug/oversight.

@fmeum
Copy link
Collaborator

fmeum commented Feb 20, 2025

Would you be interested in sending a PR? While you are at it, you could also add the execution_requirements obtained from the toolchain.

@trzeciak
Copy link
Author

trzeciak commented Feb 20, 2025

Yes and no xD.
Yes, since Bazel is in my area of ​​interest, such PR would allow me to expand my knowledge of bazel and implement specific programming challenges more easily/better in future.
Unfortunately: I am still a newbie to bazel, I can only work on it part of my time, I don't like java (also script version xD).

But if someone guides me, we can try.

  • I haven't compiled Bazel itself yet, I don't know if it's a complicated process(?).
  • I have the impression that it is necessary to add actions to the action_names.bzl file, and related files in java and tests.
  • What should be the scope of my changes?
  • Any set of tips to get me started(?) xD

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

No branches or pull requests

5 participants