mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
BuildRustCrate: proc macros must be built for build's platform
When cross compiling proc macros, the proc macro needs to be built for the build platform's architecture. Without this change cross compiling from Darwin to Linux would simply fail because it tries to link to a library with a file extension that doesn't exist on the builder's platform.
This commit is contained in:
parent
41dcd09eb0
commit
fb927d5019
@ -49,6 +49,8 @@ let
|
||||
filename =
|
||||
if lib.any (x: x == "lib" || x == "rlib") dep.crateType
|
||||
then "${dep.metadata}.rlib"
|
||||
# Adjust lib filename for crates of type proc-macro. Proc macros are compiled/run on the build platform architecture.
|
||||
else if (lib.attrByPath [ "procMacro" ] false dep) then "${dep.metadata}${stdenv.buildPlatform.extensions.library}"
|
||||
else "${dep.metadata}${stdenv.hostPlatform.extensions.library}";
|
||||
in
|
||||
" --extern ${opts}${name}=${dep.lib}/lib/lib${extern}-${filename}"
|
||||
|
Loading…
Reference in New Issue
Block a user