-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
Description
Describe the bug
Trying to build the //rts:add-one
target in the examples
project, it fails with:
ld.lld: error: undefined symbol: add_one_hs
>>> referenced by bazel-out/x64_windows-fastbuild/bin/rts/_objs/add-one/main.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To Reproduce
- checkout rules_haskell
cd examples
USE_BAZEL_VERSION=6.x bazelisk build //rts:add-one
Expected behavior
This should work fine.
Environment
- OS name + version: Windows 2022 (github actions windows-latest)
- Bazel version: 6.5
- Version of the rules: 1.0
Additional context
This seems to be caused by ghc creating an ar archive instead of just a simple object file:
$ ar x libHSrtsZSadd-one-hs.a
$ file One.o
One.o: current ar archive
$ ar t One.o
ghc_6.o
ghc_5.o
The object file is produced by //rts:add-one-hs
and called One.o. This file is then added to a static archive:
external/rules_haskell_ghc_windows_amd64/mingw/bin/ar
qc
bazel-out/x64_windows-fastbuild/bin/rts/libHSrtsZSadd-one-hs.a
bazel-out/x64_windows-fastbuild/bin/rts/_obj/add-one-hs/One.o
Trying to use gcc / GNU ld instead of clang resulted in an error from ld, stating that the libHSrtsZSadd-one-hs.a
archive is missing an index and suggested to create one using ranlib.