zig icon indicating copy to clipboard operation
zig copied to clipboard

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

Open calvin2021y opened this issue 3 years ago • 1 comments

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>
         ^~~~~~~~~~~~~

calvin2021y avatar Jul 14 '22 04:07 calvin2021y

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.

ilohmar avatar Nov 07 '22 14:11 ilohmar