-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an easy way to build from source without LLVM #17892
Conversation
Sick! |
ed9ccc1
to
f2a1f2b
Compare
Since rebasing on master, this now fails with:
|
I bisected it to b3462b7. |
I tried reproducing this but I get:
|
Pass |
Hm, I can't seem to reproduce the issue - the build completes successfully for me:
|
f2a1f2b
to
fa17fa3
Compare
fa17fa3
to
177d644
Compare
Note that at least some, if not all, of these CI failures are due to a gcc miscompilation. (hint: that's way too many |
Nice reduction. Unfortunately Zig's C backend has to care about generating code that is compatible with GCC versions that are widely in use, so even if they fixed this immediately, we would still need a workaround. This looks like a pain in the ass to work around though. If I'm reading this right, we can't rely on the assignment operation when the type is an aggregate that contains a I requested an account on gcc bugzilla so I can make the report once I get an email response. |
As I understand it, gcc believes that the See also this diff on godbolt: --- a/example.c
+++ b/example.c
@@ -15,7 +15,7 @@ typedef _Float16 f16;
typedef float f32;
typedef double f64;
typedef long double f80;
-typedef __float128 f128;
+typedef u128 f128;
extern void *memcpy(void *restrict, void const *restrict, usize);
|
516ee70
to
275934e
Compare
Ah that makes sense, thanks! |
Another local miscompilation with gcc 12.2.0:
|
When a zig compiler without LLVM extensions is satisfactory, this greatly simplified build-from-source process can be used. This could be useful for users who only want to contribute to the standard library, for example.
otherwise we get undefined symbol errors on pthread stuff
275934e
to
557cb64
Compare
@jacobly0 I didn't want your nice test case to go to waste so I filed a gcc bug here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112521 |
In celebration of #17871, this adds a new file, bootstrap.c, for building from source without LLVM. The new README instructions are reproduced here:
When a zig compiler without LLVM extensions is satisfactory, this greatly simplified build-from-source process can be used.
This could be useful for users who only want to contribute to the standard library, for example. For me this takes 11 minutes, or 3 minutes if I change -O2 to -O0 when compiling zig2.c. I'm not sure which one it should default to. On one hand building faster is nice; on the other hand, since we don't have optimizations without LLVM yet, it's nice to have a stage2 build handy that is optimized. The unoptimized one takes about 5m to build the compiler, while the optimized one completes in 25 seconds.
If we look at total time to stage3:
-O2
: 11m-O0
: 8mI think I like the -O2 version because even though we wait 3 more minutes, we can rebuild faster, and we have a handy optimized zig2 sitting around.
Either way, this is compared to building LLVM from source, which is a show-stopper for many people, or ~30 minutes if ya nasty.
Related: