Skip to content

Compile bug: Built target undefined reference std::filesystem #14536

Open
@osabc

Description

@osabc

Git commit

ef797db

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

llama.cpp and whisper.cpp build
cmake -B build fix

    if (TARGET ggml)
        if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
            target_link_libraries(ggml PRIVATE stdc++fs)
        elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
            target_link_libraries(ggml PRIVATE c++fs)
        endif()
    endif()

First Bad Commit

No response

Compile command

cmake -B build
cmake --build build -j --config Release

Relevant log output

../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::path::_M_find_extension() const'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::path::has_root_directory() const'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::current_path[abi:cxx11]()'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*)'
../../ggml/src/libggml.so: undefined reference to `std::filesystem::__cxx11::path::has_filename() const'
collect2: error: ld returned 1 exit status
gmake[2]: *** [examples/bench/CMakeFiles/whisper-bench.dir/build.make:101: bin/whisper-bench] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1284: examples/bench/CMakeFiles/whisper-bench.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 76%] Linking CXX static library libcommon.a
[ 76%] Built target common
gmake: *** [Makefile:146: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions