zig icon indicating copy to clipboard operation
zig copied to clipboard

Cannot build stage 2 on x86-64-illumos

Open The-King-of-Toasters opened this issue 3 years ago • 3 comments

Zig Version

0.10.0-dev.3264+d99c32c2e

Steps to Reproduce

  1. Build LLVM 14.0.6 with this patch applied. It works around some rough spots that haven't been fixed in Solaris. You can use the method found in the wiki, but the script I use is:
    #!/bin/sh
    cmake "llvm" \
        -B build -G Ninja \
        -DLLVM_ENABLE_PROJECTS="lld;clang" \
        -DLLVM_ENABLE_LIBXML2=OFF \
        -DCMAKE_INSTALL_PREFIX="$HOME/local" \
        -DCMAKE_PREFIX_PATH="$HOME/local" \
        -DLLVM_INCLUDE_TESTS=OFF \
        -DLLVM_INCLUDE_GO_TESTS=OFF \
        -DLLVM_INCLUDE_EXAMPLES=OFF \
        -DLLVM_INCLUDE_BENCHMARKS=OFF \
        -DLLVM_BUILD_LLVM_DYLIB=ON \
        -DLLVM_ENABLE_BINDINGS=OFF \
        -DLLVM_ENABLE_OCAMLDOC=OFF \
        -DLLVM_ENABLE_Z3_SOLVER=OFF \
        -DCLANG_BUILD_TOOLS=OFF \
        -DCLANG_INCLUDE_DOCS=OFF \
        -DLLVM_INCLUDE_DOCS=OFF \
        -DCMAKE_BUILD_TYPE=Release
    ninja -C build install
    
  2. Build stage 1 with this LLVM build:
    cmake -B build -G Ninja -DCMAKE_PREFIX_PATH="$HOME/local" -DCMAKE_INSTALL_PREFIX="$HOME/local" -DCMAKE_BUILD_TYPE=Release
    ninja -C build
    
  3. Build stage 2:
    cd build
    ./zig build -p stage2 -Denable-llvm
    

Expected Behavior

Stage 2 LLVM zig version to be built.

Actual Behavior

A ton of linker errors. Running with --verbose-link for more info (first line) renders this log (too big for github).

Subtask of #7152.

The-King-of-Toasters avatar Jul 24 '22 07:07 The-King-of-Toasters

Have you tried applying that patch to zig-bootstrap and building with that?

Vexu avatar Jul 24 '22 10:07 Vexu

Yeah, for some reason using stage 1 zig cc will error out immediately. I'll try and follow this up tomorrow with a log.

The-King-of-Toasters avatar Jul 24 '22 10:07 The-King-of-Toasters

So for the zig-bootstrap path, I fail when trying to compile zlib with zig cc. CMake does a sanity check on the C compiler, and fails. Here's the output of CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /home/stephen/gits/zig-bootstrap/out/host/bin/zig cc;-fno-sanitize=all;-s;-target;x86_64-solaris-gnu
Build flags:
Id flags:

The output was:
1
error: FileNotFound


Detecting C compiler ABI info failed to compile with the following output:
Change Dir: /home/stephen/gits/zig-bootstrap/out/build-zlib-x86_64-solaris-gnu-baseline/CMakeFiles/CMakeTmp

Run Build Command(s):/opt/ooce/bin/ninja cmTC_c6b7d && [1/2] Building C object CMakeFiles/cmTC_c6b7d.dir/CMakeCCompilerABI.c.obj
clang version 14.0.6 (https://github.com/ziglang/zig-bootstrap 23b21b266a82ba3bcfff1e25fff41004a0c9cf95)
Target: x86_64-unknown-solaris-gnu
Thread model: posix
InstalledDir: /opt/ooce/bin
 (in-process)
 "/home/stephen/gits/zig-bootstrap/out/host/bin/zig" -cc1 -triple x86_64-unknown-solaris-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/stephen/gits/zig-bootstrap/out/build-zlib-x86_64-solaris-gnu-baseline/CMakeFiles/CMakeTmp -nostdsysteminc -nobuiltininc -resource-dir /home/stephen/gits/zig-bootstrap/out/host/lib/clang/14.0.6 -dependency-file CMakeFiles/cmTC_c6b7d.dir/CMakeCCompilerABI.c.obj.d -MT CMakeFiles/cmTC_c6b7d.dir/CMakeCCompilerABI.c.obj -sys-header-deps -isystem /home/stephen/gits/zig-bootstrap/out/host/lib/zig/include -D _DEBUG -O0 -fdebug-compilation-dir=/home/stephen/gits/zig-bootstrap/out/build-zlib-x86_64-solaris-gnu-baseline/CMakeFiles/CMakeTmp -ferror-limit 19 -stack-protector 2 -stack-protector-buffer-size 4 -fgnuc-version=4.2.1 -fno-spell-checking -target-cpu x86-64 -target-feature -16bit-mode -target-feature -32bit-mode -target-feature -3dnow -target-feature -3dnowa -target-feature +64bit -target-feature -adx -target-feature -aes -target-feature -amx-bf16 -target-feature -amx-int8 -target-feature -amx-tile -target-feature -avx -target-feature -avx2 -target-feature -avx512bf16 -target-feature -avx512bitalg -target-feature -avx512bw -target-feature -avx512cd -target-feature -avx512dq -target-feature -avx512er -target-feature -avx512f -target-feature -avx512fp16 -target-feature -avx512ifma -target-feature -avx512pf -target-feature -avx512vbmi -target-feature -avx512vbmi2 -target-feature -avx512vl -target-feature -avx512vnni -target-feature -avx512vp2intersect -target-feature -avx512vpopcntdq -target-feature -avxvnni -target-feature -bmi -target-feature -bmi2 -target-feature -branchfusion -target-feature -cldemote -target-feature -clflushopt -target-feature -clwb -target-feature -clzero -target-feature +cmov -target-feature -crc32 -target-feature -cx16 -target-feature +cx8 -target-feature -enqcmd -target-feature -ermsb -target-feature -f16c -target-feature -false-deps-lzcnt-tzcnt -target-feature -false-deps-popcnt -target-feature -fast-11bytenop -target-feature -fast-15bytenop -target-feature -fast-7bytenop -target-feature -fast-bextr -target-feature -fast-gather -target-feature -fast-hops -target-feature -fast-lzcnt -target-feature -fast-movbe -target-feature -fast-scalar-fsqrt -target-feature -fast-scalar-shift-masks -target-feature -fast-shld-rotate -target-feature -fast-variable-crosslane-shuffle -target-feature -fast-variable-perlane-shuffle -target-feature -fast-vector-fsqrt -target-feature -fast-vector-shift-masks -target-feature -fma -target-feature -fma4 -target-feature -fsgsbase -target-feature -fsrm -target-feature +fxsr -target-feature -gfni -target-feature -hreset -target-feature -idivl-to-divb -target-feature +idivq-to-divl -target-feature -invpcid -target-feature -kl -target-feature -lea-sp -target-feature -lea-uses-ag -target-feature -lvi-cfi -target-feature -lvi-load-hardening -target-feature -lwp -target-feature -lzcnt -target-feature +macrofusion -target-feature +mmx -target-feature -movbe -target-feature -movdir64b -target-feature -movdiri -target-feature -mwaitx -target-feature +nopl -target-feature -pad-short-functions -target-feature -pclmul -target-feature -pconfig -target-feature -pku -target-feature -popcnt -target-feature -prefer-128-bit -target-feature -prefer-256-bit -target-feature -prefer-mask-registers -target-feature -prefetchwt1 -target-feature -prfchw -target-feature -ptwrite -target-feature -rdpid -target-feature -rdrnd -target-feature -rdseed -target-feature -retpoline -target-feature -retpoline-external-thunk -target-feature -retpoline-indirect-branches -target-feature -retpoline-indirect-calls -target-feature -rtm -target-feature -sahf -target-feature -serialize -target-feature -seses -target-feature -sgx -target-feature -sha -target-feature -shstk -target-feature +slow-3ops-lea -target-feature +slow-incdec -target-feature -slow-lea -target-feature -slow-pmaddwd -target-feature -slow-pmulld -target-feature -slow-shld -target-feature -slow-two-mem-ops -target-feature -slow-unaligned-mem-16 -target-feature -slow-unaligned-mem-32 -target-feature -soft-float -target-feature +sse -target-feature +sse2 -target-feature -sse3 -target-feature -sse4.1 -target-feature -sse4.2 -target-feature -sse4a -target-feature -sse-unaligned-mem -target-feature -ssse3 -target-feature -tagged-globals -target-feature -tbm -target-feature -tsxldtrk -target-feature -uintr -target-feature -use-aa -target-feature -use-glm-div-sqrt-costs -target-feature -use-slm-arith-costs -target-feature -vaes -target-feature -vpclmulqdq -target-feature +vzeroupper -target-feature -waitpkg -target-feature -wbnoinvd -target-feature -widekl -target-feature +x87 -target-feature -xop -target-feature -xsave -target-feature -xsavec -target-feature -xsaveopt -target-feature -xsaves -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/stephen/.cache/zig/tmp/2a97eb205ebe7fa0-CMakeCCompilerABI.o -x c /opt/ooce/share/cmake-3.23/Modules/CMakeCCompilerABI.c
clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-solaris2.11
#include "..." search starts here:
#include <...> search starts here:
 /home/stephen/gits/zig-bootstrap/out/host/lib/zig/include
End of search list.
ld.lld -r -error-limit=0 -O0 --eh-frame-hdr -s -znow -m elf_x86_64 -static -o CMakeFiles/cmTC_c6b7d.dir/CMakeCCompilerABI.c.obj /home/stephen/.cache/zig/o/2e9e87564ea6b256a1f34449324f5222/CMakeCCompilerABI.o --allow-shlib-undefined
[2/2] Linking C executable cmTC_c6b7d
FAILED: cmTC_c6b7d
: && /home/stephen/gits/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target x86_64-solaris-gnu  -v CMakeFiles/cmTC_c6b7d.dir/CMakeCCompilerABI.c.obj -o cmTC_c6b7d   && :
error: libc not available
    error: run 'zig libc -h' to learn about libc installations
    error: run 'zig targets' to see the targets for which zig can always provide libc
ninja: build stopped: subcommand failed.




Determining if the C compiler works failed with the following output:
Change Dir: /home/stephen/gits/zig-bootstrap/out/build-zlib-x86_64-solaris-gnu-baseline/CMakeFiles/CMakeTmp

Run Build Command(s):/opt/ooce/bin/ninja cmTC_96912 && [1/2] Building C object CMakeFiles/cmTC_96912.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_96912
FAILED: cmTC_96912
: && /home/stephen/gits/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target x86_64-solaris-gnu   CMakeFiles/cmTC_96912.dir/testCCompiler.c.obj -o cmTC_96912   && :
error: libc not available
    error: run 'zig libc -h' to learn about libc installations
    error: run 'zig targets' to see the targets for which zig can always provide libc
ninja: build stopped: subcommand failed.

The-King-of-Toasters avatar Jul 24 '22 14:07 The-King-of-Toasters