Skip to content

Commit

Permalink
Add workaround for cargo linker issues in MSVC when targeting i686
Browse files Browse the repository at this point in the history
When running cargo from MSVC, as of Rust 1.83, it uses build tools
for the target MSVC architecture rather than host, when building
build scripts. Unsetting 'VSTEL_MSBuildProjectFullPath' works around
this issue.

This workaround can be removed once the upstream issue has been fixed:
rust-lang/cc-rs#1308
  • Loading branch information
dlon committed Dec 2, 2024
1 parent db019b7 commit 7135f17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions windows/nsis-plugins/src/cleanup/cleanup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
<ModuleDefinitionFile>cleanup.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis</Command>
<Command>powershell.exe -Command "&amp; { Remove-Item Env:VSTEL_MSBuildProjectFullPath; cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis }"
</Command>
<Message>Build mullvad-nsis library</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand Down Expand Up @@ -105,7 +106,8 @@
<ModuleDefinitionFile>cleanup.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis</Command>
<Command>powershell.exe -Command "&amp; { Remove-Item Env:VSTEL_MSBuildProjectFullPath; cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis }"
</Command>
<Message>Build mullvad-nsis library</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand Down
6 changes: 4 additions & 2 deletions windows/nsis-plugins/src/log/log.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
<ModuleDefinitionFile>log.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis</Command>
<Command>powershell.exe -Command "&amp; { Remove-Item Env:VSTEL_MSBuildProjectFullPath; cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis }"
</Command>
<Message>Build mullvad-nsis library</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand Down Expand Up @@ -105,7 +106,8 @@
<ModuleDefinitionFile>log.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis</Command>
<Command>powershell.exe -Command "&amp; { Remove-Item Env:VSTEL_MSBuildProjectFullPath; cargo build --target i686-pc-windows-msvc --release -p mullvad-nsis }"
</Command>
<Message>Build mullvad-nsis library</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand Down

0 comments on commit 7135f17

Please sign in to comment.