News for hackers. Stuff that matters.
Re:Adding ANSI C11 C compiler to D so it can import and comp... by saurik on Monday May 10, 2021 @04:50AM (#27103974)
FWIW, this isn't actually difficult: you just need a sysroot, and past that you can just use clang (maybe ironically, for any platform other than Apple ones, as there still isn't a good common linker for mach-O; like, this still works fine, but it is in fact very annoying--but not impossible--to compile a macOS binary from any platform other than macOS). To cross-compile to Linux you can just download a handful of rpm files (the kernel and libc header packages, as well as the gcc package for the CRT) from CentOS or deb files from Ubuntu and extract them to a folder, and for Windows you just need a handful of Msys2 packages (the same general set). That's really all you need: my current major project--Orchid--compiles for Linux, macOS, iOS, Android, and Windows, and does so using the Android NDK copy of clang (just because it is easy to install and easy to ensure us always "the same" on every machine: I do cross-compiled reproducible builds). As long as you are using C/C++ it really should be easy to cross-compile (and yes: this is saurik saying something not only good about clang but specifically saying they finally nailed this use case, which they really hadn't a while back when people kept touting this as a feature... they really did eventually nail it). (That said, I do appreciate that not having to download and extract those packages is certainly "more convenient" than doing anything at all, but I just want to point out that it really isn't that "much effort".)
Re:Adding ANSI C11 C compiler to D so it can import and comp... by uh_uh on Monday May 10, 2021 @09:08AM (#27105563)
This sounds a lot more difficult than using Zig where you just need to find the right build flag. Maybe it's easy once you already know which exact packages to get for each platform, where to put them and how to tell clang about them. But if you don't know this, researching this can easily take hours, at least for me.
Re:Adding ANSI C11 C compiler to D so it can import and comp... by AndyKelley on Monday May 10, 2021 @01:58PM (#27108872)
your solution would not support:

* specifying target cpu features (important!)

* features such as thread sanitizer support

* LTO that crosses the libc boundary

* targeting any glibc version

...all of which are supported out of the box by zig.

Re:Adding ANSI C11 C compiler to D so it can import and comp... by matu3ba on Monday May 10, 2021 @04:57AM (#27104012)
1. Do you have a blog post with exact instructions for this for some of the platforms? 2. Does this include targeting any gnu libc version (backwards compatible)? This would be very surprising to me.