What is the value proposition of this compiler, then?
Aro – Zig's new C compiler
51–60 of 130 posts
Re: Aro – Zig's new C compiler
#52Wait, so you still need zig, and zig still needs LLVM. If you have LLVM, you have clang. What is the value proposition of this compiler, then?
Re: Aro – Zig's new C compiler
#53It seems like I can't include standard header files, so it can't compile a common hello world. I guess that'd be useful to mention on the README, or maybe I'm doing something wrong? main.c:1:10: fatal error: 'stdio.h' not found #include It'd be nice if header inclusion, and -l options work. This would allow benchmarking Aro against some other compilers on a wide range of C files. Usually sqlite3.c is my first go-to f…
arocc -fsyntax-only -Wno-unknown-attributes sqlite3.cRe: Aro – Zig's new C compiler
#54- why create a competing front end to Zig?
- what problems is it solving?
- what’s different than the official Zig frontend?
Etc
Re: Aro – Zig's new C compiler
#55Earlier quoted context omitted.
I know that he is but this is incredibly off-topic. Aro deserves the attention it is getting, without the discussion getting hijacked by another project. D would deserve attention too, in a separate post, or here if it was explained how it relates to Aro.
Walter's comment could be read more charitably and could show his interest in Zig and similar choices that are made. The last sentence, or, indeed, the whole comment, can be read like "We did this for D, and it works well. [go for it]". I don't think D is casting any shadow on Zig. Both languages play in the same field, D is older but I feel like we hear about Zig way more these days. His comment is likely to interes…
Re: Aro – Zig's new C compiler
#56The ReadMe is quite lacking … - why create a competing front end to Zig? - what problems is it solving? - what’s different than the official Zig frontend? Etc
Re: Aro – Zig's new C compiler
#57Earlier quoted context omitted.
Is it possible to do what Zig does and cross compile to any OS/arch, from any OS/arch? Last I tried, I found some compiler options and commands to do it, but they were badly explained, I tried for hours and it just didn't work at all, so I gave up.
Generally, the hard part isn't the cross compiler (nor, these days, the cross binutils), but the cross libraries . There are at least 3 ways (/usr/lib/$ARCH, /usr/$ARCH/lib, /$CHROOT/usr/lib/) to set up the libraries, all incompatible with each other. Zig is notable for putting a lot of work into hard-coding basic C libraries, though of course you still need a scattering of other C libraries for most real-world progr…
- get a suitable cross compiler toolchain
- pick whether you want dynamic or static linking (most likely static when the target system does not come with /nix/store)
- compile all prerequisites for the library such as transitive dependencies
- compile the library with the cross compiler for the selected target arch
All in one command line call, that does not require you to 'apt-get install' any of the tools manually:
nix-build '' -A pkgsStatic.libpng --arg crossSystem '{ config = "armv7a-unknown-linux-gnueabihf"; }'Re: Aro – Zig's new C compiler
#58It seems like I can't include standard header files, so it can't compile a common hello world. I guess that'd be useful to mention on the README, or maybe I'm doing something wrong? main.c:1:10: fatal error: 'stdio.h' not found #include It'd be nice if header inclusion, and -l options work. This would allow benchmarking Aro against some other compilers on a wide range of C files. Usually sqlite3.c is my first go-to f…
System header search paths are only implemented on Linux currently. You should be able to parse sqlite3.c on Linux with arocc -fsyntax-only -Wno-unknown-attributes sqlite3.c
Re: Aro – Zig's new C compiler
#59Earlier quoted context omitted.
The Zig compiler has used Data Oriented Design for a long time, so any recent version has that, yes. The most substantial part of running the compiler right now is LLVM, hence the focus to provide an alternative. The other big focus right now is incremental compilation, which will make recompilations very fast.
The talk I am referring to is from 2024 and shows some metrics improving by 30% or more. And Andrew said that's not yet shipped: https://www.youtube.com/watch?v=IroPQ150F6c So, are you sure about that?? EDIT: ok, the talk was uploaded just last week, but someone in the comments clarified that: > The original talk is from 2021.. Thank you for reuploading. I feel stupid now :/
Re: Aro – Zig's new C compiler
#60Earlier quoted context omitted.
It says it's a C frontend for `zig translate-c` which translates C code to Zig code. `zig translate-c` is not required for most Zig projects or even for most Zig projects that interop with C.
translate-c is not required for compiling pure Zig code. However, the plan is to remove the "@cImport" built in. So if your project is importing a c header, in the future you'll add build step translating it from c to Zig, and then you import it into your Zig code as a module.