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

Error running on windows #56

Open
peakschris opened this issue Jun 17, 2024 · 4 comments
Open

Error running on windows #56

peakschris opened this issue Jun 17, 2024 · 4 comments

Comments

@peakschris
Copy link

I'm seeing an error in latest rules_lint, which I believe uses multirun 0.9.0 for its format module:

(.venv) d:\workdir\rules_lint3\example>bazel run :format
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:format (95 packages loaded, 4998 targets configured).
INFO: Found 1 target...
Target //tools/format:format_windows up-to-date:
  bazel-bin/tools/format/format_windows.bash
INFO: Elapsed time: 125.916s, Critical Path: 6.10s
INFO: 11 processes: 10 internal, 1 local.
INFO: Build completed successfully, 11 total actions
INFO: Running command line: bazel-bin/tools/format/format_windows.bash
FATAL: ExecuteProgram(D:\udu\b\l2x2bhay\execroot\_main\bazel-out\x64_windows-fastbuild\bin\tools\format\format_windows.bash) failed: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("D:\b\l2x2bhay\execroot\_main\bazel-out\x64_windows-fastbuild\bin\tools\format\format_windows.bash"): %1 is not a valid Win32 application.
 (error: 193)

This surprises me because at a glance it looks like rules_multirun invokes bash scripts with the bash executable.

Do you have any hints? Thanks!

@peakschris
Copy link
Author

I'm also seeing this in rules_multirun directly:

rules_multirun\tests>bazel run //tests:multirun_parallel

INFO: Invocation ID: e556a35b-abf7-46f2-83c7-9e666d412545
INFO: Analyzed target //tests:multirun_parallel (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tests:multirun_parallel up-to-date:
  bazel-bin/tests/multirun_parallel.bash
INFO: Elapsed time: 14.723s, Critical Path: 14.12s
INFO: 2 processes: 1 internal, 1 local.
INFO: Build completed successfully, 2 total actions
INFO: Running command line: bazel-bin/tests/multirun_parallel.bash
FATAL: ExecuteProgram(D:\udu\b\a7g3pybb\execroot\_main\bazel-out\x64_windows-fastbuild\bin\tests\multirun_parallel.bash) failed: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("D:\udu\b\a7g3pybb\execroot\_main\bazel-out\x64_windows-fastbuild\bin\tests\multirun_parallel.bash"): %1 is not a valid Win32 application.
 (error: 193)

I have an env up and running; if you can share some ideas, I can try them out

@keith
Copy link
Owner

keith commented Jun 17, 2024

I wonder if the issue is we need to be naming something with .exe at the end here? Or is it that we need to be calling bash.exe path/to/foo.bash?

@peakschris
Copy link
Author

peakschris commented Jun 17, 2024

I did some digging. Seems that ctx.runfiles don't work with bash scripts on windows. There is prior art in aspect bazel-lib, which has a tool that wraps a bash in a bat. I hacked this into an fix here: main...peakschris:rules_multirun:windows

But it all seems over-complex; all you are doing is launching the initial py_binary script. I wonder if there is a more modern canonical way to launch that works on all platforms?

@alexeagle, do you have any ideas?

@peakschris
Copy link
Author

My fix isn't quite there yet, I'm still getting errors:

d:\workdir\rules_lint3\example>bazel run :format
INFO: Running command line: bazel-bin/tools/format/format_windows.bash.bat
**xargs: environment is too large for exec**
Formatted C++ in 0m0.206s
FAILED: A formatter tool exited with code 1

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