Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

how to compile on last gcc?

未关闭
#2,081 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cmake, python
领域
build-system

调研方向

使用 CUDA 11.4 和 GCC 12.2.0 构建 llama-cpp-python 时,错误发生在 CMake 识别 CUDA 编译器的过程中。查看项目构建脚本中的 CMake 配置,尤其是传递给 nvcc 的 flags。问题在于 CUDA 11.4 与较新 GCC 版本之间的兼容性;检查项目是否记录了受支持的编译器版本,或者是否需要某个 workaround flag。测试包括修改 CMake 参数或环境变量,以确认构建是否成功。

由索引模型根据 Issue 内容生成。

描述

export PATH=/usr/local/cuda-11.4/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:$LD_LIBRARY_PATH
NVCC_PREPEND_FLAGS="-allow-unsupported-compiler" CMAKE_ARGS="-DGGML_CUDA=on -DLLAVA_BUILD=off -DCMAKE_CUDA_FLAGS=-allow-unsupported-compiler" proxychains ../../bin/pip install -U llama-cpp-python
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| pypi.org 
|S-chain|-<>-127.0.0.1:4445-<><>-4.2.2.2:53-<><>-OK
|DNS-response| pypi.org is 151.101.0.223
|S-chain|-<>-127.0.0.1:4445-<><>-151.101.0.223:443-<><>-OK
Collecting llama-cpp-python
  Using cached llama_cpp_python-0.3.16.tar.gz (50.7 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: typing-extensions>=4.5.0 in /mnt/SOLR/lib/python3.11/site-packages (from llama-cpp-python) (4.15.0)
Requirement already satisfied: numpy>=1.20.0 in /mnt/SOLR/lib/python3.11/site-packages (from llama-cpp-python) (1.26.4)
Collecting diskcache>=5.6.1
  Using cached diskcache-5.6.3-py3-none-any.whl (45 kB)
Requirement already satisfied: jinja2>=2.11.3 in /mnt/SOLR/lib/python3.11/site-packages (from llama-cpp-python) (3.1.6)
Requirement already satisfied: MarkupSafe>=2.0 in /mnt/SOLR/lib/python3.11/site-packages (from jinja2>=2.11.3->llama-cpp-python) (3.0.3)
Building wheels for collected packages: llama-cpp-python
  Building wheel for llama-cpp-python (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [379 lines of output]
      *** scikit-build-core 0.11.6 using CMake 3.25.1 (wheel)
      *** Configuring CMake...
      loading initial cache file /tmp/tmpsrjhdqci/build/CMakeInit.txt
      -- The C compiler identification is GNU 12.2.0
      -- The CXX compiler identification is GNU 12.2.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/x86_64-linux-gnu-gcc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/x86_64-linux-gnu-g++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMAKE_BUILD_TYPE=Release
      -- Found Git: /usr/bin/git (found version "2.39.5")
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
      -- CMAKE_SYSTEM_PROCESSOR: x86_64
      -- GGML_SYSTEM_ARCH: x86
      -- Including CPU backend
      -- Found OpenMP_C: -fopenmp (found version "4.5")
      -- Found OpenMP_CXX: -fopenmp (found version "4.5")
      -- Found OpenMP: TRUE (found version "4.5")
      -- x86 detected
      -- Adding CPU backend variant ggml-cpu: -march=native
      -- Found CUDAToolkit: /usr/local/cuda-11.4/include (found version "11.4.48")
      -- CUDA Toolkit found
      -- Using CUDA architectures: 50-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-real
      CMake Error at /usr/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:739 (message):
        Compiling the CUDA compiler identification source file
        "CMakeCUDACompilerId.cu" failed.
      
        Compiler: /usr/local/cuda-11.4/bin/nvcc
      
        Build flags: -allow-unsupported-compiler
      
        Id flags: --keep;--keep-dir;tmp -v
      
      
      
        The output was:
      
        1
      
        #$ NVCC_PREPEND_FLAGS="-allow-unsupported-compiler"
      
        #$ _NVVM_BRANCH_=nvvm
      
        #$ _SPACE_=
      
        #$ _CUDART_=cudart
      
        #$ _HERE_=/usr/local/cuda-11.4/bin
      
        #$ _THERE_=/usr/local/cuda-11.4/bin
      
        #$ _TARGET_SIZE_=
      
        #$ _TARGET_DIR_=
      
        #$ _TARGET_DIR_=targets/x86_64-linux
      
        #$ TOP=/usr/local/cuda-11.4/bin/..
      
        #$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-11.4/bin/../nvvm/libdevice
      
        #$
        LD_LIBRARY_PATH=/usr/local/cuda-11.4/bin/../lib:/usr/local/cuda-11.4/lib64:
      
      
        #$
        PATH=/usr/local/cuda-11.4/bin/../nvvm/bin:/usr/local/cuda-11.4/bin:/tmp/pip-build-env-zklleoev/overlay/bin:/tmp/pip-build-env-zklleoev/normal/bin:/usr/local/cuda-11.4/bin:/home/user/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
      
      
        #$ INCLUDES="-I/usr/local/cuda-11.4/bin/../targets/x86_64-linux/include"
      
        #$ LIBRARIES=
        "-L/usr/local/cuda-11.4/bin/../targets/x86_64-linux/lib/stubs"
        "-L/usr/local/cuda-11.4/bin/../targets/x86_64-linux/lib"
      
        #$ CUDAFE_FLAGS=
      
        #$ PTXAS_FLAGS=
      
        #$ rm tmp/a_dlink.reg.c
      
        #$ gcc -D__NV_NO_HOST_COMPILER_CHECK=1 -D__CUDA_ARCH__=520 -E -x c++
        -DCUDA_DOUBLE_MATH_FUNCTIONS -D__CUDACC__ -D__NVCC__
        "-I/usr/local/cuda-11.4/bin/../targets/x86_64-linux/include"
        -D__CUDACC_VER_MAJOR__=11 -D__CUDACC_VER_MINOR__=4
        -D__CUDACC_VER_BUILD__=48 -D__CUDA_API_VER_MAJOR__=11
        -D__CUDA_API_VER_MINOR__=4 -include "cuda_runtime.h" -m64
        "CMakeCUDACompilerId.cu" -o "tmp/CMakeCUDACompilerId.cpp1.ii"
      
        #$ cicc --c++14 --gnu_version=120200 --orig_src_file_name
        "CMakeCUDACompilerId.cu" --allow_managed -arch compute_52 -m64
        --no-version-ident -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1
        --include_file_name "CMakeCUDACompilerId.fatbin.c" -tused
        --gen_module_id_file --module_id_file_name
        "tmp/CMakeCUDACompilerId.module_id" --gen_c_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.c" --stub_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.stub.c" --gen_device_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.gpu" "tmp/CMakeCUDACompilerId.cpp1.ii" -o
        "tmp/CMakeCUDACompilerId.ptx"
      
        /usr/include/stdio.h(189): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(201): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(223): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(260): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(285): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(294): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(303): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(309): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(315): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(830): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(579): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(583): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(812): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: argument list for class
        template "std::pair" is missing
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: expected a ")"
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: template parameter "_T1"
        may not be redeclared in this scope
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: expected a ";"
      
      
      
        17 errors detected in the compilation of "CMakeCUDACompilerId.cu".
      
        # --error 0x1 --
      
      
      
      
      
        Compiling the CUDA compiler identification source file
        "CMakeCUDACompilerId.cu" failed.
      
        Compiler: /usr/local/cuda-11.4/bin/nvcc
      
        Build flags:
      
        Id flags: --keep;--keep-dir;tmp -v
      
      
      
        The output was:
      
        1
      
        #$ NVCC_PREPEND_FLAGS="-allow-unsupported-compiler"
      
        #$ _NVVM_BRANCH_=nvvm
      
        #$ _SPACE_=
      
        #$ _CUDART_=cudart
      
        #$ _HERE_=/usr/local/cuda-11.4/bin
      
        #$ _THERE_=/usr/local/cuda-11.4/bin
      
        #$ _TARGET_SIZE_=
      
        #$ _TARGET_DIR_=
      
        #$ _TARGET_DIR_=targets/x86_64-linux
      
        #$ TOP=/usr/local/cuda-11.4/bin/..
      
        #$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-11.4/bin/../nvvm/libdevice
      
        #$
        LD_LIBRARY_PATH=/usr/local/cuda-11.4/bin/../lib:/usr/local/cuda-11.4/lib64:
      
      
        #$
        PATH=/usr/local/cuda-11.4/bin/../nvvm/bin:/usr/local/cuda-11.4/bin:/tmp/pip-build-env-zklleoev/overlay/bin:/tmp/pip-build-env-zklleoev/normal/bin:/usr/local/cuda-11.4/bin:/home/user/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
      
      
        #$ INCLUDES="-I/usr/local/cuda-11.4/bin/../targets/x86_64-linux/include"
      
        #$ LIBRARIES=
        "-L/usr/local/cuda-11.4/bin/../targets/x86_64-linux/lib/stubs"
        "-L/usr/local/cuda-11.4/bin/../targets/x86_64-linux/lib"
      
        #$ CUDAFE_FLAGS=
      
        #$ PTXAS_FLAGS=
      
        #$ rm tmp/a_dlink.reg.c
      
        #$ gcc -D__NV_NO_HOST_COMPILER_CHECK=1 -D__CUDA_ARCH__=520 -E -x c++
        -DCUDA_DOUBLE_MATH_FUNCTIONS -D__CUDACC__ -D__NVCC__
        "-I/usr/local/cuda-11.4/bin/../targets/x86_64-linux/include"
        -D__CUDACC_VER_MAJOR__=11 -D__CUDACC_VER_MINOR__=4
        -D__CUDACC_VER_BUILD__=48 -D__CUDA_API_VER_MAJOR__=11
        -D__CUDA_API_VER_MINOR__=4 -include "cuda_runtime.h" -m64
        "CMakeCUDACompilerId.cu" -o "tmp/CMakeCUDACompilerId.cpp1.ii"
      
        #$ cicc --c++14 --gnu_version=120200 --orig_src_file_name
        "CMakeCUDACompilerId.cu" --allow_managed -arch compute_52 -m64
        --no-version-ident -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1
        --include_file_name "CMakeCUDACompilerId.fatbin.c" -tused
        --gen_module_id_file --module_id_file_name
        "tmp/CMakeCUDACompilerId.module_id" --gen_c_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.c" --stub_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.stub.c" --gen_device_file_name
        "tmp/CMakeCUDACompilerId.cudafe1.gpu" "tmp/CMakeCUDACompilerId.cpp1.ii" -o
        "tmp/CMakeCUDACompilerId.ptx"
      
        /usr/include/stdio.h(189): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(201): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(223): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(260): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(285): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(294): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(303): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(309): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(315): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdio.h(830): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(579): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(583): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/stdlib.h(812): error: attribute "__malloc__" does not take
        arguments
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: argument list for class
        template "std::pair" is missing
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: expected a ")"
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: template parameter "_T1"
        may not be redeclared in this scope
      
      
      
        /usr/include/c++/12/bits/stl_pair.h(634): error: expected a ";"
      
      
      
        17 errors detected in the compilation of "CMakeCUDACompilerId.cu".
      
        # --error 0x1 --
      
      
      
      
      
      Call Stack (most recent call first):
        /usr/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
        /usr/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
        /usr/share/cmake-3.25/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID)
        vendor/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt:43 (enable_language)
      
      
      -- Configuring incomplete, errors occurred!
      See also "/tmp/tmpsrjhdqci/build/CMakeFiles/CMakeOutput.log".
      See also "/tmp/tmpsrjhdqci/build/CMakeFiles/CMakeError.log".
      
      *** CMake configuration failed
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llama-cpp-python
Failed to build llama-cpp-python
ERROR: Could not build wheels for llama-cpp-python, which is required to install pyproject.toml-based projects

It need gcc10, I should compile gcc10?
llama-cpp-python have exists version for cuda 11?

主要语言
Python
星标
10.6k
派生
1.5k
平均合并
3 小时 57 分钟
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

abetlen/llama-cpp-python 的其他 Issue

查看 abetlen/llama-cpp-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。