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

build stablediffusion on MacOS, failed with error ld: library 'gomp' not found #1220

Open
tao2hang opened this issue Oct 26, 2023 · 1 comment
Assignees
Labels
area/build bug Something isn't working os/macOS

Comments

@tao2hang
Copy link

tao2hang commented Oct 26, 2023

LocalAI version:
at * f227e91 (origin/master, origin/HEAD) feat(llama.cpp): Bump llama.cpp, adapt grpc server (#1211)

Environment, CPU architecture, OS, and Version:
Mac Studio M2 Ultra

Describe the bug
run command

make GO_TAGS=stablediffusion BUILD_TYPE=metal build    

failed with error message as

# github.com/go-skynet/LocalAI/cmd/grpc/stablediffusion
/opt/homebrew/Cellar/go/1.21.3/libexec/pkg/tool/darwin_arm64/link: running c++ failed: exit status 1
ld: warning: ignoring duplicate libraries: '-lc++', '-lcblas'
ld: library 'gomp' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To Reproduce

 brew install opencv
 brew install ncnn
 brew install protobuf libomp

Expected behavior
No errors?

Logs

% make GO_TAGS=stablediffusion BUILD_TYPE=metal build              
go mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang=/Volumes/T4/Projects/LocalAI/gpt4all/gpt4all-bindings/golang
go mod edit -replace github.com/go-skynet/go-ggml-transformers.cpp=/Volumes/T4/Projects/LocalAI/go-ggml-transformers
go mod edit -replace github.com/donomii/go-rwkv.cpp=/Volumes/T4/Projects/LocalAI/go-rwkv
go mod edit -replace github.com/ggerganov/whisper.cpp=/Volumes/T4/Projects/LocalAI/whisper.cpp
go mod edit -replace github.com/go-skynet/go-bert.cpp=/Volumes/T4/Projects/LocalAI/go-bert
go mod edit -replace github.com/go-skynet/bloomz.cpp=/Volumes/T4/Projects/LocalAI/bloomz
go mod edit -replace github.com/mudler/go-stable-diffusion=/Volumes/T4/Projects/LocalAI/go-stable-diffusion
go mod edit -replace github.com/mudler/go-piper=/Volumes/T4/Projects/LocalAI/go-piper
go mod edit -replace github.com/mudler/go-ggllm.cpp=/Volumes/T4/Projects/LocalAI/go-ggllm
go mod download
touch prepare
if [ ! -f backend-assets/grpc/stablediffusion ]; then \
		/Applications/Xcode.app/Contents/Developer/usr/bin/make go-stable-diffusion/libstablediffusion.a; \
		CGO_LDFLAGS=" -lcblas -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders" C_INCLUDE_PATH=/Volumes/T4/Projects/LocalAI/go-stable-diffusion/ LIBRARY_PATH=/Volumes/T4/Projects/LocalAI/go-stable-diffusion/ \
		go build -ldflags " -X "github.com/go-skynet/LocalAI/internal.Version=v1.30.0-53-g88dbe16" -X "github.com/go-skynet/LocalAI/internal.Commit=88dbe16c25ae893f6f6442cde0d6aaabb58676f3"" -tags "stablediffusion" -o backend-assets/grpc/stablediffusion ./cmd/grpc/stablediffusion/; \
	fi
make[1]: `go-stable-diffusion/libstablediffusion.a' is up to date.
# github.com/mudler/go-stable-diffusion
In file included from stablediffusion.cpp:14:
go-stable-diffusion/stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo/diffusion_slover.cpp:283:35: warning: format specifies type 'int' but the argument has type 'size_type' (aka 'unsigned long') [-Wformat]
go-stable-diffusion/stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo/diffusion_slover.cpp:420:33: warning: format specifies type 'int' but the argument has type 'size_type' (aka 'unsigned long') [-Wformat]
# github.com/go-skynet/LocalAI/cmd/grpc/stablediffusion
/opt/homebrew/Cellar/go/1.21.3/libexec/pkg/tool/darwin_arm64/link: running c++ failed: exit status 1
ld: warning: ignoring duplicate libraries: '-lc++', '-lcblas'
ld: library 'gomp' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [backend-assets/grpc/stablediffusion] Error 1

Additional context

@tao2hang tao2hang added the bug Something isn't working label Oct 26, 2023
@Aisuko
Copy link
Collaborator

Aisuko commented Nov 8, 2023

Please kindly check #1197 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build bug Something isn't working os/macOS
Projects
None yet
Development

No branches or pull requests

3 participants