rust-packaging
rust-packaging copied to clipboard
Use manifest to avoid shipping bare libstdc++-6.dll and libgcc_s_seh-1.dll in rust mingw bin dir
The mingw build of rust ships with libstdc++-6.dll and libgcc_s_seh-1.dll in the bin path. This can conflict with a system (mingw/msys) installed version of those DLLs, and can cause weird errors -- for example, trying to build rust-bindgen against the system libclang.dll results in a bindgen.exe that doesn't start, because it tries to use rustc's libstdc++-6.dll, whereas libclang.dll needs a newer/different libstdc++.
A solution for this is to use manifest files and move these two DLLs to a private directory that's not in the path. In the rustc bin dir:
rustc.exe.manifest
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="amd64"
name="APPLICATION"
type="win32"
/>
<description>Rust Compiler</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Rust.PrivateRuntime"
version="1.0.0.0"
processorArchitecture="amd64"/>
</dependentAssembly>
</dependency>
</assembly>
Rust.PrivateRuntime.manifest
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32"
name="Rust.PrivateRuntime"
version="1.0.0.0"
processorArchitecture="amd64"/>
<file name="rust-private\libstdc++-6.dll"/>
<file name="rust-private\libgcc_s_seh-1.dll"/>
</assembly>
And then moving libstdc++-6.dll
and libgcc_s_seh-1.dll
to a new rustc/bin/rust-private/
directory.
(Note to manually test this out, you have to touch rustc.exe
after creating rustc.exe.manifest
, otherwise the manifest won't be read.)
cc @alexcrichton
cc @brson
This would unfortunately be pretty difficult to do easily I think, but certainly not out of the question!