在鲲鹏下编译Paddle找不到pthreads

cngwdvgl  于 2021-11-30  发布在  Java
关注(0)|答案(7)|浏览(474)

https://paddle-inference.readthedocs.io/en/latest/user_guides/compile_ARM.html#id7
我是根据上面的步骤安装编译Paddle的,在执行到第八步运行cmake时,生成了CMakeError.log。

错误信息如下所示:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/soft/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_21af7/fast && /usr/bin/gmake -f CMakeFiles/cmTC_21af7.dir/build.make CMakeFiles/cmTC_21af7.dir/build
gmake[1]: Entering directory /home/soft/Paddle/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_21af7.dir/src.c.o /usr/local/gcc-7.3.0/bin/gcc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_21af7.dir/src.c.o -c /home/soft/Paddle/build/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_21af7 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_21af7.dir/link.txt --verbose=1 /usr/local/gcc-7.3.0/bin/gcc CMakeFiles/cmTC_21af7.dir/src.c.o -o cmTC_21af7 CMakeFiles/cmTC_21af7.dir/src.c.o: In functionmain':
src.c:(.text+0x34): undefined reference to pthread_create' src.c:(.text+0x3c): undefined reference topthread_detach'
src.c:(.text+0x44): undefined reference to pthread_cancel' src.c:(.text+0x50): undefined reference topthread_join'
src.c:(.text+0x60): undefined reference to pthread_atfork' collect2: error: ld returned 1 exit status gmake[1]:***[cmTC_21af7] Error 1 gmake[1]: Leaving directory/home/soft/Paddle/build/CMakeFiles/CMakeTmp'
gmake:***[cmTC_21af7/fast] Error 2

Source file was:
#include <pthread.h>

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/soft/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_b2f81/fast && /usr/bin/gmake -f CMakeFiles/cmTC_b2f81.dir/build.make CMakeFiles/cmTC_b2f81.dir/build
gmake[1]: Entering directory /home/soft/Paddle/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_b2f81.dir/CheckFunctionExists.c.o /usr/local/gcc-7.3.0/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_b2f81.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.19/Modules/CheckFunctionExists.c Linking C executable cmTC_b2f81 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b2f81.dir/link.txt --verbose=1 /usr/local/gcc-7.3.0/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_b2f81.dir/CheckFunctionExists.c.o -o cmTC_b2f81 -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status gmake[1]:***[cmTC_b2f81] Error 1 gmake[1]: Leaving directory/home/soft/Paddle/build/CMakeFiles/CMakeTmp'
gmake:***[cmTC_b2f81/fast] Error 2

请问pthreads库需要安装什么依赖?需要怎么处理这个错误异常才能顺利编译Paddle呢?

mm9b1k5b

mm9b1k5b1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

pkmbmrz7

pkmbmrz72#

看报错信息好像是因为环境缺少了基本的开发组件,可以用apt或yum安装下,解决下基本的开发环境问题

qvtsj1bj

qvtsj1bj3#

请问应该安装哪个呢?我一直都想知道哪个,谢谢。

6yjfywim

6yjfywim4#

@cryoco 请问这个什么问题呢?

ffdz8vbo

ffdz8vbo5#

查了下 ubuntu的基本开发环境需要 apt 安装 build-essential

centos下基本开发环境 可以 yum groupinstall "Development Tools"

你可以查下你的系统上怎么安装这些基本环境

fkvaft9z

fkvaft9z6#

我也遇到同样的问题,求解决方法!

ttp71kqs

ttp71kqs7#

@yilvshifeng check you environment, my machine is ubuntu18.04, now is ok. make sure nccl is installed!!!
my cuda is 10.2

git clone https://github.com/NVIDIA/nccl.git

make -j12 src.build CUDA_HOME=/usr/local/cuda-10.2

apt install devscripts

make -j8 pkg.debian.build CUDA_HOME=/usr/local/cuda-10.2

ls build/pkg/deb/

sudo dpkg -i libnccl2_2.9.9-1+cuda10.2_amd64.deb
sudo dpkg -i libnccl-dev_2.9.9-1+cuda10.2_amd64.deb

ls /usr/include/nccl.h
ls /usr/lib/x86_64-linux-gnu/libnccl.so

相关问题