Skip to content

Issues with crt2.o and dllcrt2.o from mingw. #53454

Closed

Description

@crlf0710

Those crt2.o and dllcrt2.o files have to match the gcc.exe used. So for example when i use win-gnu target in a msvc toolchain, I'll install my own copy of MINGW, and it should provide gcc.exe and those .o files, and i shouldn't use the rust-provided one.

So I suggest:

  1. We package these files in "rust-mingw" component instead of current "rust-std" component in win-gnu builds.
  2. Make people able to use an environment variable or something to specify where to pick these .o files in the linker command.

Activity

  1. added a commit that references this issue on Apr 4, 2019
  2. added a commit that references this issue on Jun 6, 2019
  3. Amanieu commented on Oct 29, 2019

    @Amanieu
    Member

    Could we always use the crt2.o from the host toolchain? We can get the path by invoking i686-w64-mingw32-gcc -print-file-name=crt2.o

  4. mati865 commented on Oct 29, 2019

    @mati865
    Member

    That was my idea about solving it but couldn't manage to make simple fix.
    Probably the best way here would be calling cc once to get the path and cache it. Since it will be the C toolchain lib dir possibility of finding conflicting Rust libs should be zero.

    Edit: nowadays also msvcrt.a and mingwex.a also cause issues and the list will grow since Rust shipped libs become more out of sync from mingw-w64 headers installed on the system.
    Generally every mingw-w64 lib that is shipped by Rust should be replaced with system one if it's available.

  5. added
    A-linkageArea: linking into static, shared libraries and binaries
    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Nov 19, 2019
  6. added
    T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.
    on Nov 28, 2019
  7. added 2 commits that reference this issue on Jan 31, 2020
    3392cc9
    58b8343
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-bugCategory: This is a bug.O-windows-gnuToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions