-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zig-msvc target error: 'unistd.h' file not found #635
Comments
Is _MSC_VER macro predefined by the compiler? I guess no. |
If not predefined, then how could we detect msvc target (using some predefined macro)? |
in my fork: master...kassane:bdwgc:zig-msvc Lines 469 to 470 in ff19442
+- run subthreadcreatetest
+- zig build-exe subthreadcreatetest Debug native-native-msvc
+- zig build-lib gc Debug native-native-msvc 20 errors
<command line>:2:9: error: '_MSC_VER' macro redefined
<built-in>:407:2: note: in file included from <built-in>:407:
<built-in>:393:9: note: previous definition is here |
How to reproduce it? |
|
Lines 398 to 399 in c77eee1
new error D:\a\bdwgc\bdwgc\extra/../gcj_mlc.c:88:31: error: 'getenv' is deprecated: This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\a\bdwgc\bdwgc\extra/gc.c:43:10: note: in file included from D:\a\bdwgc\bdwgc\extra/gc.c:43:
D:\a\bdwgc\bdwgc\include/private/gc_priv.h:781:23: note: expanded from macro 'GETENV'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt/stdlib.h:1183:20: note: 'getenv' has been explicitly marked deprecated here
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include/vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include/vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT' Try againLines 398 to 401 in a97781a
D:\a\bdwgc\bdwgc\extra/../mark.c:531:11: error: extension used
D:\a\bdwgc\bdwgc\extra/gc.c:56:10: note: in file included from D:\a\bdwgc\bdwgc\extra/gc.c:56:
D:\a\bdwgc\bdwgc\extra/../win32_threads.c:1387:7: error: extension used
D:\a\bdwgc\bdwgc\extra/gc.c:77:10: note: in file included from D:\a\bdwgc\bdwgc\extra/gc.c:77:
D:\a\bdwgc\bdwgc\extra/../win32_threads.c:1393:7: error: extension used
D:\a\bdwgc\bdwgc\extra/gc.c:77:10: note: in file included from D:\a\bdwgc\bdwgc\extra/gc.c:77:
error: the following command failed with 3 compilation errors: latest tryLines 398 to 403 in 4cf78f3
error: lld-link: undefined symbol: __declspec(dllimport) MessageBoxA
note: referenced by D:\a\bdwgc\bdwgc\misc.c:858
note: D:\a\bdwgc\bdwgc\zig-cache\o\18ec8cc31c1db3c26fcae6daa28609b4\gc.obj:(GC_win32_MessageBoxA)
error: the following command failed with 1 compilation errors: Works in some configurations, see |
Add "-D DONT_USE_USER32_DLL" to flags |
Make a PR please. |
Doesn't it apply to windows in general (gnu & msvc)? Lines 386 to 390 in df1a787
I do. |
Currently it is applied to static builds only. |
Got it. |
I successfully tested using the first PR #636, with the exception of msvc-debug mode. gc.lib(misc.obj) : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function GC_write |
This symbol is defined only in debug version of msvc libs. Please check which version of msvc libs are used. |
If not possible to instruct msvc to use the correct version of the libs, then there could be a workaround in misc.c (plus a define of NO_CRTDBGREPORT in build.zig):
->
|
I'm processing your PR #636. I've to break it into several commits. |
What's preventing to turn on -Werror? cmake script uses /W4 /wd4127 /WX /wd4091 options. |
Issue #635 (bdwgc). * misc.c [(MSWIN32 && !CONSOLE_LOG || MSWINCE) && _MSC_VER && _DEBUG && !NO_CRT && MSWINCE] (GC_write): Do not call MultiByteToWideChar() and OutputDebugStringW() if NO_CRTDBGREPORT is defined. * misc.c [(MSWIN32 && !CONSOLE_LOG || MSWINCE) && _MSC_VER && _DEBUG && !NO_CRT && !MSWINCE] (GC_write): Do not call _CrtDbgReport() if NO_CRTDBGREPORT is defined.
Windows (msvc/gnu) linked libs (LLD): MSVC_libdir search: https://github.com/ziglang/zig/blob/f6f7a47aad7da251f1e4ee6f45b6de79ce8bbbd8/lib/std/zig/WindowsSdk.zig#L589 (
Currently previoud CI: https://github.com/kassane/bdwgc/actions/runs/8787776049/job/24113766036#step:5:5 zig build -Dtarget=native-native-msvc -DBUILD_SHARED_LIBS=false -Ddisable_handle_fork=false -Denable_gc_assertions=true -Denable_gc_debug=false -Denable_large_config=false -Denable_munmap=false -Denable_parallel_mark=false -Denable_redirect_malloc=false -Denable_rwlock=false -Denable_thread_local_alloc=false -Denable_threads=true -Denable_cplusplus=true -Denable_werror test
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
test
+- run cpptest
+- zig build-exe cpptest Debug native-native-msvc
+- zig build-lib gccpp Debug native-native-msvc 2 errors
:1:1: error: argument unused during compilation: '-nostdinc++'
:1:1: error: argument unused during compilation: '-nostdinc++' Reference |
rebased.
After rebase, I re-examined this problem and discovered that it was currently caused by the D (ldc2 - msvc-compat only) compiler. Missing |
References
The text was updated successfully, but these errors were encountered: