authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-01-23 21:56:53-05:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-01-23 21:59:28-05:00
logb54040d394830b847a7d64babac23f29fda8d47c
tree1e7b02d54460e79cffa71b7f97042f543e5ff3ac
parent357f42da6c2f158fff2afa28a56b7e0e7a8a5963
signature Commit is signed but in an unrecognized format.

stage1: make sure to create native_libc.txt dir

- fix regression from #4186

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

src/codegen.cpp+4-1
...@@ -8996,7 +8996,10 @@ static void detect_libc(CodeGen *g) {...@@ -8996,7 +8996,10 @@ static void detect_libc(CodeGen *g) {
8996 "See `zig libc --help` for more details.\n", err_str(err));8996 "See `zig libc --help` for more details.\n", err_str(err));
8997 exit(1);8997 exit(1);
8998 }8998 }
8999 if ((err = os_make_path(g->cache_dir))) {8999 Buf libc_txt_dir = BUF_INIT;
9000 os_path_dirname(libc_txt, &libc_txt_dir);
9001 buf_deinit(&libc_txt_dir);
9002 if ((err = os_make_path(&libc_txt_dir))) {
9000 fprintf(stderr, "Unable to create %s directory: %s\n",9003 fprintf(stderr, "Unable to create %s directory: %s\n",
9001 buf_ptr(g->cache_dir), err_str(err));9004 buf_ptr(g->cache_dir), err_str(err));
9002 exit(1);9005 exit(1);
src/main.cpp+5-5
...@@ -141,15 +141,15 @@ static int print_libc_usage(const char *arg0, FILE *file, int return_code) {...@@ -141,15 +141,15 @@ static int print_libc_usage(const char *arg0, FILE *file, int return_code) {
141 "You can save this into a file and then edit the paths to create a cross\n"141 "You can save this into a file and then edit the paths to create a cross\n"
142 "compilation libc kit. Then you can pass `--libc [file]` for Zig to use it.\n"142 "compilation libc kit. Then you can pass `--libc [file]` for Zig to use it.\n"
143 "\n"143 "\n"
144 "When compiling natively and no `--libc` argument provided, Zig automatically\n"144 "When compiling natively and no `--libc` argument provided, Zig will create\n"
145 "creates zig-cache/native_libc.txt so that it does not have to detect libc\n"145 "`%s/native_libc.txt`\n"
146 "on every invocation. You can remove this file to have Zig re-detect the\n"146 "so that it does not have to detect libc on every invocation. You can remove\n"
147 "native libc.\n"147 "this file to have Zig re-detect the native libc.\n"
148 "\n\n"148 "\n\n"
149 "Usage: %s libc [file]\n"149 "Usage: %s libc [file]\n"
150 "\n"150 "\n"
151 "Parse a libc installation text file and validate it.\n"151 "Parse a libc installation text file and validate it.\n"
152 , arg0, arg0);152 , arg0, buf_ptr(get_global_cache_dir()), arg0);
153 return return_code;153 return return_code;
154}154}
155155