Skip to content

Add a new cygwin target #79854

@mintty

Description

@mintty

According to the sparse build instructions available, rust should be built by running x.py.
After a bunch of secondary downloads, removing obstacles with curl, it fails at:
error: manifest path /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml does not ex
ist
failed to run: /cygdrive/c/tmp/rust/build/i686-pc-windows-gnu/stage0/bin/cargo build --manifest-path /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml

I found #5526 (comment) but actually any package that builds on Linux should generally also be buildable in the cygwin Posix environment.

Activity

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
O-windows-gnuToolchain: GNU, Operating system: Windows
on Dec 9, 2020
jyn514

jyn514 commented on Dec 9, 2020

@jyn514
Member

@mintty something strange is going on in your environment: bootstrap/Cargo.toml is part of the repository: https://github.com/rust-lang/rust/blob/master/src/bootstrap/Cargo.toml. Did you modify or rename it?

mintty

mintty commented on Dec 9, 2020

@mintty
Author

No, the file is there.
-rw-rw-r--+ 1 towo Kein 1020 Dec 8 21:23 /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml

added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Dec 9, 2020
qiqjiao

qiqjiao commented on Jul 9, 2022

@qiqjiao

What's the status now? Seems the cygwin support was asked many years ago in other threads. I'm installing a python package in cygwin, that thing depends on cryptography, which depends on a rust compier.

mintty

mintty commented on Jul 10, 2022

@mintty
Author

First attempt (python x.py):
...
Building rustbuild
error: manifest path /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml does not exist
failed to run: /cygdrive/c/tmp/rust/build/i686-pc-windows-gnu/stage0/bin/cargo build --manifest-path /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml

but the file does exist

Second attempt (./x.py):
...
Compiling cc v1.0.73
error: linker i686-w64-mingw32-gcc not found

Installed package mingw64-i686-gcc-core

Third attempt (./x.py):
...
error: linking with i686-w64-mingw32-gcc failed: exit code: 1
...
error: could not compile syn due to previous error
error: could not compile serde_derive due to previous error
error: could not compile proc-macro2 due to previous error
error: could not compile winapi due to previous error
error: could not compile typenum due to previous error
failed to run: C:\tmp\rust\build\i686-pc-windows-gnu\stage0\bin\cargo.exe build--manifest-path C:\tmp\rust\src/bootstrap/Cargo.toml

mati865

mati865 commented on Jul 10, 2022

@mati865
Member

It builds fine in MSYS2 so there should be no problem with Cygwin.

error: manifest path /cygdrive/c/tmp/rust/src/bootstrap/Cargo.toml does not exist

This is unexpected, seems Cygwin path was passed instead of Windows path.
Maybe because of Python? In that case using native Windows Python would solve the problem.

error: linking with i686-w64-mingw32-gcc failed: exit code: 1
...
error: could not compile syn due to previous error

This output doesn't contain the root cause of the failure. You should look higher up in the terminal (or even paste whole output somewhere) and if there is nothing interesting re-run with -vv for more verbose output.

mintty

mintty commented on Jul 10, 2022

@mintty
Author

Maybe because of Python? In that case using native Windows Python would solve the problem.

Maybe, but for building a cygwin package a cygwin toolchain is essential.

mati865

mati865 commented on Jul 10, 2022

@mati865
Member

Ah, I think I know what it is. I think all Cygwin packages do use UNIX style paths but native Windows applications use only Windows style paths. So there are two problems here:

  • Cygwin tools pass UNIX style paths to Rust but it cannot understand them
  • Rust then passes Windows paths to Cygwin tools (like the linker) which they cannot understand AFAIK

So to do it that way you'd need to convert paths using cygpath on the boundaries between Cygwin and Win32 apps.


Side question: do you want Cygwin host+target or Cygwin host but targeting only MinGW?
For the first option you cannot use MinGW targets. You would need to create Cygwin target triple called probably x86_64-pc-windows-cygnus or something like that.

mintty

mintty commented on Jul 10, 2022

@mintty
Author

I'm only interested in cygwin target. I have no capacity to work on your build, anyway. I was just reporting as I think (quoting from above)

any package that builds on Linux should generally also be buildable in the cygwin Posix environment.

mati865

mati865 commented on Jul 10, 2022

@mati865
Member

any package that builds on Linux should generally also be buildable in the cygwin Posix environment.

This statement is not true when it comes to the compilers though.

qiqjiao

qiqjiao commented on Jul 11, 2022

@qiqjiao

This statement is not true when it comes to the compilers though.

Compilers translate source code to machine code. It doesn't involve low level OS specific things like the device drivers. I don't see why this particular compiler is special. No official support of cygwin rust compiler package is understandable, but not even be able to build from source code is hard to understand.

mati865

mati865 commented on Jul 11, 2022

@mati865
Member

Compilers translate source code to machine code. It doesn't involve low level OS specific things like the device drivers.

No matter if its C++ or Rust, std library is all about using OS specific code to give users cross-platform and easy to use abstractions though.

not even be able to build from source code is hard to understand.

All the errors in this issue are about the paths, you can take any Win32 native application and it won't be able to take or output UNIX paths used by Cygwin because Win32 API itself doesn't support these paths.

mintty

mintty commented on Jul 11, 2022

@mintty
Author

All the errors in this issue are about the paths,

I guess something in the Rust build scripts is confused by the cygwin environment, misinterpreting it as a Windows environment and thus using wrong path syntax. It should be easy to find that place for those familiar with the build scripts.

44 remaining items

riedel

riedel commented on Jan 25, 2025

@riedel

@ghost : the gist gives me a 404 , can you reshare it again?

Kreijstal

Kreijstal commented on Jan 25, 2025

@Kreijstal

@ghost : the gist gives me a 404 , can you reshare it again?

ghost means the user deactivated the account

jeremyd2019

jeremyd2019 commented on Jan 25, 2025

@jeremyd2019
Contributor

It looks like the repositories moved to @ookiineko-cygport at least.

Kreijstal

Kreijstal commented on Jan 25, 2025

@Kreijstal
Kreijstal

Kreijstal commented on Jan 25, 2025

@Kreijstal

now the only thing left is try to bootrstrap it from mrustc

mati865

mati865 commented on Jan 26, 2025

@mati865
Member

It'd be a lot easier to cross compile from another existing target than to bootstrap from mrustc once the necessary changes are merged.
Mrustc doesn't even properly support mingw-w64: https://github.com/thepowersgang/mrustc/blob/95023de01fecee5ba94c4dc50e48ed1579998699/tools/minicargo/os.cpp#L18.

Kreijstal

Kreijstal commented on Jan 26, 2025

@Kreijstal

It'd be a lot easier to cross compile from another existing target than to bootstrap from mrustc once the necessary changes are merged. Mrustc doesn't even properly support mingw-w64: https://github.com/thepowersgang/mrustc/blob/95023de01fecee5ba94c4dc50e48ed1579998699/tools/minicargo/os.cpp#L18.

We write pull requests for mrustc or patch it

faho

faho commented on Feb 28, 2025

@faho

Since I've seen people be confused by being linked to this issue: a cygwin target has been merged with #134999

workingjubilee

workingjubilee commented on Feb 28, 2025

@workingjubilee
Member

yes. was closed as wontfix (or I suppose "PRs welcome"?). closing as completed.

workingjubilee

workingjubilee commented on Feb 28, 2025

@workingjubilee
Member

Opened a new issue for "the target works enough to be built as a host", since there's been so many requests for it: #137819

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-target-specsArea: Compile-target specificationsO-windows-gnuToolchain: GNU, Operating system: WindowsT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler 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

        Participants

        @Astara@jschultz@qiqjiao@riedel@mati865

        Issue actions

          Add a new cygwin target · Issue #79854 · rust-lang/rust