Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Git commit
VER= master-650-1ceb5bd
### Operating System & Version
AOSC OS (LINUX)
### GGML backends
CPU
### Command-line arguments used
'-DSD_BUILD_EXAMPLES=ON' '-DSD_BUILD_SHARED_LIBS=ON' '-DSD_USE_SYSTEM_GGML=ON' '-DCMAKE_CXX_FLAGS=-DGGML_MAX_NAME=128'
### Steps to reproduce
Defines:
PKGNAME=stable-diffusion.cpp
PKGSEC=misc
PKGDEP="gcc-runtime glibc ggml"
PKGDES="Diffusion models inference in pure C/C++"
CMAKE_AFTER=(
'-DSD_BUILD_EXAMPLES=ON'
'-DSD_BUILD_SHARED_LIBS=ON'
'-DSD_USE_SYSTEM_GGML=ON'
'-DCMAKE_CXX_FLAGS=-DGGML_MAX_NAME=128'
)
LOG:
[177/179] : && /usr/bin/g++ -DGGML_MAX_NAME=128 -O2 -g -DNDEBUG -Wl,-O1,--sort-common,--as-needed -Wl,-build-id=sha1 -Wl,-z,relro -Wl,-z,now -flto -fuse-linker-plugin -Wl,-z,pack-relative-relocs -Wl,--dependency-file=examples/server/CMakeFiles/sd-server.dir/link.d examples/server/CMakeFiles/sd-server.dir/__/common/common.cpp.o examples/server/CMakeFiles/sd-server.dir/__/common/log.cpp.o examples/server/CMakeFiles/sd-server.dir/__/common/media_io.cpp.o examples/server/CMakeFiles/sd-server.dir/main.cpp.o examples/server/CMakeFiles/sd-server.dir/runtime.cpp.o examples/server/CMakeFiles/sd-server.dir/async_jobs.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_index.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_openai.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_sdapi.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_sdcpp.cpp.o -o bin/sd-server -Wl,-rpath,/var/cache/acbs/build/acbs.2wo22qjl/stable-diffusion.cpp/abbuild/bin: bin/libstable-diffusion.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libwebpmux.a thirdparty/libwebm/libwebm.a /usr/lib/libggml.so /usr/lib/libggml-base.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libsharpyuv.a -lm && :
FAILED: [code=1] bin/sd-server
: && /usr/bin/g++ -DGGML_MAX_NAME=128 -O2 -g -DNDEBUG -Wl,-O1,--sort-common,--as-needed -Wl,-build-id=sha1 -Wl,-z,relro -Wl,-z,now -flto -fuse-linker-plugin -Wl,-z,pack-relative-relocs -Wl,--dependency-file=examples/server/CMakeFiles/sd-server.dir/link.d examples/server/CMakeFiles/sd-server.dir/__/common/common.cpp.o examples/server/CMakeFiles/sd-server.dir/__/common/log.cpp.o examples/server/CMakeFiles/sd-server.dir/__/common/media_io.cpp.o examples/server/CMakeFiles/sd-server.dir/main.cpp.o examples/server/CMakeFiles/sd-server.dir/runtime.cpp.o examples/server/CMakeFiles/sd-server.dir/async_jobs.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_index.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_openai.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_sdapi.cpp.o examples/server/CMakeFiles/sd-server.dir/routes_sdcpp.cpp.o -o bin/sd-server -Wl,-rpath,/var/cache/acbs/build/acbs.2wo22qjl/stable-diffusion.cpp/abbuild/bin: bin/libstable-diffusion.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libwebpmux.a thirdparty/libwebm/libwebm.a /usr/lib/libggml.so /usr/lib/libggml-base.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libsharpyuv.a -lm && :
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_vsx'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_arm_fma'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx2'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_f16c'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_wasm_simd'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_neon'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_fp16_va'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512_vnni'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_is_cpu'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_sse3'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_cpu_init'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_cpu_set_n_threads'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512_vbmi'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_fma'
collect2: error: ld returned 1 exit status
[178/179] : && /usr/bin/g++ -DGGML_MAX_NAME=128 -O2 -g -DNDEBUG -Wl,-O1,--sort-common,--as-needed -Wl,-build-id=sha1 -Wl,-z,relro -Wl,-z,now -flto -fuse-linker-plugin -Wl,-z,pack-relative-relocs -Wl,--dependency-file=examples/cli/CMakeFiles/sd-cli.dir/link.d thirdparty/CMakeFiles/zip.dir/zip.c.o examples/cli/CMakeFiles/sd-cli.dir/__/common/common.cpp.o examples/cli/CMakeFiles/sd-cli.dir/__/common/log.cpp.o examples/cli/CMakeFiles/sd-cli.dir/__/common/media_io.cpp.o examples/cli/CMakeFiles/sd-cli.dir/image_metadata.cpp.o examples/cli/CMakeFiles/sd-cli.dir/main.cpp.o -o bin/sd-cli -Wl,-rpath,/var/cache/acbs/build/acbs.2wo22qjl/stable-diffusion.cpp/abbuild/bin: bin/libstable-diffusion.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libwebpmux.a thirdparty/libwebm/libwebm.a /usr/lib/libggml.so /usr/lib/libggml-base.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libsharpyuv.a -lm && :
FAILED: [code=1] bin/sd-cli
: && /usr/bin/g++ -DGGML_MAX_NAME=128 -O2 -g -DNDEBUG -Wl,-O1,--sort-common,--as-needed -Wl,-build-id=sha1 -Wl,-z,relro -Wl,-z,now -flto -fuse-linker-plugin -Wl,-z,pack-relative-relocs -Wl,--dependency-file=examples/cli/CMakeFiles/sd-cli.dir/link.d thirdparty/CMakeFiles/zip.dir/zip.c.o examples/cli/CMakeFiles/sd-cli.dir/__/common/common.cpp.o examples/cli/CMakeFiles/sd-cli.dir/__/common/log.cpp.o examples/cli/CMakeFiles/sd-cli.dir/__/common/media_io.cpp.o examples/cli/CMakeFiles/sd-cli.dir/image_metadata.cpp.o examples/cli/CMakeFiles/sd-cli.dir/main.cpp.o -o bin/sd-cli -Wl,-rpath,/var/cache/acbs/build/acbs.2wo22qjl/stable-diffusion.cpp/abbuild/bin: bin/libstable-diffusion.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libwebpmux.a thirdparty/libwebm/libwebm.a /usr/lib/libggml.so /usr/lib/libggml-base.so thirdparty/libwebp/libwebp.a thirdparty/libwebp/libsharpyuv.a -lm && :
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_vsx'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_arm_fma'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx2'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_f16c'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_wasm_simd'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_neon'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_fp16_va'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512_vnni'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_is_cpu'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_sse3'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_cpu_init'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_backend_cpu_set_n_threads'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512_vbmi'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_avx512'
/usr/bin/ld: bin/libstable-diffusion.so: undefined reference to `ggml_cpu_has_fma'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Use system ggml, the ggml defines file:
PKGNAME=ggml
PKGSEC=libs
PKGDEP="gcc-runtime glibc vulkan-loader libcl openblas"
PKGDES="Tensor library for machine learning"
BUILDDEP="vulkan-headers spirv-headers glslang shaderc \
opencl-registry-api openblas lapack"
BUILDDEP__AMD64="${BUILDDEP} cuda"
BUILDDEP__ARM64="${BUILDDEP} cuda"
ABTYPE=cmakeninja
CMAKE_AFTER=(
'-DBUILD_SHARED_LIBS=ON'
'-DGGML_BACKEND_DL=ON'
'-DGGML_BACKEND_DIR=/usr/lib/ggml'
'-DGGML_NATIVE=OFF'
'-DGGML_CPU_REPACK=ON'
'-DGGML_VULKAN=ON'
'-DGGML_OPENCL=ON'
'-DGGML_OPENCL_USE_ADRENO_KERNELS=OFF'
'-DGGML_BLAS=ON'
'-DGGML_BLAS_VENDOR=Generic'
)
CMAKE_AFTER__AMD64=(
"${CMAKE_AFTER[@]}"
'-DGGML_CPU_ALL_VARIANTS=ON'
'-DGGML_CUDA=ON'
)
CMAKE_AFTER__ARM64=(
"${CMAKE_AFTER[@]}"
'-DGGML_CPU_ALL_VARIANTS=ON'
'-DGGML_CUDA=ON'
)
CMAKE_AFTER__LOONGARCH64=(
"${CMAKE_AFTER[@]}"
'-DGGML_LSX=ON'
'-DGGML_LASX=OFF'
)
CMAKE_AFTER__LOONGARCH64_NOSIMD=(
"${CMAKE_AFTER[@]}"
'-DGGML_LSX=OFF'
'-DGGML_LASX=OFF'
)
CMAKE_AFTER__RISCV64=(
"${CMAKE_AFTER[@]}"
'-DGGML_RVV=OFF'
'-DGGML_RV_ZFH=OFF'
'-DGGML_RV_ZVFH=OFF'
'-DGGML_RV_ZICBOP=OFF'
)
CMAKE_AFTER__LOONGSON3=(
"${CMAKE_AFTER[@]}"
)
CMAKE_AFTER__PPC64EL=(
"${CMAKE_AFTER[@]}"
'-DGGML_CPU_ALL_VARIANTS=ON'
)
Please fix: stable diffusion.cpp. I hope to run it using the system ggml, but do not change the ggml configuration on the system
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
wbruna commentedon May 26, 2026
Not directly related to this build issue, but defining
GGML_MAX_NAMElike this unfortunately won't work. If the system ggml was built with another value, it'll keep using another value internally, so some structs will get inconsistent sizes. At best, this will cause random, model-dependent failures when loading GGUF files, but most likely you'll just get segfaults all over the place.ouni666 commentedon May 27, 2026
Thank you for your reply.
These two issues coexist, which plagues me with how to package. Compilation always fails. Both whisper.cpp and llama.cpp use the system ggml. If this were not the case, whisper.cpp, llama.cpp, and stable-diffusion.cpp would all generate the same ggml file in the same directory, which would result in only one of these three programs being installed at a time, otherwise conflicts would occur, and the package manager would refuse to install
wbruna commentedon May 27, 2026
I could reproduce it here by setting
GGML_NATIVE=OFF.Supporting it would need some code changes. The
ggml_cpu_has_*are straightforward, since they are only informative (and the output is useless if we are not assuming native CPU support).ggml_backend_is_cpu',ggml_backend_cpu_init' and `ggml_backend_cpu_set_n_threads' are more involved, but I believe it's possible to avoid calling them directly; I'll try to come up with a patch.About the
GGML_MAX_NAMEissue: I did try to add support for the default value before, but got stuck on ggml's gguf support; without upstream changes, we'd have to basically fork it. So for now, you'd need to ensureGGML_MAX_NAME=128for all cases, including when building the system-installed ggml (I'd recommend patching the installedggml.hheader to force a single value consistently across all builds).