prima.cpp icon indicating copy to clipboard operation
prima.cpp copied to clipboard

CMake build failed: two issues in CMakeLists.txt

Open 1234562026 opened this issue 3 months ago • 0 comments

Bug description

CMake build failed, while native Makefile build works correctly.

There are two bugs:

  1. Missing include_directories(${CMAKE_SOURCE_DIR}/common) in root CMakeLists.txt, leads to fatal error: profiler.h: No such file or directory
  2. CMake tries to execute common/cmake/build-info-gen-cpp.cmake, but this file does not exist in the repository.

Environment

OS: Termux (aarch64 Android) Compiler: gcc-13 / g++-13

Reproduce steps

git clone --depth=1 https://github.com/OpenCPIL/prima.cpp
cd prima.cpp
mkdir build && cd build
CC=gcc-13 CXX=g++-13 cmake .. -GNinja
ninja
error log 

~/prima.cpp/build $ ninja -j 6 -v
[1/178] ccache /data/data/com.termux/files/usr/bin/gcc-13 -DGGML_BUILD -DGGML_SCHED_MAX_COPIES=4 -DGGML_SHARED -DGGML_USE_LLAMAFILE -DGGML_USE_OPENMP -D_GNU_SOURCE -D_XOPEN_SOURCE=600 -Dggml_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/. -O2 -g -DNDEBUG -std=gnu11 -fPIC -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wdouble-promotion -fopenmp -pthread -MD -MT ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o -MF ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o.d -o ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o -c /data/data/com.termux/files/home/prima.cpp/ggml/src/ggml-alloc.c
[2/178] ccache /data/data/com.termux/files/usr/bin/gcc-13 -DGGML_BUILD -DGGML_SCHED_MAX_COPIES=4 -DGGML_SHARED -DGGML_USE_LLAMAFILE -DGGML_USE_OPENMP -D_GNU_SOURCE -D_XOPEN_SOURCE=600 -Dggml_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/. -O2 -g -DNDEBUG -std=gnu11 -fPIC -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wdouble-promotion -fopenmp -pthread -MD -MT ggml/src/CMakeFiles/ggml.dir/ggml-aarch64.c.o -MF ggml/src/CMakeFiles/ggml.dir/ggml-aarch64.c.o.d -o ggml/src/CMakeFiles/ggml.dir/ggml-aarch64.c.o -c /data/data/com.termux/files/home/prima.cpp/ggml/src/ggml-aarch64.c
[3/178] ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama-vocab.cpp.o -MF src/CMakeFiles/llama.dir/llama-vocab.cpp.o.d -o src/CMakeFiles/llama.dir/llama-vocab.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama-vocab.cpp
FAILED: [code=1] src/CMakeFiles/llama.dir/llama-vocab.cpp.o
ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama-vocab.cpp.o -MF src/CMakeFiles/llama.dir/llama-vocab.cpp.o.d -o src/CMakeFiles/llama.dir/llama-vocab.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama-vocab.cpp
In file included from /data/data/com.termux/files/home/prima.cpp/src/llama-impl.h:3,
                 from /data/data/com.termux/files/home/prima.cpp/src/llama-vocab.h:3,
                 from /data/data/com.termux/files/home/prima.cpp/src/llama-vocab.cpp:1:
/data/data/com.termux/files/home/prima.cpp/src/../include/llama.h:7:10: fatal error: profiler.h: No such file or directory
    7 | #include "profiler.h"
      |          ^~~~~~~~~~~~
compilation terminated.
[4/178] ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama.cpp.o -MF src/CMakeFiles/llama.dir/llama.cpp.o.d -o src/CMakeFiles/llama.dir/llama.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama.cpp
FAILED: [code=1] src/CMakeFiles/llama.dir/llama.cpp.o
ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama.cpp.o -MF src/CMakeFiles/llama.dir/llama.cpp.o.d -o src/CMakeFiles/llama.dir/llama.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama.cpp
In file included from /data/data/com.termux/files/home/prima.cpp/src/llama-impl.h:3,
                 from /data/data/com.termux/files/home/prima.cpp/src/llama.cpp:3:
/data/data/com.termux/files/home/prima.cpp/src/../include/llama.h:7:10: fatal error: profiler.h: No such file or directory
    7 | #include "profiler.h"
      |          ^~~~~~~~~~~~
compilation terminated.
/com.termux/files/home/prima.cpp/common -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama-grammar.cpp.o -MF src/CMakeFiles/llama.dir/llama-grammar.cpp.o.d -o src/CMakeFiles/llama.dir/llama-grammar.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama-grammar.cpp
[7/178] ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/common -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/llama-sampling.cpp.o -MF src/CMakeFiles/llama.dir/llama-sampling.cpp.o.d -o src/CMakeFiles/llama.dir/llama-sampling.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/llama-sampling.cpp
[8/178] cd /data/data/com.termux/files/home/prima.cpp && /data/data/com.termux/files/usr/bin/cmake -DMSVC= -DCMAKE_C_COMPILER_VERSION=13.4.0 -DCMAKE_C_COMPILER_ID=GNU -DCMAKE_VS_PLATFORM_NAME= -DCMAKE_C_COMPILER=/data/data/com.termux/files/usr/bin/gcc-13 -P /data/data/com.termux/files/home/prima.cpp/common/cmake/build-info-gen-cpp.cmake
FAILED: [code=1] /data/data/com.termux/files/home/prima.cpp/common/build-info.cpp
cd /data/data/com.termux/files/home/prima.cpp && /data/data/com.termux/files/usr/bin/cmake -DMSVC= -DCMAKE_C_COMPILER_VERSION=13.4.0 -DCMAKE_C_COMPILER_ID=GNU -DCMAKE_VS_PLATFORM_NAME= -DCMAKE_C_COMPILER=/data/data/com.termux/files/usr/bin/gcc-13 -P /data/data/com.termux/files/home/prima.cpp/common/cmake/build-info-gen-cpp.cmake
CMake Error: Not a file: /data/data/com.termux/files/home/prima.cpp/common/cmake/build-info-gen-cpp.cmake
CMake Error: Error processing file: /data/data/com.termux/files/home/prima.cpp/common/cmake/build-info-gen-cpp.cmake
[9/178] ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com.termux/files/home/prima.cpp/common -I/data/data/com.termux/files/home/prima.cpp/src/. -I/data/data/com.termux/files/home/prima.cpp/src/../include -I/data/data/com.termux/files/home/prima.cpp/ggml/src/../include -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/llama.dir/unicode-data.cpp.o -MF src/CMakeFiles/llama.dir/unicode-data.cpp.o.d -o src/CMakeFiles/llama.dir/unicode-data.cpp.o -c /data/data/com.termux/files/home/prima.cpp/src/unicode-data.cpp
[10/178] ccache /data/data/com.termux/files/usr/bin/g++-13 -DLLAMA_BUILD -DLLAMA_SHARED -Dllama_EXPORTS -I/data/data/com

1234562026 avatar Aug 22 '26 05:08 1234562026