bazel-contrib / bazel-lib

Common useful functions for writing BUILD files and Starlark macros/rules
Apache License 2.0
137 stars 89 forks source link

[Bug]: bsdtar.exe fails to run on windows: libcrypto dll not found #848

Open peakschris opened 6 months ago

peakschris commented 6 months ago

What happened?

With rules_js 1.42.1 (and aspect_bazel_lib 2.7.3) 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/node@20.12.12 failed: (Exit -1073741515): bsdtar.exe failed: error executing NpmPackageExtract command (from target //:.aspect_rules_js/node_modules/@types+node@20.12.12/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/@types+node@20.12.12/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: image

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: rules_js 1.42.1 aspect_bazel_lib 2.7.3

Language(s) and/or frameworks involved:

How to reproduce

No response

Any other information?

No response

peakschris commented 6 months ago

This is the relevant open issue https://github.com/libarchive/libarchive/issues/1925

jjh42 commented 3 months ago

Did you find any workaround for this, like installing the dll?

peakschris commented 3 months ago

No, I'm still blocked for now on windows.

There has been action fixing a chain of issues, thanks to everyone who has contributed. The current issue is https://github.com/aspect-build/bsdtar-prebuilt/issues/3. So I'm hoping it won't be long.

jjh42 commented 3 months ago

This is my hack workaround to use system version of bsdtar (I'm using msys2 on windows). So its no longer hermetic toolchain but seems to work for me.

https://github.com/elefant-ai/rules_js/commit/e98e7d4649fda9584c272925fcbfee769bd483f3

thesayyn commented 2 weeks ago

Related, https://github.com/bazel-contrib/bazel-lib/issues/968