authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 20:54:52-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 20:54:52-04:00
log1c41f1ca6252faaa7750936c67562f1866a48075
tree7627845397b04afdce73cfe824865b76262a0d76
parent371a3ad4bd7b1fda56654f32b89c176a0197651f

better error reporting for missing libc on windows

closes #931

2 files changed, 9 insertions(+), 3 deletions(-)

src/analyze.cpp+6-3
...@@ -4433,7 +4433,8 @@ void find_libc_lib_path(CodeGen *g) {...@@ -4433,7 +4433,8 @@ void find_libc_lib_path(CodeGen *g) {
4433 if (g->msvc_lib_dir == nullptr) {4433 if (g->msvc_lib_dir == nullptr) {
4434 Buf* vc_lib_dir = buf_alloc();4434 Buf* vc_lib_dir = buf_alloc();
4435 if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) {4435 if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) {
4436 zig_panic("Unable to determine vcruntime path.");4436 fprintf(stderr, "Unable to determine vcruntime path. --msvc-lib-dir");
4437 exit(1);
4437 }4438 }
4438 g->msvc_lib_dir = vc_lib_dir;4439 g->msvc_lib_dir = vc_lib_dir;
4439 }4440 }
...@@ -4441,7 +4442,8 @@ void find_libc_lib_path(CodeGen *g) {...@@ -4441,7 +4442,8 @@ void find_libc_lib_path(CodeGen *g) {
4441 if (g->libc_lib_dir == nullptr) {4442 if (g->libc_lib_dir == nullptr) {
4442 Buf* ucrt_lib_path = buf_alloc();4443 Buf* ucrt_lib_path = buf_alloc();
4443 if (os_get_win32_ucrt_lib_path(sdk, ucrt_lib_path, g->zig_target.arch.arch)) {4444 if (os_get_win32_ucrt_lib_path(sdk, ucrt_lib_path, g->zig_target.arch.arch)) {
4444 zig_panic("Unable to determine ucrt path.");4445 fprintf(stderr, "Unable to determine ucrt path. --libc-lib-dir");
4446 exit(1);
4445 }4447 }
4446 g->libc_lib_dir = ucrt_lib_path;4448 g->libc_lib_dir = ucrt_lib_path;
4447 }4449 }
...@@ -4449,7 +4451,8 @@ void find_libc_lib_path(CodeGen *g) {...@@ -4449,7 +4451,8 @@ void find_libc_lib_path(CodeGen *g) {
4449 if (g->kernel32_lib_dir == nullptr) {4451 if (g->kernel32_lib_dir == nullptr) {
4450 Buf* kern_lib_path = buf_alloc();4452 Buf* kern_lib_path = buf_alloc();
4451 if (os_get_win32_kern32_path(sdk, kern_lib_path, g->zig_target.arch.arch)) {4453 if (os_get_win32_kern32_path(sdk, kern_lib_path, g->zig_target.arch.arch)) {
4452 zig_panic("Unable to determine kernel32 path.");4454 fprintf(stderr, "Unable to determine kernel32 path. --kernel32-lib-dir");
4455 exit(1);
4453 }4456 }
4454 g->kernel32_lib_dir = kern_lib_path;4457 g->kernel32_lib_dir = kern_lib_path;
4455 }4458 }
src/os.cpp+3
...@@ -1334,6 +1334,9 @@ com_done:;...@@ -1334,6 +1334,9 @@ com_done:;
13341334
1335int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) {1335int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) {
1336#if defined(ZIG_OS_WINDOWS)1336#if defined(ZIG_OS_WINDOWS)
1337 if (buf_len(sdk->path10) == 0 || buf_len(sdk->version10) == 0) {
1338 return ErrorFileNotFound;
1339 }
1337 buf_resize(output_buf, 0);1340 buf_resize(output_buf, 0);
1338 buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10));1341 buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10));
1339 switch (platform_type) {1342 switch (platform_type) {