Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo install difftastic failed with version 0.28.0 #289

Closed
mzji opened this issue May 19, 2022 · 4 comments
Closed

cargo install difftastic failed with version 0.28.0 #289

mzji opened this issue May 19, 2022 · 4 comments

Comments

@mzji
Copy link

mzji commented May 19, 2022

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 rust-lang/rust#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.

@Wilfred
Copy link
Owner

Wilfred commented May 19, 2022

Sounds similar to #253.

@mzji
Copy link
Author

mzji commented May 20, 2022

So would using +whole-archive modifier fix this error?

@petrochenkov
Copy link

+whole-archive shouldn't be necessary in this case, see #253 (comment).

@Wilfred
Copy link
Owner

Wilfred commented Aug 22, 2022

I believe this is a duplicate of #253, which has been fixed in the latest release.

@Wilfred Wilfred closed this as completed Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants