News for hackers. Stuff that matters.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pornel on Sunday July 18, 2021 @10:27AM (#27873193)
I really like what they've done for cross-compilation. Automatically selecting appropriate libc/crt implementation is such a relief.

Compared to Zig, cross-compilation in C/C++/Rust seems downright user-hostile: you have to obtain the correct cross-sdk, but it won't tell you which one, or how to get it (some combos don't even exist), or even where to put it. If you don't guess everything correctly, it will fail with inscrutable errors, or worse, only fail at runtime on the target machine.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pjmlp on Sunday July 18, 2021 @10:36AM (#27873286)
What this kind of stories always miss is that the host platform needs all system libraries for the target platform for anything beyond the basic examples using the standard library.

E.g. try to cross compile Metal shading example for iOS from Linux with zig, or do a Win2D UWP rendering application from Linux with zig.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by flohofwoe on Sunday July 18, 2021 @01:54PM (#27874909)
The Metal shader compiler is an unfortunate special case, because the bytecode and the Metal compiler tools are proprietary and locked up by Apple (there are precompiled binaries of the Metal compiler for Windows, but not Linux). The ball is definitely in Apple's court here, there's nothing any language project can do, except illegally reverse engineering Metal bytecode, which obviously isn't a good idea.

The system API problem can be solved by shipping automatically generated API bindings (similar to what Microsoft does with the Rust bindings to the Windows APIs, a similar project for Zig is underway). Once those bindings exist, no Windows SDK is needed anymore and cross-compiling should "just work".

PS: Zig actually ships with the mingw headers in the default installation (e.g. windows.h, d3d11.h, dxgi.h etc are all there), I haven't actually tried to cross-compile a Windows executable using the Win32 APIs though, but it looks like it should work already.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by kevin_thibedeau on Sunday July 18, 2021 @02:31PM (#27875238)
> illegally reverse engineering Metal bytecode

Reverse engineering is legal in the US (unless bound by contract).

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by Cloudef on Sunday July 18, 2021 @10:46PM (#27878756)
The metal compiler probably could run with darling
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:11PM (#27875625)
So does every new release of any Windows component require a new version of Zig? That doesn't seem sustainable.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by flohofwoe on Sunday July 18, 2021 @03:42PM (#27875963)
I don't actually know what Windows components mingw supports in detail and how often mingw is updated because of that, but I guess that the important Win32 APIs are stable. I suppose that the new APIs which are highly in flux could be supported by separate packages, like this: https://github.com/marlersoft/zigwin32)
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by zamadatix on Sunday July 18, 2021 @12:26PM (#27874192)
I'm not sure what's really "missed", if you call a library other than the stdlib of course you're going to need to provide the appropriate headers/libraries for that as that's got nothing to do with a C compiler.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pjmlp on Sunday July 18, 2021 @12:57PM (#27874472)
In general, it isn't so clear when these kinds of examples are posted.

And to go back to my examples, headers and libraries alone won't make it, without the remaining toolchain to create the appropriate package.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by zamadatix on Sunday July 18, 2021 @01:15PM (#27874614)
Well for your particular examples UWP is C++/C#/a few others but it has no direct c binding and iOS APIs are all defined for Objective-C and Swift so sure, you're not going to get far with a C compiler before you even start thinking about a c cross compiler.

If you want to cross compile C stuff e.g. a Win32 GUI app with Direct X or get OpenGL bindings for SDL though those all work just fine if you provide the SDK files same as you would compiling natively. The advantage being now you can do all builds from a single build instance just by feeding it the libraries and a target platform.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:10PM (#27875620)
Right. Are you going to ship all Windows headers and import libraries to everyone, including DirectX, etc.? Are you going to keep them up to date with every new version of a Windows component? Are you going to ship parts of the macOS, or iOS SDKs?

I don't see shipping all targets all the time to be a particularly scalable solution in general. When you start including all libraries necessary to develop actual apps, the download size will eventually get so big that people will complain. Just make it easy for developers to get the targets they need, but don't ship everything by default.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by slimsag on Sunday July 18, 2021 @04:39PM (#27876474)
I'd argue it's less about what the compiler does by default, but rather what it (and the community) enable.

For Mach (the Zig game engine I'm working on), I have a Zig build script which fetches the required parts of the macOS and iOS SDKs from GitHub to enable cross compilation from Windows/Linux -> macOS. Zig's linker, zld, enables that to work easily.[0]

For SDL.zig, they have also achieved cross compilation for most targets out of the box[1].

Contrast this to say, Go or Rust, where most GLFW and SDL bindings require mucking around with the system dependencies. It doesn't just work out of the box, I think that's really unfortunate and hope other languages work more towards painless installation of C-binding dependencies.

[0] https://twitter.com/slimsag/status/1413770578494775298

[1] https://github.com/MasterQ32/SDL.zig#support-matrix

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by p0nce on Sunday July 18, 2021 @03:17PM (#27875708)
> Just make it easy for developers to get the targets they need, but don't ship everything by default.

It seems to be what Flutter is doing, and it must be a ton of work.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by flohofwoe on Sunday July 18, 2021 @03:48PM (#27876025)
I'd guess once Zig gets its package manager many target-specific packages can move out of the default installation.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:58PM (#27876114)
Absolutely, which is exactly what I'm arguing for. :)
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by sm_ts on Sunday July 18, 2021 @12:58PM (#27874487)
I've had to compile only a few times C/++ programs, and the experience can't be really compared to Rust (probably, to any other language :)).

Lately I've cross-compiled a few times Linux/Windows programs, and the only thing I had to do (assuming that the underlying crates are compatible, and that the development libraries are in place, which is required for any language) was:

  rustup target add x86_64-pc-windows-gnu
  rustup toolchain install stable-x86_64-pc-windows-gnu
That's all. Then one can compile with:

  cargo build --target x86_64-pc-windows-gnu
I've also compiled for RISC-V, and it was the same procedure.

There are surely issues with individual crates, and possibly with lower-tier targets, but to characterize this procedure as "user-hostile" doesn't make sense.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pornel on Sunday July 18, 2021 @06:10PM (#27877130)
That's true only for static libraries and pure-Rust projects. For executables and dynamic libraries Rust relies on system-provided linker (except nightly that can enable lld) and target libc already present on the OS (the nice part zig has, but Rust doesn't).

Rust totally craps out if you try to make a binary or dylib and you don't already have cross-compilation toolchain on your OS. It's doable from a Linux distro that has cross packages and a GNU target. It's a PITA for anything else, including anything from Windows and macOS hosts.

`zig cc` is actually useful even for cross-compiling Rust projects, because some Rust crates depend on C libraries.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by wyldfire on Sunday July 18, 2021 @10:41AM (#27873332)
> Compared to Zig, cross-compilation in C/C++/Rust seems downright user-hostile:

This has been the status quo for so very long. Usually these projects are maintained by different teams. IMO musl is more accessible than glibc and that's part of what makes it easier to distribute. Arm and x86 coexisting for as long as they have is a factor, and so is Kelley's ambition to make this use case well-supported. nostdlib is also well-supported by Zig btw.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by DrBazza on Sunday July 18, 2021 @10:47AM (#27873394)
It's always a bit harsh comparing a 36 year old language with more-or-less full backwards compatibility, with a new language designed with the benefit of hindsight.

That's not to say that it's impossible to do something like that in a C++ compiler but it's going to be more work than there is benefit. Tangentially related: https://twitter.com/__phantomderp/status/1416108650809241601

C++ also tries to bring in modern programming research when it makes sense, but that also explains why it's like an octopus with extra legs nailed on.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by tialaramex on Sunday July 18, 2021 @11:40AM (#27873820)
The octopus analogy seems especially appropriate. The thing about the legs on an actual octopus is that there's a bunch of local compute substrate in them, if you were to nail extra legs onto the octopus those are rubbish compared to its real legs which can think.

For example, move semantics are a peg leg for the octopus. Should an octopus have a peg leg? I'm not a biologist of any sort, but my guess is "No". I can see why C++ wanted to add move (without this performance in some scenarios is just awful) and yet since C++ didn't start out having move semantics and can't give up backward compatibility it has to shoehorn them in with this awkward "hollowed out object" idea. The result is performance still isn't where it could be and the feature is unergonomic.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by vvanders on Sunday July 18, 2021 @10:42AM (#27873348)
I would not include Rust in that list, in my experience rustup and cargo are miles ahead of C/C++ when cross compiling.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by steveklabnik on Sunday July 18, 2021 @11:00AM (#27873492)
Personally, I see it in three tiers: Rust improved upon those experiences, but I still wish someone would implement what Zig has in rustc.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by vvanders on Sunday July 18, 2021 @12:32PM (#27874240)
Yup, fully agreed Zig stands above others here. Cross compiling C/C++ is just a special kind of hell. Each target always has some sort of bespoke toolchain and build environment constraint that add so much unneeded complexity.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:12PM (#27875647)
I don't. We could approximate it by shipping all targets by default, but few really want that and the few who do can just install those targets with rustup.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by steveklabnik on Sunday July 18, 2021 @05:15PM (#27876750)
Sure, like many things, I bet you could pick three or four and get 90% of the default coverage. That still helps 90% of the users.

I also think you're really missing out on the "compile C code easily too" thing. That isn't very pleasant at all in Rust today.

(Finally, one reason it’s so big is that we ship binaries. This ships source. std-aware cargo could really help here.)

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by littlestymaar on Tuesday July 20, 2021 @03:13AM (#27890877)
> I also think you're really missing out on the "compile C code easily too" thing. That isn't very pleasant at all in Rust today.

So much this. Cross compiling pure Rust code is really easy today but as soon as you have a C dependency in your dep tree, you're gonna have a bad time.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by nicoburns on Sunday July 18, 2021 @04:20PM (#27876320)
Is it really few who want that? Anybody developing server software on windows or mac and deploying on linux could use this. Anybody developing cross-platform client software could use it.

I'd guess that a lot of Rust developers currently do development on their target platform, but that's because cross compiling is such a pain. If it were as easy as zig or go then things might well be differen.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @05:16PM (#27876753)
My x86_64 Rust libraries directory is 86MB. `rustup target list | wc -l` spits out 84 for me. The math doesn't add up.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by nicoburns on Monday July 19, 2021 @09:28AM (#27882412)
Is rust cross-compilation really is straightforward as just installing the target triple and then it "just works" (including linking and C FFI compilation)?

My understanding was that most people were using "cross" docker images for "cross-compilation", because setting up native actual cross-compilation was quite involved.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by burntsushi on Monday July 19, 2021 @10:07AM (#27882789)
No, it isn't that easy. pcwalton is misrepresenting things here IMO.

Yes, people, including myself, use 'cross' precisely because it isn't as easy as "just use rustup to install the desired target." 'cross' has a bunch of Docker images that set up the cross compilation toolchains, and those images represent a fair amount of domain knowledge that I don't have to tediously acquire to use it.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by skohan on Sunday July 18, 2021 @11:08AM (#27873553)
I don't know much about cross compilation, but in terms of the Rust case, could part of it be the relative complexity of the language compared to Zig?
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by woogley on Sunday July 18, 2021 @11:14AM (#27873599)
`zig cc` cross-compiles C, not Zig.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by skohan on Sunday July 18, 2021 @11:18AM (#27873638)
No but I mean why the Zig cross compilation story is better than Rust according to this thread
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by steveklabnik on Sunday July 18, 2021 @12:51PM (#27874425)
Nothing about 'zig cc' is related to language semantics, it is entirely a toolchain feature. Language semantics do have some bearing on cross compiler difficulty, but IMHO it's not a major factor, especially within the sorts of languages that Rust and Zig are. The largest factor I can think of (compile-time code execution) exists in both Zig and Rust. It's possible I'm forgetting something, though.

It doesn't exist in Rust because nobody has proposed it or implemented it, simple as that.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by sobeston on Sunday July 18, 2021 @01:18PM (#27874643)
I think Zig does cross compilation (ignoring for the moment, projects with C dependencies) better because it comes out-of-the-box with the libraries and headers needed to target a lot of systems. In Rust, you typically get additional toolchains via rustup, whereas Zig works on all of the targets with a single install.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by steveklabnik on Sunday July 18, 2021 @01:21PM (#27874665)
Absolutely, hence a toolchain thing.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:04PM (#27875551)
Are you sure that we should be shipping all targets by default into one monster download? This doesn't seem particularly scalable.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by coder543 on Sunday July 18, 2021 @03:20PM (#27875755)
The whole toolchain for Zig, which appears to include complete cross compilation, is less than 40MB compressed[0]. I would hardly call that a "monster download".

I think developers can spare that much space. Besides, storage space is scaling much faster than the number of available targets, so I don't see how this could be "not particularly scalable" unless you either have a weird definition of "target" or predict there's going to be a sudden explosion in the number of targets.

Go also makes cross compilation to any supported target a breeze in the default toolchain download, and it is an incredible convenience for the developer.

[0]: https://ziglang.org/download/

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:38PM (#27875931)
The Xcode download, which is the only officially-supported way to develop native apps on macOS and iOS, is 9.8 GB and gets larger with every update. The Windows 10 SDK is 4 GB and likewise is only getting larger. Sure, you can develop some apps with only a subset of the SDK. But, as a language project, do you really want to be in the business of optimizing and subsetting every single OS SDK?

I think a lot of the issue here comes down to targeting server workloads and command-line tools vs. apps using more of the OS libraries. In practice, Go focuses on the former kinds of apps, so shipping all targets is a more viable approach for them. But when you start getting into apps that want to use a larger swath of the platform facilities, then the size of the platform SDKs starts to become an issue.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by coder543 on Sunday July 18, 2021 @03:43PM (#27875981)
No one (that I've seen) is suggesting to include those SDKs, which you probably don't even have the rights to redistribute anyways.

I provided both Zig and Go as examples of what people are looking for, and their downloads are neither obscenely large nor do they include those massive SDKs.

So yes, you have a weird definition of "target" that no one else here is using, and it is disingenuous for the conversation. rustup can already add additional targets after installation, are you suggesting this downloads 10GB SDKs? Definitely not, and that sounds irrelevant. (Even once you do this, the toolchain experience is not as good as what Zig or Go offer.)

Compare what Zig and Go do to what Rust does, not some strawman argument that would require users to download 10GB of SDK with the Rust toolchain. Alternatively, find me someone who is saying they think these multi-gigabyte SDKs should be included, because I don't see that anywhere in this conversation.

People here are complimenting what Zig currently does, which takes less than 40MB compressed. Zig can cross compile to Windows just fine. There are limitations to everything, but what Zig and Go offer is strictly better than what Rust offers in terms of the out-of-box cross compilation experience, and it isn't unduly burdensome on the developers like your proposed 10GB download.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @03:55PM (#27876087)
My nightly-x86_64-unknown-linux-gnu lib directory is 148MB. This is because it includes several libraries in both rlib and so format (static vs. dynamic linking), asan/lsan/msan/tsan variants, and so forth. You could easily imagine that ballooning to 1GB if we shipped all tier 1 targets. This is what I mean by shipping all targets not being scalable: it might have seemed so in the early days when the libraries were smaller and the targets fewer, but not now.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by coder543 on Sunday July 18, 2021 @04:02PM (#27876152)
Yes, the Zig (and Go) developers have clearly put a lot of effort into ensuring the size of their toolchain remains reasonable. I fully believe the Rust developers could achieve similar results as well, if they really wanted.

Until then, the lack of a great cross compilation experience out of the box is just a limitation of the Rust toolchain. It's an acceptable limitation in many situations, but I don't buy your repeated arguments on this HN discussion that it is unclear that this is desirable to fix. Clearly many people in this discussion alone disagree with your position, and my own anecdotal discussions with other developers in real life aligns with this discussion. YMMV, obviously.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @04:13PM (#27876252)
> Yes, the Zig (and Go) developers have clearly put a lot of effort into ensuring the size of their toolchain remains reasonable. I fully believe the Rust developers could achieve similar results as well, if they really wanted.

I strongly disagree. These are different languages. Rust leans heavily on generics and monomorphization. It implements most language operations, like ptr::offset, in the language itself, increasing the size of library metadata. It supports tools like the sanitizers. It has a rich serializable MIR format so that generics can be embedded at a higher level than just machine code and a lower level than source.

It is absolutely not true that nobody "really wants" smaller binaries. Rust already did a fair bit of experimentation with running crate metadata through gzip, etc. years ago (turns out there are some thorny tradeoffs around compilation time vs. on-disk storage when you go that route). I can't speak to Zig, knowing less about it, but with Go there were conscious language design decisions that favor binary size over runtime performance (e.g. hash table lookups all going through a single function instead of being specialized). This is fine! But it's contrary to the idea that Rust could achieve smaller binary sizes if we "really" wanted to.

> Until then, the lack of a great cross compilation experience out of the box is just a limitation of the Rust toolchain.

Rust has a great cross-compilation experience. It's as simple as:

    $ rustup target add arm-linux-androideabi
    $ cargo build --target=arm-linux-androideabi
That's it. One more command than Zig or Go, to install the toolchain you need, and then you're off to the races.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by burntsushi on Sunday July 18, 2021 @04:55PM (#27876590)
The difference is really not just one command. I suggest you go out and actually try Zig cross compilation or at least read more about it. Andrew Kelley has written a lot about it. The work impressed me so much that it was one of the things that provoked me to become a financial supporter of Zig. (Even though I haven't written a line of Zig yet.)

Cross compilation in Rust is better than C or C++. But it's still a big pain.

I really think you are underestimating what the Zig folks are doing. Please investigate more deeply.

In particular: "Zig does not ship with any pre-compiled libraries; instead it ships with source code, and builds what it needs on-the-fly."

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by pcwalton on Sunday July 18, 2021 @09:23PM (#27878290)
Do you think that Rust would be a better language if everything had to be compiled from source?
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by burntsushi on Monday July 19, 2021 @08:52AM (#27882077)
Obviously I don't. And that's totally consistent with learning from Zig about how to improve the cross compilation story for Rust. (Trivially: compile some things from source, but not other things.)

I'm honestly pretty disappointed at your participation in this thread. It seems like you're going out of your way to assume the worst possible interpretation of what folks are saying.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by jhgb on Sunday August 01, 2021 @01:26PM (#28028118)
The Ultimate++ environment for C++ does the same thing with C++, and it seems to work just fine even for them.
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by cormacrelf on Monday July 19, 2021 @04:08AM (#27880293)
If you use the build-std nightly feature you can compile the entire standard library, even for a custom JSON target file, and it goes pretty quick. With a bit of attention that feature would be just fine at filling in the gaps in rustup’s prebuilt targets.

But Zig’s approach isn’t actually about making everyone compile more things from scratch. It doesn’t compile libc from scratch any time you select a new target. Reading the article you can see the extreme lengths it goes to to avoid this.

The main thing that’s missing from Rust is target-specific libc.so/etc, and an appropriate linker for every target. If you try cross compiling anything, you will soon run into this problem; your system will not have the correct target libc or an appropriate linker. You can generally only change one part of the triple before the experience starts falling apart. I can cross compile for iOS/tvOS/etc on my Mac; that’s about it.

Zig manages to solve this for all its targets by pre-processing simplifications of the various libcs, which are then bundled into the Zig binary (as 3 very small files). It generates a useless but linkable .so file from the preprocessed files for any target on the fly. It gets you the correct libc headers. Then it uses LLD instead of making you hunt around on Ubuntu forum posts finding and downloading the correct GNU linker for your specific architecture. So you don’t link to a real libc, but you don’t have to compile one either. (Until you want to execute a binary with QEMU, but usually non-simulated target machines have a libc.so already.)

(Aside: Golang solves this by not depending on libc at all, by reimplementing most of it including the syscalls in Go, and I believe by using its own multi-target linker. Many pros and many cons, but an approach Google is happy to sponsor.)

If you’re saying this approach would be infeasible for Rust std/core, then yes obviously. It’s statically linked, you can’t get away with a fake .so file.

But that was never really the issue. Rustc can build std’s rlib files for any target effortlessly. And yet cross compiling is still a pretty poor experience. The state of the art for Rust developers at the moment is rust-embedded/cross, which solves the same libc+linker problem that Zig does, naively, by literally using Docker and per-target Ubuntu images to download prebuilt GCC and libc packages from Apt. Basically we can do way better than that, because Zig showed us how.

See this Dockerfile for what I mean: https://github.com/rust-embedded/cross/blob/master/docker/Do...

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by coder543 on Sunday July 18, 2021 @04:22PM (#27876343)
> That's it. One more command than Zig or Go, to install the toolchain you need, and then you're off to the races.

Except it's not the same. Zig also cross-compiles C code beautifully, and lots of Rust code depends on C libraries. That "one additional command" does not solve cross compilation to an equivalent degree as Zig.

Go code tends to avoid C because of the heavy penalty that CGo imposes, so the cross compiliation experience is usually good there, but for different reasons than Zig.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by steveklabnik on Sunday July 18, 2021 @05:15PM (#27876744)
100% sure? No. Mind you, I'm on MSVC, where I already need an extra ~1gb download to get the system linker.

We could still do a few different things to make this story better for users, even if it's not literally identical.

Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by woogley on Sunday July 18, 2021 @11:23AM (#27873680)
I see. I'll let the real experts add some insight but I don't think language complexity has much to do with it, considering Rust compiles to an IR first anyway. And I would say Rust has a good cross-compilation story as it is. In 2016 (!) I managed to get Rust to compile my SDL2 game to a mipsel device that used a custom GCC toolchain (http://www.gcw-zero.com/develop)
Re:Zig cc: A drop-in replacement for GCC/Clang (2020) by zajio1am on Sunday July 18, 2021 @11:20AM (#27873652)
> cross-compilation in C/C++/Rust seems downright user-hostile: you have to obtain the correct cross-sdk, but it won't tell you which one, or how to get it (some combos don't even exist), or even where to put it.

Since advent of multiarch, crosscompilation does not seem harder than regular compilation. Just install package with gcc for target arch and required libraries for target arch (using the same way as gcc and libraries for host arch).