jmillikin / rules_bison

Bazel build rules for GNU Bison
Apache License 2.0
16 stars 25 forks source link

Execution fails on Windows #5

Closed corco closed 1 year ago

corco commented 4 years ago

Bison fails to execute on Windows:

bazel build //tests:hello_c

fails with:

ERROR: D:/rules_bison/tests/BUILD:24:1: Bison //tests:hello_c failed (Exit 1)
bison.exe: bazel-out/host/bin/external/bison_v3.3.2/bin/bison.exe.runfiles/bison_v3.3.2/data/m4sugar/m4sugar.m4: cannot open: No such file or directory
Target //tests:hello_c failed to build

I believe the issue is that on Windows the runfiles are not symlinked but instead bazel put a MANIFEST file in bazel-out/host/bin/external/bison_v3.3.2/bin/bison.exe.runfiles with the correct mapping.

Replacing M4 and and BISON_PKGDATADIR with the mapped values make the execution pass. I am not sure how to do that with the bazel scripts though.

jmillikin commented 4 years ago

This did work once upon a time -- I believe I tested with one of the Bazel 0.x series -- but it's possible that something changed in how Bazel places runfiles on disk in non-sandboxed environments.

I'll try to look into this at some point, but I don't have any Windows development machines at the moment, so it may take a while until I have enough spare time to spin up a Win32 dev VM.

jmillikin commented 1 year ago

rules_bison now has CI support in Windows (via BazelCI), so I tried to reproduce this problem without luck. The Windows build worked fine.

It's possible the original reporter forgot to run Bazel with --enable_runfiles (https://bazel.build/reference/command-line-reference#flag--enable_runfiles).