Skip to content

Compile bug: RHEL8 / too low glibc cannot compile with default flags #26451

Description

@kuhnchris

Git commit

latest, any since d2a8182

Operating systems

Linux

GGML backends

CUDA

Problem description & steps to reproduce

Since commit d2a8182 which added the subproc.h the default compilation of llama.cpp breaks due to LLAMA_SUBPROCESS being "ON" by default. I suggest actually having a check in the CMake build pipeline and disable the LLAMA_SUBPROCESS by default to avoid any "surprises".

The only real indicator here why it fails is the fact that posix_spawn_file_actions_addchdir_np isn't found, which, if you check /usr/include/spawn.h, holds true for old glibc <2.29 (according to gemini).

kuhnc@machine : grep posix_spawn_file_actions /usr/include/spawn.h 
} posix_spawn_file_actions_t;
                        const posix_spawn_file_actions_t *__restrict
                         const posix_spawn_file_actions_t *__file_actions,
extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *

Compile error:

In file included from /dev/shm/llama.cpp/common/./subproc.h:9,
                 from /dev/shm/llama.cpp/tools/server/server-tools.cpp:3:
/dev/shm/llama.cpp/common/../vendor/sheredom/subprocess.h: In function ‘int subprocess_create_ex(const char* const*, int, const char* const*, const char*, subprocess_s*)’:
/dev/shm/llama.cpp/common/../vendor/sheredom/subprocess.h:1215:19: error: ‘posix_spawn_file_actions_addchdir_np’ was not declared in this scope; did you mean ‘posix_spawn_file_actions_addopen’?
 1215 |     posix_error = posix_spawn_file_actions_addchdir_np(&actions, process_cwd);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   posix_spawn_file_actions_addopen
ninja: build stopped: subcommand failed.

Solution:

cmake ... -DLLAMA_SUBPROCESS=OFF ...

First Bad Commit

d2a8182

Compile command

cmake .. \
-DCMAKE_CUDA_ARCHITECTURES="80;89" -G Ninja \
-DCMAKE_SKIP_BUILD_RPATH=FALSE -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE -DCMAKE_INSTALL_RPATH="${CUDADIR}/lib64/stubs;$PWD/stubs;${CUDADIR}/targets/x86_64-linux/lib"  \
-DCMAKE_BUILD_RPATH="${CUDADIR}/lib64/stubs;$PWD/stubs;${CUDADIR}/targets/x86_64-linux/lib" -DGGML_CUDA=ON -DGGML_AMX_BF16=ON -DGGML_AMX_INT8=ON -DGGML_AMX_TILE=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX512=ON \
-DGGML_AVX512_BF16=ON -DGGML_AVX512_VBMI=ON -DGGML_AVX512_VNNI=ON -DGGML_AVX_VNNI=ON -DGGML_CUDA_FA_ALL_QUANTS=ON -DGGML_F16C=ON -DGGML_FMA=ON -DGGML_LTO=ON -DGGML_SSE42=ON -DNCCL_LIBRARY=$NCCL_LIBRARY -DNCCL_INCLUDE_DIR=$NCCL_INCLUDE_DIR -DLLAMA_BUILD_UI=OFF -DLLAMA_USE_PREBUILT_UI=OFF -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_SUBPROCESS=OFF

Relevant log output

In file included from /dev/shm/llama.cpp/common/./subproc.h:9,
                 from /dev/shm/llama.cpp/tools/server/server-tools.cpp:3:
/dev/shm/llama.cpp/common/../vendor/sheredom/subprocess.h: In function ‘int subprocess_create_ex(const char* const*, int, const char* const*, const char*, subprocess_s*)’:
/dev/shm/llama.cpp/common/../vendor/sheredom/subprocess.h:1215:19: error: ‘posix_spawn_file_actions_addchdir_np’ was not declared in this scope; did you mean ‘posix_spawn_file_actions_addopen’?
 1215 |     posix_error = posix_spawn_file_actions_addchdir_np(&actions, process_cwd);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   posix_spawn_file_actions_addopen

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