Skip to content

[Bug]: js_binary launcher script not portable from host to exec platform #1168

Open
@alexeagle

Description

@alexeagle

What happened?

When RBE is used for cross-compilation, the host platform may be different from the exec platform.

In my case I have a linux_x86 host platform, so the launcher created by ctx.actions.expand_template here

ctx.actions.expand_template(
template = ctx.file._launcher_template,
output = launcher,
substitutions = launcher_subst,
is_executable = True,
)

will create a file with a node path pointing to the host-resolved toolchain, with linux_x86 arch.

Now, I enable RBE and the exec platform is linux_arm64. The launcher script is copied to the remote and tries to spawn node for the wrong arch, which of course fails with executable format error cannot execute binary file ...nodejs_linux_amd64...`

Version

Bazel 6.2.1, latest of rules_js

How to reproduce

Tricky since you need an RBE setup with alternate architecture.

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed: investigationInvestigation required to proceed further

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions