News for hackers. Stuff that matters.
Re:Maintain It with Zig by mishafb on Wednesday September 08, 2021 @12:55PM (#28459804)
Zig has painless cross compilation, with gcc or clang it's a nightmare
Re:Maintain It with Zig by pjmlp on Wednesday September 08, 2021 @01:41PM (#28460491)
I would like to see that painless cross compilation for UWP applications.

Truth is that cross compilation always breaks down in complex deployment use cases.

Re:Maintain It with Zig by int_19h on Thursday September 09, 2021 @11:33PM (#28477521)
In principle, why wouldn't it work for C++/WinRT, given that it doesn't use the WinMD metadata directly, but rather produces valid C++ headers from it?

I think the problem for Zig is that they use MinGW as their Windows target, and the latter's standard library isn't really UWP compatible (yet?).

Re:Maintain It with Zig by pjmlp on Friday September 10, 2021 @10:24AM (#28481981)
Because the whole build process to produce a MSIX or APPX requires a little more, like the whole Windows SDK, plus whatever might be fetch via NuGET via MSBuild, and the process to sign the packages?
Re:Maintain It with Zig by int_19h on Friday September 10, 2021 @07:36PM (#28488058)
I would compare building MSIX or APPX to building an apt or rpm package on Linux - that's the next step after building the actual executables, which is what Zig covers.
Re:Maintain It with Zig by dleslie on Wednesday September 08, 2021 @02:36PM (#28461287)
o.O

Zig uses LLVM for cross compilation, and so does clang. It's really not any better.

https://clang.llvm.org/docs/CrossCompilation.html

Re:Maintain It with Zig by messe on Wednesday September 08, 2021 @02:45PM (#28461396)
The part that Zig does well, is that it bundles C headers and standard library sources with it. This is the hard part of cross compilation. The default install can build standalone executables from C programs for any supported platform.
Re:Maintain It with Zig by dleslie on Wednesday September 08, 2021 @02:49PM (#28461447)
If someone wanted to package clang to do that, they could. They do, in fact, that's how clang cross compilation packages work.

But sure, to Zig's credit, they ship all the supported toolchains and so don't have many different cross compilation variants in the OS's package manager. But that's a bit like buying one of everything, even though you'll only use one or two.

Re:Maintain It with Zig by messe on Wednesday September 08, 2021 @02:55PM (#28461529)
> If someone wanted to package clang to do that, they could. They do, in fact, that's how clang cross compilation packages work.

Clang doesn't bundle a C standard library implementation.

> But sure, to Zig's credit, they ship all the supported toolchains and so don't have many different cross compilation variants in the OS's package manager. But that's a bit like buying one of everything, even though you'll only use one or two.

Zig only bundles the sources, so it builds the C library on-demand. IIRC it's smaller than most cross compiler toolchains.

Re:Maintain It with Zig by dleslie on Wednesday September 08, 2021 @03:05PM (#28461626)
> Clang doesn't bundle a C standard library implementation.

... So? It can use most any you wish.

> Zig only bundles the sources, so it builds the C library on-demand.

Which it then caches, post-compilation, taking up binary space on disk comparable to if you just downloaded the pre-compiled target binaries.

Re:Maintain It with Zig by kristoff_it on Wednesday September 08, 2021 @03:28PM (#28461886)
> Which it then caches, post-compilation, taking up binary space on disk comparable to if you just downloaded the pre-compiled target binaries.

I don't understand the point of this comeback. If you have the artifact cached it means that you compiled for that target, while the rest of the stdlibs remain in source form (also Zig deduplicates header files which is why everything fits in a 40mb tarball), and you didn't have to download anything manually. What else would you want exactly?