Skip to content

removed stdc++fs #3097

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

Merged
merged 2 commits into from
May 2, 2025
Merged

removed stdc++fs #3097

merged 2 commits into from
May 2, 2025

Conversation

JaredTweed
Copy link
Contributor

Why drop -lstdc++fs from whisper.cpp’s CMakeLists?

  1. The extra library vanished from modern GCC – beginning with GCC 13 the standalone libstdc++fs archive was removed; the symbols are now built into the normal C++ runtime, so the linker flag causes hard failures on any tool-chain ≥ 13 ( /usr/bin/ld: cannot find -lstdc++fs ).

  2. C++17 made it obsolete – since GCC 9, std::filesystem is a fully-standard header in <filesystem> and no longer lives in <experimental/filesystem>, so no explicit link option is required.

  3. Keeping the flag blocks Flatpak and cross-arch builds – many Flatpak runners (e.g. GNOME 48) already ship GCC 14; the flag currently breaks both x86-64 and aarch64 sandbox builds of whisper.cpp.

  4. Upstream consensus – other OSS projects (LLVM, CMake, Dolphin Emu, etc.) have removed the flag for exactly the same reason.

  5. No functional downside – when using older GCC (< 9) the flag is still unnecessary because those versions fall back to the static archive automatically when std::filesystem symbols are unresolved.

@ggerganov
Copy link
Member

The flag was added in ggml-org/llama.cpp#12094

cc @ericcurtin We should recommend to upgrade the compiler when the issue appears again.

Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have to keep dl:

target_link_libraries(ggml PRIVATE dl)

@ericcurtin
Copy link
Contributor

@hbuxiaofei does this work for you?

Maybe you can put in a little conditional to add the flag for your centos8 case

I wouldn't block on @hbuxiaofei responding, we should favour the newest distros, centos8 is a bit long in the tooth for llama.cpp

@ericcurtin
Copy link
Contributor

Maybe the centos8 solution is upgrade the compiler like @ggerganov says, I think you can do that by installing one of the Developer Toolsets

@ericcurtin
Copy link
Contributor

Ignore my approval, need the dl

@danielzgtg
Copy link
Contributor

hard failures on any tool-chain ≥ 13 ( /usr/bin/ld: cannot find -lstdc++fs ).
Keeping the flag blocks Flatpak

Can you provide logs and the exact steps to get the error? It links fine on g++ (Ubuntu 14.2.0-4ubuntu2) 14.2.0 / -- The CXX compiler identification is GNU 14.2.0, which is "≥ 13".

The linker command used is:

$ cd build; rg 'stdc\+\+fs'
ggml/src/CMakeFiles/ggml.dir/link.txt
1:/usr/bin/c++ -fPIC -O3 -DNDEBUG -shared -Wl,-soname,libggml.so -o libggml.so "CMakeFiles/ggml.dir/ggml-backend-reg.cpp.o"  -Wl,-rpath,/home/home/CLionProjects/whisper.cpp/build/ggml/src: -ldl -lstdc++fs libggml-cpu.so libggml-base.so

Aside from the lack of logs, I'm not opposed to this change as the build still succeeds with it.

@JaredTweed JaredTweed closed this May 1, 2025
@JaredTweed JaredTweed reopened this May 1, 2025
@JaredTweed
Copy link
Contributor Author

Ignore my approval, need the dl

Great, I just added the dl.

@JaredTweed JaredTweed requested a review from ericcurtin May 1, 2025 17:18
@ggerganov ggerganov merged commit 9f540ad into ggml-org:master May 2, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants