Build fails on m1 mbp: CoreFoundation not found
LocalAI version: 63e1f8fffd506cd156e60b65359446536e4c3e41
Environment, CPU architecture, OS, and Version: M1 MBP 16gb, arm, MacOS Sonoma 14.0
Describe the bug
Go dependency github.com/shoenig/go-m1cpu fails to find CoreFoundation framework
To Reproduce make GO_TAGS=stablediffusion BUILD_TYPE=metal build
Expected behavior actually builds
Logs
go mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang=/Users/grimerssy/Development/LocalAI/sources/gpt4all/gpt4all-bindings/golang
go mod edit -replace github.com/go-skynet/go-ggml-transformers.cpp=/Users/grimerssy/Development/LocalAI/sources/go-ggml-transformers
go mod edit -replace github.com/donomii/go-rwkv.cpp=/Users/grimerssy/Development/LocalAI/sources/go-rwkv
go mod edit -replace github.com/ggerganov/whisper.cpp=/Users/grimerssy/Development/LocalAI/sources/whisper.cpp
go mod edit -replace github.com/go-skynet/go-bert.cpp=/Users/grimerssy/Development/LocalAI/sources/go-bert
go mod edit -replace github.com/mudler/go-stable-diffusion=/Users/grimerssy/Development/LocalAI/sources/go-stable-diffusion
go mod edit -replace github.com/mudler/go-piper=/Users/grimerssy/Development/LocalAI/sources/go-piper
go mod download
touch prepare-sources
touch prepare
go build -ldflags "-X "github.com/go-skynet/LocalAI/internal.Version=v1.40.0-57-g63e1f8f" -X "github.com/go-skynet/LocalAI/internal.Commit=63e1f8fffd506cd156e60b65359446536e4c3e41"" -tags "stablediffusion" -o backend-assets/grpc/langchain-huggingface ./backend/go/llm/langchain/
# github.com/shoenig/go-m1cpu
../../.go/pkg/mod/github.com/shoenig/[email protected]/cpu.go:7:11: fatal error: 'CoreFoundation/CoreFoundation.h' file not found
#include <CoreFoundation/CoreFoundation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:498: backend-assets/grpc/langchain-huggingface] Error 1
Additional context
I have run xcode-select --install;
/System/Library/Frameworks/CoreFoundation.framework/ is present;
I am also using a nix flake, which is local to this repo and I tried Installing CoreFoundation with it too:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in {
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [ abseil-cpp cmake go grpc protobuf wget ];
buildInputs = [ ];
nativeBuildInputs = with pkgs; [ ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ CoreFoundation Security ]);
};
});
}
: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 :smile_cat: 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:
ERROR: The prompt size exceeds the context window size and cannot be processed.
Sources:
- https://github.com/go-skynet/LocalAI/tree/master/go.sum
- https://github.com/go-skynet/LocalAI/tree/master/go.mod
- https://github.com/go-skynet/LocalAI/tree/master/Makefile
- https://github.com/go-skynet/LocalAI/tree/master/CONTRIBUTING.md
CoreFoundation/CoreFoundation.h' file not found
check this link: https://github.com/rstudio/httpuv/issues/186#issuecomment-526307758
maybe clang version is not correct.
maybe clang version is not correct.
Unfortunately, which -a clang outputs only one path.
I tried to install libclang with nix, and now the error is different
go build -ldflags "-X "github.com/go-skynet/LocalAI/internal.Version=v1.40.0-57-g63e1f8f" -X "github.com/go-skynet/LocalAI/internal.Commit=63e1f8fffd506cd156e60b65359446536e4c3e41"" -tags "" -o backend-assets/grpc/langchain-huggingface ./backend/go/llm/langchain/
# runtime/cgo
cgo-builtin-prolog:1:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
^~~~~~~~~~
1 error generated.
make: *** [Makefile:498: backend-assets/grpc/langchain-huggingface] Error 1
Thank you for an idea. I will dig into the new error when I have time and post updates here if any
@grimerssy I'd also love to use a nix flake. The clang 16 version installed from the nix cmake package causes a linking error and I haven't been able to get very far.
I can get much further with the homebrew dependencies in the docs.
There is LocalAI nix package request worth monitoring https://github.com/NixOS/nixpkgs/issues/269582
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.