difftastic
difftastic copied to clipboard
`cargo install difftastic` failed with version `0.28.0`
It gives an error:
正在创建库 C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.lib 和对象 C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.exp
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: 无法解析的外部符号 tree_sitter_elm,函数 _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E 中引用了该符号
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: 无法解析的外部符号 tree_sitter_commonlisp,函数 _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E 中引用了该符号
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: 无法解析的外部符号 tree_sitter_dart,函数 _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E 中引用了该符号
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: 无法解析的外部符号 tree_sitter_haskell,函数 _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E 中引用了该符号
C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.exe : fatal error LNK1120: 4 个无法解析的外部命令
Translate to English:
Creating library C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.lib and object C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.exp
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: Unresolved external symbol tree_sitter_elm, which is referenced in function _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: Unresolved external symbol tree_sitter_elm tree_sitter_commonlisp, which is referencced in function _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: Unresolved external symbol tree_sitter_dart, which is referencced in function _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E
difft-31484d1ad26ac5fd.difft.0e6903af-cgu.5.rcgu.o : error LNK2019: Unresolved external symbol tree_sitter_haskell, which is referencced in function _ZN5difft18tree_sitter_parser13from_language17h203f9dc818c9c8b2E
C:\Users\USER\AppData\Local\Temp\cargo-installBseKmu\release\deps\difft-31484d1ad26ac5fd.exe : fatal error LNK1120: 4 unresolved external commands
With cargo install difftastic --locked
I get a different error:
正在创建库 C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.lib 和对象 C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.exp
tree-sitter-bash.lib(parser.o) : error LNK2001: 无法解析的外部符号 tree_sitter_bash_external_scanner_create
tree-sitter-bash.lib(parser.o) : error LNK2001: 无法解析的外部符号 tree_sitter_bash_external_scanner_destroy
tree-sitter-bash.lib(parser.o) : error LNK2001: 无法解析的外部符号 tree_sitter_bash_external_scanner_scan
tree-sitter-bash.lib(parser.o) : error LNK2001: 无法解析的外部符号 tree_sitter_bash_external_scanner_serialize
tree-sitter-bash.lib(parser.o) : error LNK2001: 无法解析的外部符号 tree_sitter_bash_external_scanner_deserialize
C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.exe : fatal error LNK1120: 5 个无法解析的外部命令
Translate to English:
Creating library C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.lib and object C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.exp
tree-sitter-bash.lib(parser.o) : error LNK2001: Unresolved external symbol tree_sitter_bash_external_scanner_create
tree-sitter-bash.lib(parser.o) : error LNK2001: Unresolved external symbol tree_sitter_bash_external_scanner_destroy
tree-sitter-bash.lib(parser.o) : error LNK2001: Unresolved external symbol tree_sitter_bash_external_scanner_scan
tree-sitter-bash.lib(parser.o) : error LNK2001: Unresolved external symbol tree_sitter_bash_external_scanner_serialize
tree-sitter-bash.lib(parser.o) : error LNK2001: Unresolved external symbol tree_sitter_bash_external_scanner_deserialize
C:\Users\USER\AppData\Local\Temp\cargo-installbwGNlh\release\deps\difft-f698373daea6e5e2.exe : fatal error LNK1120: 5 unresolved external commands
Version info about cargo and rustc:
C:\Users\USER>cargo version
cargo 1.63.0-nightly (3f052d8ee 2022-05-12)
C:\Users\USER>rustc --version
rustc 1.63.0-nightly (cd282d7f7 2022-05-18)
A hint of possible reason (picked from releases note of rust 1.61):
Compatibility Notes
Previously native static libraries were linked as whole-archive in some cases, but now rustc tries not to use whole-archive unless explicitly requested. This https://github.com/rust-lang/rust/pull/93901/ may result in linking errors in some cases. To fix such errors, native libraries linked from the command line, build scripts, or #[link] attributes need to (more common) either be reordered to respect dependencies between them (if a depends on b then a should go first and b second) (less common) or be updated to use the +whole-archive modifier.
Sounds similar to #253.
So would using +whole-archive
modifier fix this error?
+whole-archive
shouldn't be necessary in this case, see https://github.com/Wilfred/difftastic/issues/253#issuecomment-1132570958.
I believe this is a duplicate of #253, which has been fixed in the latest release.