You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In celebration of #17871, this adds a new file, bootstrap.c, for building from source without LLVM. The new README instructions are reproduced here:
If you don't need your Zig compiler to have LLVM extensions enabled, you can
follow these instructions instead.
In this case, the only system dependency is a C compiler.
cc -o bootstrap bootstrap.c
./bootstrap build
You can pass any options to this that you would pass to zig build.
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:
compile zig2.c with -O2: 11m
compile zig2.c with -O0: 8m
I 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.
Thread 1 "zig2" received signal SIGSEGV, Segmentation fault.
0x000000000066cdcc in Air_typeOfIndex__57870 ()
(gdb) bt
#0 0x000000000066cdcc in Air_typeOfIndex__57870 ()
#1 0x0000000000776b41 in Sema_coerceExtra__99923 ()
#2 0x00000000006f6f56 in Sema_zirStructInitEmptyResult__99763 ()
#3 0x00000000006869fb in Sema_analyzeBodyInner__99437 ()
#4 0x0000000000683317 in Sema_analyzeBodyBreak__99435 ()
#5 0x000000000068074c in Sema_resolveStructFieldInits__100012 ()
#6 0x00000000007bd394 in Sema_finishStructInit__99769 ()
#7 0x000000000078c8a6 in Sema_structInitEmpty__99764 ()
#8 0x0000000000697ef5 in Sema_analyzeBodyInner__99437 ()
#9 0x0000000000683317 in Sema_analyzeBodyBreak__99435 ()
#10 0x000000000068074c in Sema_resolveStructFieldInits__100012 ()
#11 0x00000000007bd394 in Sema_finishStructInit__99769 ()
#12 0x000000000078c8a6 in Sema_structInitEmpty__99764 ()
#13 0x0000000000697ef5 in Sema_analyzeBodyInner__99437 ()
#14 0x0000000000683317 in Sema_analyzeBodyBreak__99435 ()
#15 0x0000000000cafcfa in Module_semaDecl__5758 ()
#16 0x000000000062d332 in Module_ensureDeclAnalyzed__5753 ()
#17 0x00000000006692f8 in Sema_ensureDeclAnalyzed__99963 ()
#18 0x0000000000668f37 in Sema_analyzeDeclRefInner__99967 ()
#19 0x00000000006906da in Sema_analyzeBodyInner__99437 ()
#20 0x000000000083e6ee in Sema_resolveBlockBody__99554 ()
#21 0x00000000006933ae in Sema_analyzeBodyInner__99437 ()
#22 0x00000000006bf0af in Sema_analyzeBodyInner__99437 ()
#23 0x000000000083e6ee in Sema_resolveBlockBody__99554 ()
#24 0x00000000006933ae in Sema_analyzeBodyInner__99437 ()
#25 0x000000000083e6ee in Sema_resolveBlockBody__99554 ()
#26 0x00000000006933ae in Sema_analyzeBodyInner__99437 ()
#27 0x000000000083e6ee in Sema_resolveBlockBody__99554 ()
#28 0x00000000006933ae in Sema_analyzeBodyInner__99437 ()
#29 0x000000000062afc7 in Module_ensureFuncBodyAnalyzed__5754 ()
#30 0x0000000000572971 in Compilation_processOneJob__5530 ()
#31 0x0000000000565131 in Compilation_update__5510 ()
#32 0x00000000004f7615 in main_updateModule__216 ()
#33 0x00000000004b5b7d in main_buildOutputType__207 ()
#34 0x0000000000403198 in main ()
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 f128, meaning that all f128 types would need to be lowered as char[16] instead of __float128.
I requested an account on gcc bugzilla so I can make the report once I get an email response.
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 f128, meaning that all f128 types would need to be lowered as char[128] instead of __float128.
As I understand it, gcc believes that the _Float128 and __float128 types fit in an st (80-bit) register. The correct workaround should be to disable the _Float128, and __float128 branches and let it hit the fallback instead on affected gcc versions.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: