ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
34.14k stars 2.49k forks source link

zig cc build for android ndk can not find 'asm/types.h' #12114

Open calvin2021y opened 2 years ago

calvin2021y commented 2 years ago

Zig Version

0.10.0-dev.2981+7090f0471

Steps to Reproduce

ndk version 24.

zig cc -target aarch64-linux-android --sysroot=/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -I/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include -Iinclude -c utf8_range/range2-neon.c -o range2-neon.c.o 

Expected Behavior

expect it work like clang.

Actual Behavior

In file included from utf8_range/range2-neon.c:7:
In file included from /ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/stdio.h:42:
In file included from /ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/sys/types.h:36:
/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
#include <asm/types.h>
         ^~~~~~~~~~~~~
ilohmar commented 1 year ago

I think you need to add the -I/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/$TARGET include dir before the general one.., cf. this.

Still fails in my experiments, because zig then says it cannot build libc. -L options not helping so far.