On Sun, 20 Apr 2025, Takashi Yano via Cygwin wrote:

> On Mon, 24 Mar 2025 14:41:19 +0800
> Yuyi Wang wrote:
> > > I mean it is some kind of cross compiler.
> >
> > Yes. Rustc is a cross compiler powered by LLVM.
> >
> > > ...is it possible to build Rust compiler itself by the cross-compiler?
> >
> > Theoretically yes. Actually once a GitHub user @Ookiineko succeeded before, 
> > but
> > now the account has been deleted. I think the largest blocker is LLVM 
> > itself.
> > The latest version of LLVM provided by cygwin is 8.0, and 11.0 by MSYS2, 
> > while
> > rustc needs LLVM 17.0 at least. @Ookiineko added some patches to LLVM to 
> > make it
> > work, but they were not committed to upstream, but I haven't understand all 
> > of
> > them yet.
>
> Thanks to MSYS2 guys' work, I have successfully built LLVM package with Polly,
> Clang, compiler-rt, and libunwind packages version 20.1.2.
> I still trying built libc++ and libc++abi, but it is not going smoothly.
>
> Is there any other blocker to build Rust for cygwin?

The next thing you need is to build rust on a system that already has a
working rust and a working Cygwin (cross-)compiler (gcc) environment, with
support for the Cygwin target enabled.  This could be Linux, or
technically could be a cross-compile from Windows to Cygwin (in which case
the "Cygwin cross-compiler" is really the normal Cygwin GCC being run by
Windows processes).  Once you've got that built, you would use that rust
to build a rust whose host *and* target are Cygwin.  I don't expect that
to go without issues, trying to get {i686,aarch64}-pc-windows-gnullvm
bootstrapped was a bit of a hassle of patching vendored crates because
it's surprising how many of them knew about targets, and it's rather a
nightmare how many different versions of crates are involved sometimes,
and how long you have to wait for fixes to percolate through the
ecosystem.  Rust also will default to trying to build its own vendored
version of LLVM, so you might end up having to patch that too (or tell
Rust to use the system LLVM instead and save that step).


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to