Skip to content
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

Bad file descsriptor in building with make in w64devkit on Windows 11 #107

Open
VIS-WA opened this issue Jan 28, 2024 · 4 comments
Open

Comments

@VIS-WA
Copy link

VIS-WA commented Jan 28, 2024

I was trying to compile llama.cpp on a Windows 11 laptop with the instructions provided here. However, while using make in w64devkit console for building in directories containing spaces in their names, the make command fails with the following error:

Z:/Lab Work/llama.cpp $ make
process_begin: CreateProcess(C:\Users\Asus, C:/Users/Asus pc/Downloads/w64devkit-fortran-1.21.0/w64devkit/bin/sh.exe -c "cc  -Wl,-v 2>&1", ...) failed.
Makefile:206: pipe: Bad file descriptor
process_begin: CreateProcess(C:\Users\Asus, C:/Users/Asus pc/Downloads/w64devkit-fortran-1.21.0/w64devkit/bin/sh.exe -c "{ cc -dumpfullversion 2>/dev/null || cc -dumpversion; } | awk -F. '{ printf(\"%02d%02d%02d\", $1, $2, $3) }'", ...) failed.
scripts/get-flags.mk:3: pipe: Bad file descriptor
expr: syntax error
expr: syntax error
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
I NVCCFLAGS:
I LDFLAGS:
process_begin: CreateProcess(C:\Users\Asus, C:/Users/Asus pc/Downloads/w64devkit-fortran-1.21.0/w64devkit/bin/sh.exe -c "cc --version | head -n 1", ...) failed.
Makefile:530: pipe: No error
I CC:
process_begin: CreateProcess(C:\Users\Asus, C:/Users/Asus pc/Downloads/w64devkit-fortran-1.21.0/w64devkit/bin/sh.exe -c "g++ --version | head -n 1", ...) failed.
Makefile:531: pipe: No error
I CXX:

g++ -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 examples/main/main.cpp ggml.o llama.o common.o sampling.o grammar-parser.o build-info.o console.o ggml-alloc.o ggml-backend.o ggml-quants.o -o main
make: *** [Makefile:584: main] Error 3

In the above, the folders where w64devkit and the llama.cpp are located are different, and both the directory locations have spaces (i.e Z:/Lab Work/llama.cpp and C:/Users/Asus pc/Downloads). I was able to build succesfully by placing the files in different folders named without spaces; however, I feel the need to support spaces in directory names is essential for a more flexible workflow.

I am raising this as an issue on both the repos (llama.cpp and wdevkit64) to both notify other users and the repo maintainers. Apologies for any typos.

Thanks

@grable0
Copy link

grable0 commented Jan 28, 2024

This is actually a known CreateProcess limitation, paths with spaces needs to be quoted.

@skeeto
Copy link
Owner

skeeto commented Jan 28, 2024 via email

@VIS-WA
Copy link
Author

VIS-WA commented Jan 29, 2024

Can you suggest a way to log things better for debugging and reproducing the issue? Also there's no path as C:/Users/Asus on my system (so probably space is considered as a delimiter).

@NeoZhangJianyu
Copy link

@VIS-WA Could you try 1.19.0 version.
It's working well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants