skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
2.66k stars 185 forks source link

cc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory #110

Open clillianhong opened 4 months ago

clillianhong commented 4 months ago

Attempting to build with 'make' fails with:

I ccache not found. Consider installing it for faster compilation.
I llama.cpp build info:
I UNAME_S:   Windows_NT
I UNAME_P:   unknown
I UNAME_M:   x86_64
I CFLAGS:    -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602  -std=c11   -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -march=native -mtune=native -Xassembler -muse-unaligned-vector-move -Wdouble-promotion
I CXXFLAGS:  -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602  -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move  -march=native -mtune=native -Wno-array-bounds -Wno-format-truncation -Wextra-semi
I NVCCFLAGS: -O3
I LDFLAGS:
I CC:        cc (GCC) 13.2.0
I CXX:       g++ (GCC) 13.2.0

cc  -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602  -std=c11   -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -march=native -mtune=native -Xassembler -muse-unaligned-vector-move -Wdouble-promotion    -c ggml.c -o ggml.o
cc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make: *** [Makefile:588: ggml.o] Error 1

I've attempted to resolve this by disabling Windows Defender.

skeeto commented 4 months ago

Maybe your w64devkit zip didn't unpack fully or correctly. Or perhaps you've got one or more environment variables interfering with GCC. Or you're picking up the wrong GCC, though the version number is correct. Check that cc1.exe is present. You can find it deep under libexec, and 22.8M in size. A test that eliminates the environment as a factor:

$ env - PATH="$W64DEVKIT_HOME/bin" cc -S -xc -o - - <nul

That exercises just cc1 and should print three assembly directives without errors. If that works then check your environment variables for anything funny.

EliasVincent commented 3 weeks ago

I've had the same issue. Windows Defender identified w64devkit as malware and probably messed with some things there as a result, even when allowing it.

I disabled Windows Defender and unzipped the release using 7zip instead of Windows Explorer, then it worked fine.

skeeto commented 3 weeks ago

unzipped the release using 7zip

Thanks for that detail. It's significant, and I should suggest it myself in the future. Browser-downloaded files get a "Mark of the Web" in their metadata. Windows' built-in unzip program propagates it to files extracted from a marked archive, and files with the mark are treated with extreme prejudice. However, 7zip does not do this by default (and didn't support it at all until very recently). In general, unpacking zip files with a third-party tool — including busybox-w32 unzip — reliably clear the MotW.

This is an additional reason for me to consider distributing w64devkit as a self-extracting archive (#87). Besides avoiding the bugs (#58) and poor performance of Windows' built-in zip tool, it would resolve MotW issues, reducing the problem to a single "suspicious" binary, the self-extractor itself, which would be feasible to mitigate with SignTool or osslsigncode. Well-built self-extractors are still valid archives, and wouldn't require running the self-extractor itself just to access the contents.

https://en.wikipedia.org/wiki/Mark_of_the_Web