mudler / LocalAI

:robot: The free, Open Source alternative to OpenAI, Claude and others. Self-hosted and local-first. Drop-in replacement for OpenAI, running on consumer-grade hardware. No GPU required. Runs gguf, transformers, diffusers and many more models architectures. Features: Generate Text, Audio, Video, Images, Voice Cloning, Distributed inference
https://localai.io
MIT License
22.72k stars 1.73k forks source link

Not building on windows locally #897

Open bartanderson opened 1 year ago

bartanderson commented 1 year ago

LocalAI version:

895

Environment, CPU architecture, OS, and Version:

sh-5.2$ uname -a MSYS_NT-10.0-19045 DESKTOP-S7HQITA 3.4.7-ea781829.x86_64 2023-07-05 12:05 UTC x86_64 Msys

Describe the bug

not building completely on windows

To Reproduce

cd to localai sh make build

Expected behavior

builds successfully

Logs

Initially I had some problems with the makefile not being able to access pwd I replaced $(shell pwd) with "." and got past that

then ran into this -- sh-5.2$ make build touch get-sources go mod edit -replace github.com/go-skynet/go-llama.cpp=./go-llama go mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang=./gpt4all/gpt4all-bindings/golang go mod edit -replace github.com/go-skynet/go-ggml-transformers.cpp=./go-ggml-transformers go mod edit -replace github.com/donomii/go-rwkv.cpp=./go-rwkv go mod edit -replace github.com/ggerganov/whisper.cpp=./whisper.cpp go mod edit -replace github.com/go-skynet/go-bert.cpp=./go-bert go mod edit -replace github.com/go-skynet/bloomz.cpp=./bloomz go mod edit -replace github.com/mudler/go-stable-diffusion=./go-stable-diffusion go mod edit -replace github.com/mudler/go-piper=./go-piper go mod edit -replace github.com/mudler/go-ggllm.cpp=./go-ggllm go mod download touch prepare D:/Downloads/w64devkit-1.20.0/w64devkit/bin/make.exe -C go-ggml-transformers BUILD_TYPE= libtransformers.a make[1]: Entering directory 'D:/Github/LocalAI/go-ggml-transformers' I libtransformers build info: I UNAME_S: MSYS_NT-10.0-19045 I UNAME_P: unknown I UNAME_M: x86_64 I CFLAGS: -I. -I./ggml.cpp/include -I./ggml.cpp/include/ggml/ -I./ggml.cpp/examples/ -I -O3 -DNDEBUG -std=c11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function -march=native -mtune=native I CXXFLAGS: -I. -I./ggml.cpp/include -I./ggml.cpp/include/ggml/ -I./ggml.cpp/examples/ -O3 -DNDEBUG -std=c++17 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -march=native -mtune=native I LDFLAGS: I CMAKE_ARGS: I CC: cc (GCC) 13.2.0 I CXX: g++.exe (GCC) 13.2.0

Access denied - ./GGML.CPP/EXAMPLES/DOLLY-V2 File not found - -TYPE File not found - F File not found - -NAME

---------- DOLLY.CPP

---------- FALCON.CPP Access denied - GGML.CPP

---------- GPT2.CPP

---------- GPTJ.CPP

---------- GPTNEOX.CPP

---------- MPT.CPP

---------- REPLIT.CPP

---------- STARCODER.CPP File not found - -EXEC File not found - SED File not found - -I File not found - -E File not found - {} File not found - + make[1]: [Makefile:197: prepare] Error 1 make[1]: Leaving directory 'D:/Github/LocalAI/go-ggml-transformers' make: [Makefile:184: go-ggml-transformers/libtransformers.a] Error 2

Then I was still having issues

This may be related to existing problem for gglm but after finding error I used this to try to get more information about it sh-5.2$ make -C go-ggllm libggllm.a make: Entering directory 'D:/Github/LocalAI/go-ggllm' I ggllm.cpp build info: I UNAME_S: MSYS_NT-10.0-19045 I UNAME_P: unknown I UNAME_M: x86_64 I CFLAGS: -I./ggllm.cpp -I. -O3 -DNDEBUG -std=c11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function -march=native -mtune=native I CXXFLAGS: -I./ggllm.cpp -I. -I./ggllm.cpp/examples -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function I CGO_LDFLAGS: I LDFLAGS: I BUILD_TYPE: I CMAKE_ARGS: I EXTRA_TARGETS: I CC: cc (GCC) 13.2.0 I CXX: g++.exe (GCC) 13.2.0

cd ggllm.cpp && patch -p1 < ../patches/1902-cuda.patch (Stripping trailing CRs from patch; use --binary to disable.) patching file examples/falcon_common.cpp (Stripping trailing CRs from patch; use --binary to disable.) patching file libfalcon.cpp (Stripping trailing CRs from patch; use --binary to disable.) patching file libfalcon.h touch prepare mkdir -p build cd build && cmake ../ggllm.cpp && VERBOSE=1 cmake --build . --config Release && cp -rf CMakeFiles/ggml.dir/ggml.c.o ../ggllm.cpp/ggml.o -- Building for: MinGW Makefiles -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is GNU 13.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Downloads/w64devkit-1.20.0/w64devkit/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Downloads/w64devkit-1.20.0/w64devkit/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.41.0.windows.3") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/include (found version "11.7.64") -- cuBLAS found CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeDetermineCompilerId.cmake:751 (message): Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.

Compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/bin/nvcc.exe

Build flags:

Id flags: --keep;--keep-dir;tmp -v

The output was:

1

nvcc fatal : Cannot find compiler 'cl.exe' in PATH

Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD) C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test) C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID) CMakeLists.txt:243 (enable_language)

-- Configuring incomplete, errors occurred! make: * [Makefile:181: ggllm.cpp/ggml.o] Error 1 make: Leaving directory 'D:/Github/LocalAI/go-ggllm' Additional context**

I was encouraged to write this after seeing build issue for earlier version of cmake and used his example to try building run w64devkit ( I used sh because thats how you get the shell and then I did the following except I used set to get them to be set in the the environment) I tried setting BUILD_TYPE but that didn't seem to make a difference, so I removed it

export CMAKE_GENERATOR="MinGW Makefiles" export CMAKE_C_OUTPUT_EXTENSION=".o" export CMAKE_CXX_OUTPUT_EXTENSION=".o" export OBJCFLAGS="-c -o" export OBJCXXFLAGS="-c -o"

Configure make to use .o suffix for object files export OBJECTS_SUFFIXES=.o export OBJECTS=.o

localai-bot commented 1 year ago

:warning::warning::warning::warning::warning:

Hi! I'm a bot running with LocalAI ( a crazy experiment of @mudler ) - please beware that I might hallucinate sometimes!

_but.... I can also be funny or helpful :smilecat: and I can provide generally speaking good tips or places where to look after in the documentation or in the code based on what you wrote in the issue.

Don't engage in conversation with me, I don't support (yet) replying!

:warning::warning::warning::warning::warning:

Sources: