You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linker driver is clang (i.e. requires --target=triple option to link for the correct target)
OS is not MacOS (rustc adds --target automatically on Darwin).
The dependency graph contains a target that requires the linker to be invoked for the cross-compilation target. This should only be dynamic libraries. Note: This does not include the final artifact - We already pass the the --target flag via cargo rustc to the final linker invocation.
Untested, but probably this requirement also applies:
compiler option to use lld (-fuse-ld=lld) is NOT set.
If such a dependency exists in the graph, then linking it will fail, since clang will call the host linker instead of the target linker.
Constraints for solutions:
Adding the argument to the global RUSTFLAGS has the side-effect of overriding any rustflags set via .cargo/config.toml, which may be unexpected, especially since it only happens in the cross-compiling with clang scenario.
Setting the linker to clang --target=xxx does not work, since this is treated as the executable name.
Writing a small wrapper shell script would be possible on Linux, but on Windows it looks like there is no guaranteed way to pass through arguments without changing them with a small script. We could instead compile a small Rust program which calls the linker-driver without going over the shell again.
It is unclear if this will be fixed upstream in Rust, since currently gcc and clang are treated entirely the same (except on mac).
The text was updated successfully, but these errors were encountered:
Bug Scenario:
Darwin
).--target
flag viacargo rustc
to the final linker invocation.Untested, but probably this requirement also applies:
-fuse-ld=lld
) is NOT set.If such a dependency exists in the graph, then linking it will fail, since clang will call the host linker instead of the target linker.
Constraints for solutions:
.cargo/config.toml
, which may be unexpected, especially since it only happens in the cross-compiling with clang scenario.clang --target=xxx
does not work, since this is treated as the executable name.The text was updated successfully, but these errors were encountered: