Skip to content

[Bug] Build failure on Fedora 44 (GCC 16) #1475

@cphlipot

Description

@cphlipot

Git commit

$ git rev-parse HEAD
3d6064b

Operating System & Version

Fedora 44

GGML backends

Vulkan

Command-line arguments used

N/A (project did not build)

Steps to reproduce

attempt build on Fedora 44 using instructions in build.md

mkdir build && cd build
cmake .. -DSD_VULKAN=ON
cmake --build . --config Release

What you expected to happen

project gets built successfully.

What actually happened

build failed

Logs / error messages / stack trace

error: no match for 'operator=' (operand types are 'std::string' and 'std::u8string')
  267 | lora_entry.name = p.stem().u8string();

Additional context / environment details

Fedora 44 Ships with GCC 16. GCC 16 will compile projects with C++20 by default unless the project overides the behavior which stable-diffusion.cpp does not.

https://gcc.gnu.org/gcc-16/changes.html#cxx

C++20 by default: GCC 16 changes the default language version for C++ compilation from -std=gnu++17 to -std=gnu++20.

in C++20 it does not allow direct assignment from std::u8string to std::string, which stable diffusion cpp currently does and results in compiler errors.

potential fixes include:

  1. use std::string instead of u8string
  2. convert project to use u8string instead of std::string
  3. compile with --std=c++17 to get old compiler behavior with the newer GCC so we don't need to change the source code.

see also https://stackoverflow.com/questions/56833000/c20-with-u8-char8-t-and-stdstring

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