Skip to content

[Bug] Please consider renaming or inlining std::string format(const char* fmt, ...) in util.cpp, as it conflicts with llama.cpp def #1011

@n-k

Description

@n-k

Git commit

28ffb6c

Operating System & Version

Ubuntu 24.04

GGML backends

Vulkan

Command-line arguments used

cmake --build build -j

Steps to reproduce

Create a cmake project with both llama.cpp and stable-diffusion.cpp (latest versions) and try to compile.

What you expected to happen

I have a project which includes both llama.cpp and stable-diffusion.cpp , but it fails to link because both libs declare a format function. Locally, I can fix it if I inline the format function.

What actually happened

[build] /usr/bin/ld: libs/stable-diffusion.cpp/libstable-diffusion.a(util.cpp.o): in function format[abi:cxx11](char const*, ...)': [build] ... snipped ..../libs/stable-diffusion.cpp/util.cpp:60: multiple definition of format[abi:cxx11](char const*, ...)'; libs/llama.cpp/src/libllama.a(llama-impl.cpp.o): ... snipped ..../libs/llama.cpp/src/llama-impl.cpp:82: first defined here
[build] collect2: error: ld returned 1 exit status

Logs / error messages / stack trace

No response

Additional context / environment details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions