rules_js
rules_js copied to clipboard
[Bug]: bsdtar.exe fails to run on Windows
What happened?
With rules_js 1.42.1 on Windows, running js_test targets fails due to a missing crypto DLL:
D:\workspace>bazel test //src/test --verbose_failures WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time INFO: Analyzed target //src/test:test (0 packages loaded, 0 targets configured). ERROR: D:/workspace/BUILD.bazel:6:22: Extracting npm package @types/[email protected] failed: (Exit -1073741515): bsdtar.exe failed: error executing NpmPackageExtract command (from target //:.aspect_rules_js/node_modules/@[email protected]/pkg) cd /d D:/udu/b/nag22qmp/execroot/_main external\aspect_bazel_lib~~toolchains~bsd_tar_windows_amd64\libarchive\bin\bsdtar.exe --extract --no-same-owner --no-same-permissions --strip-components 1 --file external/aspect_rules_js~~npm~npm__at_types_node__20.12.12/package.tgz --directory bazel-out/x64_windows-opt/bin/node_modules/.aspect_rules_js/@[email protected]/node_modules/@types/node
Configuration: d850a7e5673f06961afdd7f68e62a46ae2620e12a4464604ad6d160b42ae6c5f
Execution platform: @@my_toolchain~//platforms:x64_windows
Target //src/test:test failed to build INFO: Elapsed time: 1.440s, Critical Path: 0.93s INFO: 41 processes: 41 internal. ERROR: Build did NOT complete successfully //src/test:test FAILED TO BUILD
Running the exe by double clicking is the easiest way to see what dependency is missing:
The issue is that libcrypto-1_1-x64.dll is not found
Version
Development (host) and target OS/architectures:
Output of bazel --version:
7.2.0rc1
Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
1.42.1
Language(s) and/or frameworks involved: node 18.20.0
How to reproduce
No response
Any other information?
No response
This is blocked on upstream: https://github.com/bazelbuild/bazel-central-registry/pull/1916
The upstream commit is merged. Do we expect this to work now? I'll look into overriding versions to see if there is something that hasn't trickled down to me yet, or whether something is held back that shouldn't be.
I can give you the mod graph if that helps.
ERROR: C:/tmp/eprbnvuo/external/com_github_buildbarn_bb_storage~/BUILD.bazel:28:22: Extracting npm package [email protected] [for tool] failed: (Exit -1073741515): bsdtar.exe failed: error executing NpmPackageExtract command (from target @@com_github_buildbarn_bb_storage~//:.aspect_rules_js/node_modules/[email protected]/pkg)
cd /d C:/tmp/eprbnvuo/execroot/_main
external\aspect_bazel_lib~~toolchains~bsd_tar_windows_amd64\libarchive\bin\bsdtar.exe --extract --no-same-owner --no-same-permissions --strip-components 1 --file external/aspect_rules_js~~npm~com_github_buildbarn_bb_storage_npm__purgecss__6.0.0/package.tgz --directory bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/com_github_buildbarn_bb_storage~/node_modules/.aspect_rules_js/[email protected]/node_modules/purgecss
$ external\\aspect_bazel_lib~~toolchains~bsd_tar_windows_amd64\\libarchive\\bin\\bsdtar.exe --extract --no-same-owner --no-same-permissions --strip-components 1 --file external/aspect_rules_js~~npm~com_github_buildbarn_bb_storage_npm__purgecss__6.0.0/package.tgz --directory bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/com_github_buildbarn_bb_storage~/node_modules/.aspect_rules_js/[email protected]/node_modules/purgecss
C:/tmp/eprbnvuo/execroot/_main/external/aspect_bazel_lib~~toolchains~bsd_tar_windows_amd64/libarchive/bin/bsdtar.exe: error while loading shared libraries: libcrypto-1_1-x64.dll: cannot open shared object file: No such file or directory
$ bazel mod graph | grep -e aspect_rules_js -e bazel_lib
├───[email protected]
├───[email protected]
│ ├───[email protected] (*)
│ ├───[email protected] (*)
│ ├───[email protected] (*)
│ ├───[email protected] (*)
│ ├───[email protected] (*)
│ ├───[email protected] (*)
│ ├───[email protected] (*)
Do we expect this to work now?
No, https://github.com/aspect-build/bsdtar-prebuilt/issues/3
We haven't found time for this, slipping from 2.0 release. Sorry!
I know https://github.com/aspect-build/bsdtar-prebuilt/issues/3 released a windows build for tar, but pulling in the newer libarchive with rules_js leads to : "tar.exe: Error opening archive: Can't initialize filter; unable to run program "gzip -d"" on Windows when extracting any npm package. I know this issue is still open, but it seems like the specific issue of the libarchive build depending on a shared library on Windows might no longer be an issue, but there still is perhaps a non-hermeticity with gzip? Has anyone else successfully used the windows pre-built bsdtar?
Extracting npm package [email protected] [for tool] failed: (Exit 1): bash.exe failed: error executing NpmPackageExtract command (from target //examples:.aspect_rules_js/node_modules/[email protected]/pkg)
cd /d C:/b/execroot/_main
C:\tools\msys64\usr\bin\bash.exe -c $1 --extract --no-same-owner --no-same-permissions --strip-components 1 --file $2 --directory $3 && chmod -R a+X $3 external/aspect_bazel_lib~~toolchains~bsd_tar_windows_amd64/tar.exe external/aspect_rules_js~~npm~npm__typescript__4.5.2/package.tgz bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/examples/node_modules/.aspect_rules_js/[email protected]/node_modules/typescript
# Configuration: 413e0e99a368ce1982c146eb42fe359cb9f798964cb25bca43144fc633892fa7
# Execution platform: @@platforms//host:host
tar.exe: Error opening archive: Can't initialize filter; unable to run program "gzip -d"
@willjschmitt yes we are aware, see https://github.com/bazel-contrib/tar.bzl/issues/10
I am not seeing this anymore with latest rules_js -- but am a little confused about the chain of open issues -- is this fully fixed now @alexeagle?
As far as I know, yes