ziglang / zig-bootstrap

take off every zig
372 stars 86 forks source link

x86_64-freebsd-gnu #45

Open kivikakk opened 3 years ago

kivikakk commented 3 years ago

We get pretty far:

[ 99%] Built target zig0                                                                                                                        [40/8420]
[ 99%] Building self-hosted component /usr/home/kameliya/Code/zig-bootstrap/out/build-zig-host/zig1.o                                                    
Scanning dependencies of target zig                                                                                                                      
[100%] Building CXX object CMakeFiles/zig.dir/src/stage1/empty.cpp.o                                                                                     
[100%] Linking CXX executable zig                                                                                                                        
[100%] Built target zig                                                                                                                                  
Install the project...                                                                                                                                   
-- Install configuration: "Release"                                                                                                                      
-- Installing: /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig                                                                                    
-- Set runtime path of "/usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig" to ""                                                                    
-- Installing: /usr/home/kameliya/Code/zig-bootstrap/out/host/lib                                                                                        
-- The C compiler identification is Clang 11.0.1                                                                                                         
-- The CXX compiler identification is Clang 11.0.1                                                                                                       
-- The ASM compiler identification is unknown                                                                                                            
-- Found assembler: /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig                                                                               
-- Detecting C compiler ABI info                                                                                                                         
-- Detecting C compiler ABI info - failed                                                                                                                
-- Check for working C compiler: /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig                                                                  
-- Check for working C compiler: /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig - broken                                                         
CMake Error at /usr/local/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):                                                                     
  The C compiler                                                                                                                                         

    "/usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig"                                                                                             

  is not able to compile a simple test program.                                                                                                          

  It fails with the following output:                                                                                                                    

    Change Dir: /usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp                                     

    Run Build Command(s):/usr/bin/make cmTC_f356b/fast && /usr/bin/make  -f CMakeFiles/cmTC_f356b.dir/build.make CMakeFiles/cmTC_f356b.dir/build         
    Building C object CMakeFiles/cmTC_f356b.dir/testCCompiler.c.o                                                                                        
    /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -target x86_64-freebsd-gnu -mcpu=baseline    -o CMakeFiles/cmTC_f356b.di
r/testCCompiler.c.o -c /usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp/testCCompiler.c              
    Linking C executable cmTC_f356b                                                                                                                      
    /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f356b.dir/link.txt --verbose=1                                                             
    /usr/home/kameliya/Code/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -target x86_64-freebsd-gnu -mcpu=baseline CMakeFiles/cmTC_f356b.dir/test
CCompiler.c.o -o cmTC_f356b                                                                                                                              
    In file included from /usr/home/kameliya/Code/zig-bootstrap/out/host/lib/zig/libunwind/src/libunwind.cpp:12:                                         
    In file included from /usr/home/kameliya/Code/zig-bootstrap/out/host/lib/zig/libunwind/include/libunwind.h:18:                                       
    In file included from /usr/home/kameliya/Code/zig-bootstrap/out/host/lib/zig/libcxx/include/stdint.h:106:                                            
    /usr/home/kameliya/Code/zig-bootstrap/out/host/lib/zig/libcxx/include/__config:247:12: fatal error: 'sys/endian.h' file not found
    #  include <sys/endian.h>
               ^~~~~~~~~~~~~~
    1 error generated.
    *** Error code 1

    Stop.
    make[1]: stopped in /usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp
    *** Error code 1

    Stop.
    make: stopped in /usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:57 (project)

-- Configuring incomplete, errors occurred!
See also "/usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeOutput.log".
See also "/usr/home/kameliya/Code/zig-bootstrap/out/build-llvm-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeError.log".
kivikakk commented 3 years ago

I got a little more familiar with how Zig compiles things! Looks like this is because we don't package a libc for FreeBSD; accordingly, it's not in available_libcs, and one way or another we end up returning an empty libc_include_dir_list here.

LinuxUserGD commented 2 years ago

Similar output with x86_64-gentoo-linux-musl host:

-- Found ccache /usr/bin/ccache
-- Configuring zig version 0.10.0-dev.2931+bdf3fa12f
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/zig-bootstrap/out/build-zig-host
[  1%] Built target opt_c_util
[ 82%] Built target embedded_softfloat
[ 86%] Built target zigcpp
[ 98%] Built target zigstage1
[ 99%] Built target zig0
[100%] Built target zig
Install the project...
-- Install configuration: "Release"
-- Installing: /home/user/zig-bootstrap/out/host/bin/zig
-- Set runtime path of "/home/user/zig-bootstrap/out/host/bin/zig" to ""
-- Installing: /home/user/zig-bootstrap/out/host/lib
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is Clang 14.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/user/zig-bootstrap/out/host/bin/zig
-- Check for working C compiler: /home/user/zig-bootstrap/out/host/bin/zig - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/home/user/zig-bootstrap/out/host/bin/zig"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_ab393/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_ab393.dir/build.make CMakeFiles/cmTC_ab393.dir/build
    gmake[1]: Entering directory '/home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_ab393.dir/testCCompiler.c.o
    /home/user/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target x86_64-freebsd-gnu -mcpu=baseline    -MD -MT CMakeFiles/cmTC_ab393.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_ab393.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_ab393.dir/testCCompiler.c.o -c /home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_ab393
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ab393.dir/link.txt --verbose=1
    /home/user/zig-bootstrap/out/host/bin/zig  cc -fno-sanitize=all -s -target x86_64-freebsd-gnu -mcpu=baseline CMakeFiles/cmTC_ab393.dir/testCCompiler.c.o -o cmTC_ab393
    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
    gmake[1]: *** [CMakeFiles/cmTC_ab393.dir/build.make:100: cmTC_ab393] Error 1
    gmake[1]: Leaving directory '/home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:127: cmTC_ab393/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:4 (project)

-- Configuring incomplete, errors occurred!
See also "/home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeOutput.log".
See also "/home/user/zig-bootstrap/out/build-zlib-x86_64-freebsd-gnu-baseline/CMakeFiles/CMakeError.log".
andrewrk commented 3 months ago

It works fine if you build on a FreeBSD host with this command:

CMAKE_GENERATOR=Ninja ./build x86_64-native baseline

however, zig does not have the ability to cross-compile for this target yet.