4 ms·
What I don’t understand is why Clang doesn’t do this? What’s stopping them from shipping libc’s for cross compilation? Given that they are a C and C++ compiler,
by smasher164 5y ago
What I don’t understand is why Clang doesn’t do this? What’s stopping them from shipping libc’s for cross compilation? Given that they are a C and C++ compiler, surely this is in their domain.
- matu3ba 5y agoYou need to provide low-level build functions, which is quite some work. On top of that you need to understand the build system of the libcs to replicate it. On top of that for libcs you want to deduplicate all symbols to reduce as much space as possible. On top of that you might want to provide glibc symbol versioning. People without incentive usually do not do this tedious kind of work, since "it works for me".
- azakai 5y agoIn principle, clang could do it, you're right. I think there are two main reasons why it hasn't. First, Zig has a pretty unique and impressive build&caching system. It makes something like this a lot less painful than it would be otherwise. It makes it practical to just download a 40MB tarball and get full cross-compiling from it. Second, clang itself isn't in the business of building a distribution of itself + third-party libraries. Usually developers using clang get such libraries from their "vendor" (package manager if on a Linux distro, Apple if on MacOS, etc.). And those vendors naturally focus on their own platforms. So Zig ended up the first to really do the work to build a cross-platform C/C++ toolchain.