系统: Manjaro Linux
环境: Cuda11.1
从gitee上clone了1.5.2版本的代码,按照官网源码安装流程编译报错,CmakeError.log 如下:
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_453cb/fast && /usr/bin/make -f CMakeFiles/cmTC_453cb.dir/build.make CMakeFiles/cmTC_453cb.dir/build
make[1]: 进入目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_453cb.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_453cb.dir/src.c.o -c /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_453cb
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_453cb.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_453cb.dir/src.c.o -o cmTC_453cb
/usr/bin/ld: CMakeFiles/cmTC_453cb.dir/src.c.o: in function `main':
src.c:(.text+0x3e): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x4a): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x56): undefined reference to `pthread_cancel'
/usr/bin/ld: src.c:(.text+0x67): undefined reference to `pthread_join'
collect2: 错误:ld 返回 1
make[1]: *** [CMakeFiles/cmTC_453cb.dir/build.make:99:cmTC_453cb] 错误 1
make[1]: 离开目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
make: *** [Makefile:127:cmTC_453cb/fast] 错误 2
Source file was:
#include
static void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_d770f/fast && /usr/bin/make -f CMakeFiles/cmTC_d770f.dir/build.make CMakeFiles/cmTC_d770f.dir/build
make[1]: 进入目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_d770f.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_d770f.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_d770f
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d770f.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_d770f.dir/CheckFunctionExists.c.o -o cmTC_d770f -lpthreads
/usr/bin/ld: 找不到 -lpthreads
collect2: 错误:ld 返回 1
make[1]: *** [CMakeFiles/cmTC_d770f.dir/build.make:99:cmTC_d770f] 错误 1
make[1]: 离开目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
make: *** [Makefile:127:cmTC_d770f/fast] 错误 2
Determining if the __aarch64__ exist failed with the following output:
Change Dir: /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_e6c81/fast && /usr/bin/make -f CMakeFiles/cmTC_e6c81.dir/build.make CMakeFiles/cmTC_e6c81.dir/build
make[1]: 进入目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_e6c81.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_e6c81.dir/CheckSymbolExists.c.o -c /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/CheckSymbolExists.c: 在函数‘main’中:
/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/CheckSymbolExists.c:7:19: 错误:‘__aarch64__’未声明(在此函数内第一次使用)
7 | return ((int*)(&__aarch64__))[argc];
| ^~~~~~~~~~~
/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/CheckSymbolExists.c:7:19: 附注:每个未声明的标识符在其出现的函数内只报告一次
make[1]: *** [CMakeFiles/cmTC_e6c81.dir/build.make:78:CMakeFiles/cmTC_e6c81.dir/CheckSymbolExists.c.o] 错误 1
make[1]: 离开目录“/home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp”
make: *** [Makefile:127:cmTC_e6c81/fast] 错误 2
File /home/syx/Code/Python/mindspore/build/mindspore/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
int main(int argc, char** argv)
{
(void)argv;
#ifndef __aarch64__
return ((int*)(&__aarch64__))[argc];
#else
(void)argc;
return 0;
#endif
}
cmake error.txt的内容与编译失败的原因无关,当前日志信息不足,无法确定具体失败原因,需要提供编译失败时完整的屏幕输出日志