Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

Use manifest to avoid shipping bare libstdc++-6.dll and libgcc_s_seh-1.dll in rust mingw bin dir #51

Open
vvuk opened this issue May 27, 2016 · 2 comments

Comments

@vvuk
Copy link

vvuk commented May 27, 2016

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.)

@larsbergstrom
Copy link

cc @alexcrichton

@alexcrichton
Copy link
Contributor

cc @brson

This would unfortunately be pretty difficult to do easily I think, but certainly not out of the question!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants