ggml icon indicating copy to clipboard operation
ggml copied to clipboard

It won't build on Windows

Open peter-ch opened this issue 2 years ago • 5 comments

I keep getting this error, nothing builds:

6>C:\Users\spook\Dropbox\Desktop\ggml\examples\gpt-j\main.cpp(15,10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory 5>C:\Users\spook\Dropbox\Desktop\ggml\examples\stablelm\main.cpp(15,10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory 8>C:\Users\spook\Dropbox\Desktop\ggml\examples\dolly-v2\main.cpp(15,10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory 8>Done building project "dollyv2.vcxproj" -- FAILED. 6>Done building project "gpt-j.vcxproj" -- FAILED. 7>C:\Users\spook\Dropbox\Desktop\ggml\examples\gpt-2\main.cpp(15,10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory 5>Done building project "stablelm.vcxproj" -- FAILED. 7>Done building project "gpt-2.vcxproj" -- FAILED.

peter-ch avatar May 08 '23 12:05 peter-ch

I noticed that yesterday .... is able to build almost all binaries except those :-/

mirek190 avatar May 14 '23 15:05 mirek190

had same errors for starcoder, you need to make 4 changes in examples\starcoder\main.cpp to compile: 15: #include <io.h> (instead of #include <unistd.h>) 204: struct ggml_init_params params = { ctx_size, NULL, false }; instead of: struct ggml_init_params params = { .mem_size = ctx_size, .mem_buffer = NULL, .no_alloc = false, }; 430: struct ggml_init_params params = { buf_size, buf, false }; instead of: struct ggml_init_params params = { .mem_size = buf_size, .mem_buffer = buf, .no_alloc = false, }; 724: if( !isatty(_fileno(stdin)) ){ instead of: if( !isatty(STDIN_FILENO) ){

ukiyocode avatar May 15 '23 22:05 ukiyocode

scratch that i'm not getting any output from it so that 724 line is probably wrong

ukiyocode avatar May 15 '23 22:05 ukiyocode

@ukiyocode Your solution is correct, but you also need to call ggml_time_init(); at the beginning of the main(). I think it's specific to MSVC/MINGW compilers for whatever reason (check ggml.c:403).

eublefar avatar May 20 '23 11:05 eublefar

@eublefar Thx, it works now. Someone already added your line to the repo, so all you have to do now is the 4 changes i mentioned b4.

ukiyocode avatar May 20 '23 19:05 ukiyocode