fastllm icon indicating copy to clipboard operation
fastllm copied to clipboard

make -j报错

Open 741075810 opened this issue 2 years ago • 9 comments

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&)::<lambda(fastllm::ChatGLMModel*)>’: cc1plus: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations] /opt/module/fastllm-master/src/models/chatglm.cpp:837:51: note: within this loop 837 | for (int i = 0; i < seqLen - 1; i++) { | ~~^~~~~~~~~~~~ In function ‘fastllm::ChatGLMModel::LaunchResponseTokens(const std::vector&)::<lambda(fastllm::ChatGLMModel*)>’: cc1plus: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations] /opt/module/fastllm-master/src/models/chatglm.cpp:837:51: note: within this loop 837 | for (int i = 0; i < seqLen - 1; i++) { | ~~^~~~~~~~~~~~ make[1]: *** [CMakeFiles/fastllm_tools.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... make[1]: *** [CMakeFiles/fastllm.dir/all] Error 2 make: *** [all] Error 2

741075810 avatar Jul 10 '23 06:07 741075810

This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

根据报错提示,你漏掉了 -std=c++11 flag,可能是改错了CMakeList.txt文件导致的

kiranosora avatar Jul 10 '23 06:07 kiranosora

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()

741075810 avatar Jul 10 '23 07:07 741075810

是我哪里改错了吗

741075810 avatar Jul 11 '23 02:07 741075810

用的编译器是gcc吗?版本是多少?如果版本过低建议升级下gcc

kiranosora avatar Jul 11 '23 02:07 kiranosora

是gcc,版本是10.1.0的,应该不会低了吧

741075810 avatar Jul 11 '23 03:07 741075810

清空build目录,重新运行一下cmake,看下CXX_FLAGS是什么

kiranosora avatar Jul 11 '23 03:07 kiranosora

试下这个:

export CC=`which gcc`
export CXX=`which g++`

Sberm avatar Jul 17 '23 09:07 Sberm

请问您这个问题解决了吗?我也遇到了

huwei02 avatar Dec 19 '23 17:12 huwei02

加上这个解决了 set (CMAKE_CXX_STANDARD 11)

biyou avatar Feb 21 '24 03:02 biyou