make -j报错
In file included from /usr/local/include/c++/10.1.0/cstdint:35,
from /opt/module/fastllm-master/include/fastllm.h:9,
from /opt/module/fastllm-master/include/devices/cuda/fastllm-cuda.cuh:1,
from /opt/module/fastllm-master/src/devices/cuda/fastllm-cuda.cu:9:
/usr/local/include/c++/10.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
32 | #error This file requires compiler and library support
| ^~~~~
In file included from /usr/local/include/c++/10.1.0/cstdint:35,
from /opt/module/fastllm-master/include/fastllm.h:9,
from /opt/module/fastllm-master/include/devices/cuda/fastllm-cuda.cuh:1,
from /opt/module/fastllm-master/src/devices/cuda/fastllm-cuda.cu:9:
/usr/local/include/c++/10.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
32 | #error This file requires compiler and library support
| ^~~~~
make[2]: *** [CMakeFiles/fastllm_tools.dir/src/devices/cuda/fastllm-cuda.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/fastllm.dir/src/devices/cuda/fastllm-cuda.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In function ‘fastllm::ChatGLMModel::LaunchResponseTokens(const std::vector
This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
根据报错提示,你漏掉了 -std=c++11 flag,可能是改错了CMakeList.txt文件导致的
CMakeList.txt 文件我是这样改的 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread --std=c++11 -O2") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -O2 /std:c++11 /arch:AVX /source-charset:utf-8") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread --std=c++11 -O2 -march=native") endif()
是我哪里改错了吗
用的编译器是gcc吗?版本是多少?如果版本过低建议升级下gcc
是gcc,版本是10.1.0的,应该不会低了吧
清空build目录,重新运行一下cmake,看下CXX_FLAGS是什么
试下这个:
export CC=`which gcc`
export CXX=`which g++`
请问您这个问题解决了吗?我也遇到了
加上这个解决了
set (CMAKE_CXX_STANDARD 11)