Skip to content

Stage 3 build fails after including system headers #13915

Description

@NickHastings

Zig Version

0.10.0

Steps to Reproduce and Observed Behavior

Hi,

thanks for Zig! I've recently tried to update from Zig 0.9.1 to Zig 0.10.0.

The build fails at stage 3 after apparently including system headers that in turn include other headers that do not appear to be in the build include path. The steps taken to produce this problem were:

wget https://github.com/ziglang/zig/archive/refs/tags/0.10.0.tar.gz
tar xf 0.10.0.tar.gz
cd zig-0.10.0
mkdir build
cd build
cmake ..
make

The build fails at stage 3 after apparently including system headers that in turn include other headers that do not appear to be in the build include path. Eg I see:

Scanning dependencies of target stage3
[100%] Building stage3
Compile C Objects [11/21] analyze.cpp... error(compilation): clang failed with stderr: In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/src/hash.cpp:9:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/__hash_table:25:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/memory:860:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/__memory/shared_ptr.h:39:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/atomic:526:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/__thread/timed_backoff_policy.h:17:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/__threading_support:18:
In file included from /home/hastings/tmp/zig-0.10.0/lib/libcxx/include/errno.h:31:
In file included from /usr/include/errno.h:28:
In file included from /usr/include/bits/errno.h:26:
/usr/include/linux/errno.h:1:10: fatal error: 'asm/errno.h' file not found

We can see the system header /usr/include/errno.h is included and which then includes /usr/include/bits/errno.h which in turn tries to include asm/errno.h.

Since this is stage 3 of the build I expect that no system headers should be used, only those bundled with Zig.

I have seen this on both Debian unstable (sid) and Debian stable (bullseye) with backported llvm-15.

A log from my terminal session: bullseye-zig-0.1.0-build.log.

Please let me know what additional information I could provide or what I may try in order to understand the cause of and to try to resolve this problem.

Cheers,

Nick.

Expected Behavior

I expected (hoped for!) the build to not fail.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    downstreamAn issue with a third party project that uses Zig.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions