我的gcc版本是7.5,但是报错还是报#error -- unsupported GNU version!不支持 10 以上的 gcc 版本

问题描述 投票:0回答:0

执行deepspeed框架时,遇到gcc版本不匹配的错误。但是查看之后发现gcc版本是7.5.

FAILED: custom_cuda_kernel.cuda.o 
/usr/local/cuda-11.1/bin/nvcc  -ccbin /home/whzhu_st/mypython/bin/x86_64-conda-linux-gnu-cc -DTORCH_EXTENSION_NAME=cpu_adam -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -I/home/whzhu_st/mypython/lib/python3.8/site-packages/deepspeed/ops/csrc/includes -I/usr/local/cuda-11.1/include -isystem /home/whzhu_st/mypython/lib/python3.8/site-packages/torch/include -isystem /home/whzhu_st/mypython/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/whzhu_st/mypython/lib/python3.8/site-packages/torch/include/TH -isystem /home/whzhu_st/mypython/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.1/include -isystem /home/whzhu_st/mypython/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 --compiler-options '-fPIC' -O3 --use_fast_math -std=c++14 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_70,code=compute_70 -c /home/whzhu_st/mypython/lib/python3.8/site-packages/deepspeed/ops/csrc/common/custom_cuda_kernel.cu -o custom_cuda_kernel.cuda.o 
In file included from /usr/local/cuda-11.1/include/cuda_runtime.h:83,
                 from <command-line>:
/usr/local/cuda-11.1/include/crt/host_config.h:139:2: error: #error -- unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
  139 | #error -- unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      |  ^~~~~
ninja: build stopped: subcommand failed.

但是执行gcc -v信息是7.5:

(base) whzhu_st@s3:~$ ls /usr/bin/gcc* -l
lrwxrwxrwx 1 root root 14 Mar 25 06:53 /usr/bin/gcc -> /usr/bin/gcc-7
lrwxrwxrwx 1 root root 23 May 29  2021 /usr/bin/gcc-10 -> x86_64-linux-gnu-gcc-10
lrwxrwxrwx 1 root root 22 Mar 26  2020 /usr/bin/gcc-7 -> x86_64-linux-gnu-gcc-7
lrwxrwxrwx 1 root root 22 Apr  2  2020 /usr/bin/gcc-8 -> x86_64-linux-gnu-gcc-8
lrwxrwxrwx 1 root root 22 Mar  9  2022 /usr/bin/gcc-9 -> x86_64-linux-gnu-gcc-9
lrwxrwxrwx 1 root root  8 Mar 20  2020 /usr/bin/gcc-ar -> gcc-ar-9
lrwxrwxrwx 1 root root 26 May 29  2021 /usr/bin/gcc-ar-10 -> x86_64-linux-gnu-gcc-ar-10
lrwxrwxrwx 1 root root 25 Mar 26  2020 /usr/bin/gcc-ar-7 -> x86_64-linux-gnu-gcc-ar-7
lrwxrwxrwx 1 root root 25 Apr  2  2020 /usr/bin/gcc-ar-8 -> x86_64-linux-gnu-gcc-ar-8
lrwxrwxrwx 1 root root 25 Mar  9  2022 /usr/bin/gcc-ar-9 -> x86_64-linux-gnu-gcc-ar-9
lrwxrwxrwx 1 root root  8 Mar 20  2020 /usr/bin/gcc-nm -> gcc-nm-9
lrwxrwxrwx 1 root root 26 May 29  2021 /usr/bin/gcc-nm-10 -> x86_64-linux-gnu-gcc-nm-10
lrwxrwxrwx 1 root root 25 Mar 26  2020 /usr/bin/gcc-nm-7 -> x86_64-linux-gnu-gcc-nm-7
lrwxrwxrwx 1 root root 25 Apr  2  2020 /usr/bin/gcc-nm-8 -> x86_64-linux-gnu-gcc-nm-8
lrwxrwxrwx 1 root root 25 Mar  9  2022 /usr/bin/gcc-nm-9 -> x86_64-linux-gnu-gcc-nm-9
lrwxrwxrwx 1 root root 12 Mar 20  2020 /usr/bin/gcc-ranlib -> gcc-ranlib-9
lrwxrwxrwx 1 root root 30 May 29  2021 /usr/bin/gcc-ranlib-10 -> x86_64-linux-gnu-gcc-ranlib-10
lrwxrwxrwx 1 root root 29 Mar 26  2020 /usr/bin/gcc-ranlib-7 -> x86_64-linux-gnu-gcc-ranlib-7
lrwxrwxrwx 1 root root 29 Apr  2  2020 /usr/bin/gcc-ranlib-8 -> x86_64-linux-gnu-gcc-ranlib-8
lrwxrwxrwx 1 root root 29 Mar  9  2022 /usr/bin/gcc-ranlib-9 -> x86_64-linux-gnu-gcc-ranlib-9
(base) whzhu_st@s3:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-6ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-6ubuntu2)

g++ -v 信息:

(base) whzhu_st@s3:~$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-6ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-6ubuntu2) 

gcc 版本本来就低于10, 怎么解决这个问题。提前感谢您的回复!

gcc g++
© www.soinside.com 2019 - 2024. All rights reserved.