zig icon indicating copy to clipboard operation
zig copied to clipboard

Cross build ios can not find 'stdio.h'

Open calvin2021y opened this issue 3 years ago • 1 comments

Zig Version

0.10.0-dev.2981+7090f0471

Steps to Reproduce

build with this command:

zig cc -target aarch64-ios -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk  -Ithird_party/utf8_range -c utf8_range/range2-neon.c -o ./range2-neon.c.o 

If I add --target=arm64-apple-ios9.0, get UnknownArchitecture error

Expected Behavior

expect it build without error like clang:

clang -arch arm64 -miphoneos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk --target=arm64-apple-ios9.0 

Actual Behavior

third_party/utf8_range/range2-neon.c:7:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.

calvin2021y avatar Jul 14 '22 04:07 calvin2021y

after add -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include , no more <stdio.h> file not found error.

Zig should auto add search patch when -isysroot provided.

cross build ios also get this error:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h:378:55: note: insert '_Nullable' if the pointer may be null
                 int (* _Nullable)(void *, const char *, int),
                                                      ^
                                                       _Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h:378:55: note: insert '_Nonnull' if the pointer should never be null
                 int (* _Nullable)(void *, const char *, int),
                                                      ^
                                                       _Nonnull

calvin2021y avatar Jul 14 '22 04:07 calvin2021y