-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
cmake: build stage3 by default #12508
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
Conversation
66e374c
to
232472f
Compare
This is tripping over a stage3 bug, presumably having to do with
If I use |
imo this will be VERY useful for "zig" package maintainers |
Looks like it losts information if LLVm is linked dynamically or statically? [195/195] Building stage3
FAILED: CMakeFiles/stage3 /home/bratishkaerik/zig/build/CMakeFiles/stage3
cd /home/bratishkaerik/zig && /home/bratishkaerik/zig/build/zig2 build --zig-lib-dir /home/bratishkaerik/zig/lib --prefix /home/bratishkaerik/zig/build/stage3 -Dconfig_h=/home/bratishkaerik/zig/build/config.h -Denable-llvm -Denable-stage1 -Dskip-install-lib-files=false -Dtarget=native -Dcpu=baseline
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/util.cpp:9:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/target.cpp:9:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/bigfloat.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/bigfloat.hpp:12:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/stage1.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/range_set.cpp:1:
In file included from /home/bratishkaerik/zig/src/stage1/range_set.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/os.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/os.hpp:13:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/analyze.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/analyze.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/parser.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/parser.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/error.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/bigint.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/bigfloat.hpp:12:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/ir_print.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/errmsg.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/errmsg.hpp:13:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/astgen.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/astgen.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/tokenizer.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/tokenizer.hpp:13:
In file included from /home/bratishkaerik/zig/src/stage1/bigfloat.hpp:12:
In file included from /home/bratishkaerik/zig/src/stage1/error.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/stage2.h:17:
In file included from /home/bratishkaerik/zig/src/stage1/stage1.h:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/codegen.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/analyze.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
error(compilation): clang failed with stderr: In file included from /home/bratishkaerik/zig/src/stage1/ir.cpp:8:
In file included from /home/bratishkaerik/zig/src/stage1/astgen.hpp:11:
In file included from /home/bratishkaerik/zig/src/stage1/all_types.hpp:13:
/home/bratishkaerik/zig/src/zig_llvm.h:13:10: fatal error: 'llvm-c/Core.h' file not found
/home/bratishkaerik/zig/src/stage1/util.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/target.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/bigfloat.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/stage1.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/range_set.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/os.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/analyze.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/parser.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/error.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/bigint.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/ir_print.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/errmsg.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/astgen.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/tokenizer.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/codegen.cpp:1:1: error: unable to build C object: clang exited with code 1
/home/bratishkaerik/zig/src/stage1/ir.cpp:1:1: error: unable to build C object: clang exited with code 1
error: zig...
error: The following command exited with error code 1:
/home/bratishkaerik/zig/build/zig2 build-exe --stack 33554432 /home/bratishkaerik/zig/src/stage1.zig -lc -cflags -std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment -- /home/bratishkaerik/zig/src/stage1/analyze.cpp /home/bratishkaerik/zig/src/stage1/astgen.cpp /home/bratishkaerik/zig/src/stage1/bigfloat.cpp /home/bratishkaerik/zig/src/stage1/bigint.cpp /home/bratishkaerik/zig/src/stage1/buffer.cpp /home/bratishkaerik/zig/src/stage1/codegen.cpp /home/bratishkaerik/zig/src/stage1/errmsg.cpp /home/bratishkaerik/zig/src/stage1/error.cpp /home/bratishkaerik/zig/src/stage1/heap.cpp /home/bratishkaerik/zig/src/stage1/ir.cpp /home/bratishkaerik/zig/src/stage1/ir_print.cpp /home/bratishkaerik/zig/src/stage1/mem.cpp /home/bratishkaerik/zig/src/stage1/os.cpp /home/bratishkaerik/zig/src/stage1/parser.cpp /home/bratishkaerik/zig/src/stage1/range_set.cpp /home/bratishkaerik/zig/src/stage1/stage1.cpp /home/bratishkaerik/zig/src/stage1/target.cpp /home/bratishkaerik/zig/src/stage1/tokenizer.cpp /home/bratishkaerik/zig/src/stage1/util.cpp /home/bratishkaerik/zig/src/stage1/softfloat_ext.cpp -cflags -std=c99 -O3 -- /home/bratishkaerik/zig/src/stage1/parse_f128.c /home/bratishkaerik/zig/zig-cache/o/5cb161ec87b5a777b7018cb7f6137d85/libsoftfloat.a -lc++ /home/bratishkaerik/zig/build/zigcpp/libzigcpp.a /usr/lib/llvm/14/lib64/libclang-cpp.so.14 /usr/lib64/liblldMinGW.so /usr/lib64/liblldELF.so /usr/lib64/liblldCOFF.so /usr/lib64/liblldWasm.so /usr/lib64/liblldMachO.so /usr/lib64/liblldCommon.so /usr/lib/llvm/14/lib64/libLLVM-14.so /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/libstdc++.so -lunwind -lc_nonshared --cache-dir /home/bratishkaerik/zig/zig-cache --global-cache-dir /home/bratishkaerik/.cache/zig --name zig -target native-native -mcpu x86_64 --pkg-begin build_options /home/bratishkaerik/zig/zig-cache/options/7qIbWK_19aGD2pQphLAZE8dY4hPHx0js-jqawt_YP01TWR7C7je-esozZ5R2qKdI --pkg-end --pkg-begin compiler_rt /home/bratishkaerik/zig/src/empty.zig --pkg-end -I /home/bratishkaerik/zig/src -I /home/bratishkaerik/zig/deps/SoftFloat-3e/source/include -I /home/bratishkaerik/zig/deps/SoftFloat-3e-prebuilt -I /usr/include -D ZIG_LINK_MODE=Static -fno-build-id --zig-lib-dir /home/bratishkaerik/zig/lib --enable-cache
error: the following build command failed with exit code 1:
/home/bratishkaerik/zig/zig-cache/o/7ef886c3d6f9477262255b91f9618cc6/build /home/bratishkaerik/zig/build/zig2 /home/bratishkaerik/zig /home/bratishkaerik/zig/zig-cache /home/bratishkaerik/.cache/zig --zig-lib-dir /home/bratishkaerik/zig/lib --prefix /home/bratishkaerik/zig/build/stage3 -Dconfig_h=/home/bratishkaerik/zig/build/config.h -Denable-llvm -Denable-stage1 -Dskip-install-lib-files=false -Dtarget=native -Dcpu=baseline
ninja: build stopped: subcommand failed. |
Hm. this crashes with "-Dstatic-llvm=false" too |
"-Denable-stage1" causes this (on master too) |
does this change include an option to disable this behavior and have cmake build stage1 only? |
You can use e.g. |
stage3 has bad debug info in this branch:
|
Never mind, it's just that valgrind does not yet support DWARF v5 |
Next blocker is #12625 |
Previously, when lowering AIR instructions `wrap_errunion_payload`, `wrap_errunion_err`, and `wrap_optional`, the LLVM backend would create an alloca instruction to store the result, but did not set the alignment on it. This caused UB which went undetected for a long time until we started enabling the stack protector. Closes #12594 Unblocks #12508 Inspires #12634 Tests passed locally: * test-behavior * test-cases
36057ee
to
0961350
Compare
This is a simplification of the cmake build script which introduces a new "stage3" target that is built by default, which builds and installs a stage3 zig. It greatly simplifies the build instructions for Zig, making it conform to the regular cmake routine, while still producing a stage3 artifact.
Adds a `unused: u32 = 0` field to `Zir.Header`. We could leave this as padding, however it triggers a Valgrind warning because we read and write undefined bytes to the file system. This is harmless, but it's essentially free to have a zero field here and makes the warning go away, making it more likely that following Valgrind warnings will be taken seriously.
This makes it so that `ninja install` will work as expected.
* CMakeLists: pass `-Dstrip` for release zig builds * pass -target and -mcpu to zig1. works around llvm on freebsd incorrectly detecting "freestanding" instead of "freebsd" for the native OS. * ci.ziglang.org is now responsible for creating aarch64-macos tarballs rather than Azure.
This is a simplification of the cmake build script which introduces a
new "stage3" target that is built by default, which builds and installs
a stage3 zig.
It greatly simplifies the build instructions for Zig, making it conform
to the regular cmake routine, while still producing a stage3 artifact.