Skip to content

Compile bug: Fails to compile with undefined references in libggml.so #11562

Closed
@sjwhitak

Description

@sjwhitak

Git commit

Tag b4607

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

I'm using RHEL8.10.
cmake 3.26.5
make 4.2.1
gmake 4.2.1.

I am trying to compile with no compile flags to execute on the CPU. This used to work when running make to build llama.cpp, but I am not smart enough to find which commit that occurred at before running a git pull to update llama.cpp, sorry. Please let me know of other logs required. When executing cd build/; make -d, and ltrace and strace, I wasn't able find additional info that seemed useful, but I can dump that if need be.

First Bad Commit

No response

Compile command

cmake -B build -DGGML_CCACHE=OFF
cmake --build build --config Release

Relevant log output

cmake -B build -DGGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- Including CPU backend
-- x86 detected
-- Adding CPU backend variant ggml-cpu: -march=native 
-- Configuring done (0.8s)
-- Generating done (9.8s)
-- Build files have been written to: /home/steven/code/llama.cpp/build




cmake --build build --config Release
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- Including CPU backend
-- x86 detected
-- Adding CPU backend variant ggml-cpu: -march=native 
-- Configuring done (0.8s)
-- Generating done (10.7s)
-- Build files have been written to: /home/steven/code/llama.cpp/build
~/projects/LLM/llama.cpp$ cmake --build build --config Release
[  4%] Built target ggml-base
[  9%] Built target ggml-cpu
[ 10%] Built target ggml
[ 11%] Building CXX object src/CMakeFiles/llama.dir/llama.cpp.o
[ 11%] Building CXX object src/CMakeFiles/llama.dir/llama-adapter.cpp.o
[ 11%] Building CXX object src/CMakeFiles/llama.dir/llama-batch.cpp.o
[ 12%] Building CXX object src/CMakeFiles/llama.dir/llama-chat.cpp.o
[ 12%] Building CXX object src/CMakeFiles/llama.dir/llama-context.cpp.o
[ 13%] Building CXX object src/CMakeFiles/llama.dir/llama-grammar.cpp.o
[ 13%] Building CXX object src/CMakeFiles/llama.dir/llama-hparams.cpp.o
[ 14%] Building CXX object src/CMakeFiles/llama.dir/llama-impl.cpp.o
[ 14%] Building CXX object src/CMakeFiles/llama.dir/llama-kv-cache.cpp.o
[ 14%] Building CXX object src/CMakeFiles/llama.dir/llama-model-loader.cpp.o
[ 15%] Building CXX object src/CMakeFiles/llama.dir/llama-model.cpp.o
[ 15%] Building CXX object src/CMakeFiles/llama.dir/llama-quant.cpp.o
[ 16%] Building CXX object src/CMakeFiles/llama.dir/llama-sampling.cpp.o
[ 16%] Building CXX object src/CMakeFiles/llama.dir/llama-vocab.cpp.o
[ 17%] Linking CXX shared library ../bin/libllama.so
[ 20%] Built target llama
[ 20%] Generating build details from Git
-- Found Git: /usr/bin/git (found version "2.43.5") 
[ 20%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[ 20%] Built target build_info
[ 21%] Building CXX object common/CMakeFiles/common.dir/arg.cpp.o
[ 21%] Building CXX object common/CMakeFiles/common.dir/chat.cpp.o
[ 22%] Building CXX object common/CMakeFiles/common.dir/common.cpp.o
[ 23%] Building CXX object common/CMakeFiles/common.dir/json-schema-to-grammar.cpp.o
[ 23%] Building CXX object common/CMakeFiles/common.dir/log.cpp.o
[ 24%] Building CXX object common/CMakeFiles/common.dir/ngram-cache.cpp.o
[ 24%] Building CXX object common/CMakeFiles/common.dir/sampling.cpp.o
[ 25%] Building CXX object common/CMakeFiles/common.dir/speculative.cpp.o
[ 25%] Linking CXX static library libcommon.a
[ 25%] Built target common
[ 26%] Building CXX object tests/CMakeFiles/test-tokenizer-0.dir/test-tokenizer-0.cpp.o
[ 26%] Linking CXX executable ../bin/test-tokenizer-0
../bin/libggml.so: undefined reference to `vtable for std::filesystem::__cxx11::filesystem_error'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
../bin/libggml.so: undefined reference to `typeinfo for std::filesystem::__cxx11::filesystem_error'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::path::_M_find_extension() const'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::filesystem_error::~filesystem_error()'
../bin/libggml.so: undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*)'
../bin/libggml.so: undefined reference to `std::filesystem::__cxx11::filesystem_error::_M_gen_what()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [tests/CMakeFiles/test-tokenizer-0.dir/build.make:102: bin/test-tokenizer-0] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1856: tests/CMakeFiles/test-tokenizer-0.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2





ldd build/bin/libggml.so 
	linux-vdso.so.1 (0x00007ffe9599d000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f218e3b4000)
	libggml-cpu.so => /home/steven/code/llama.cpp/build/bin/libggml-cpu.so (0x00007f218e0e7000)
	libggml-base.so => /home/steven/code/llama.cpp/build/bin/libggml-base.so (0x00007f218de11000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f218da7c000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f218d6fa000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f218d4e2000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f218d10c000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f218e7c8000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f218ced4000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f218ccb4000)

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