Hi,
out of curiosity, I wanted to try to compile rust on Solaris today and quickly ran into a problem.
When configured on a Solaris system, current rustc from repo attempts to downlod rustc (for stage0 compilation, I presume) from this location:
Building rustc requires a working rustc. Solaris is a tier 3 platform, so rust-lang.org doesn’t distribute binaries (see https://doc.rust-lang.org/book/getting-started.html). Therefore, you either need to cross-compile it or find an unofficial binary. (Not sure where to find unofficial binaries for Solaris in particular; maybe @nbaksalyar knows?)
You can pass “–enable-local-rust” to configure to prevent it from trying to download a binary from rust-lang.org, but obviously that only works if you already have rustc installed.
For now not all flavors of Solaris are tested/supported, but if you’re using SmartOS you can get rustc from pkgsrc: pkgin in rust or here. There’s a good chance that this build will work on other Illumos distributions, but it doesn’t work on Oracle Solaris. In that case you’d have to cross-compile a snapshot (e.g. from Linux).
Or you can just wait a little bit, as I’m currently porting Cargo and Rust 1.9. This time an official snapshot will be added as well.
Actually I want to try making a distribution-independent snapshot. Newer versions of Illumos has diverged too much from the OpenSolaris version, but I guess it's worth trying to build rustc on OpenSolaris or some older version of Illumos that is compatible with Oracle's Solaris.
The plan B is to provide a separate snapshot for Oracle Solaris, so it will be supported in either case.
I think it depends on what version of rust you need. I haven’t attempted on Solaris 11 specifically but you could try using pkgsrc packages to install rust 1.14. The only challenge there being that it doesn’t give you cargo. https://pkgsrc.joyent.com/ . I started trying to build a bootstrap package for cargo to use for compiling a more recent rust on illumos but haven’t completed it yet.
Rust should now build natively on Solaris. A couple of us Oracle folks have pushed a number of fixes, so it should just work now, at least on nightly (well, beta now, I guess). I haven’t yet tried an unpatched 1.16, so I’m not sure about that. And there’s a fix to the fs2 crate that I still need to figure out the best solution, but if you get stuck on flock(), let me know and I’ll send you a patch.
Note that I haven’t yet tried Solaris 11, only S12, so there may be more fixes required, but I can’t think of any reason why it shouldn’t just work.
Definitely no luck on getting it to compile without an existing bootstrap image. Rust 0.16.X beta requires a cargo binary, and compiling cargo also requires the cargo binary. Unless I’m missing something solaris/illumos users will still have to get a stage-0 bootstrap image from somewhere?
Well we have rustc and cargo on Solaris 12 (thanks to @dhduvall as well as others), I guess we should find a way to share that with S11 users. However, there’s still some bits and pieces not working 100% right, for example mio doesn’t compile on S12. I’ve been meaning to have a look at it but haven’t found the time yet.
Thanks guys and awesome news @dhduvall More power to you guys.Thanks for the hard work.
So here’s a dumb question . I’m still not quite sure how I can get rustc and stdlib to run on Solaris. Will I have to build it using the instructions on Rust Github repo? If yes, will following those instructions build stdlib as well along side rustc?
If someone that’s gotten patched rust compiled on solaris 12 has the bootstrap image they used for both cargo and rust and can share them for local compile that would be suuuuuuper dope.
I tried to compile using instructions on the rust github repo and it failed with a 404. Same as the OP. Now I finally understand all this talk about bootstrap/stage0 binaries (sorry, I’m a bit new to this stuff). So, looks like no bootstrap binaries are available for Solaris11 . Let’s wait for @dhduvall and see if can help us there.
@eeyun Based on the above, looks like the pkgsrc method won’t work either. Isn’t that so?