[software development] 求助:编译Sunshine出错
Tofloor
poster avatar
Signal
deepin
2024-03-01 09:01
Author

打算在20.9下编译sunshine,但是cmake过不去。

查看CMakeErrorLog中显示:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_66044/fast && /usr/bin/make -f CMakeFiles/cmTC_66044.dir/build.make CMakeFiles/cmTC_66044.dir/build
make[1]: 进入目录“/home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_66044.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_66044.dir/src.c.o -c /home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_66044
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66044.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_66044.dir/src.c.o -o cmTC_66044
/usr/bin/ld: CMakeFiles/cmTC_66044.dir/src.c.o: in function main': src.c:(.text+0x2d): undefined reference to pthread_create'
/usr/bin/ld: src.c:(.text+0x39): undefined reference to pthread_detach' /usr/bin/ld: src.c:(.text+0x45): undefined reference to pthread_cancel'
/usr/bin/ld: src.c:(.text+0x56): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_66044.dir/build.make:99:cmTC_66044] 错误 1
make[1]: 离开目录“/home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp”
make: *** [Makefile:127:cmTC_66044/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/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_b5462/fast && /usr/bin/make -f CMakeFiles/cmTC_b5462.dir/build.make CMakeFiles/cmTC_b5462.dir/build
make[1]: 进入目录“/home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_b5462.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_b5462.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_b5462
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b5462.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_b5462.dir/CheckFunctionExists.c.o -o cmTC_b5462 -lpthreads
/usr/bin/ld: 找不到 -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_b5462.dir/build.make:99:cmTC_b5462] 错误 1
make[1]: 离开目录“/home/XXXX/Downloads/Sunshine-0.21.0/Sunshine-0.21.0/build/CMakeFiles/CMakeTmp”
make: *** [Makefile:127:cmTC_b5462/fast] 错误 2

本地环境CMake是3.22,高于所需的3.18,网上也没查到解决办法。

路过的大神可否给点帮助?

Reply Favorite View the author
All Replies
Ziggy
deepin
2024-03-01 09:37
#1

编译器是?有可能是v20 的glibc2.28版本太低了

Reply View the author
Signal
deepin
2024-03-01 10:43
#2
glibc的确是2.28的,源里最新的了,有其他办法么?谢谢!
Reply View the author
YL-Jack
deepin
2024-03-01 11:10
#3

https://gitee.com/spark-store-project/additional-base-lib

Reply View the author
Ziggy
deepin
2024-03-01 11:18
#4
Signal
glibc的确是2.28的,源里最新的了,有其他办法么?谢谢!

可以先换其他编译器看看,比如clang13

Reply View the author
Signal
deepin
2024-03-03 18:03
#5
YL-Jack

https://gitee.com/spark-store-project/additional-base-lib

多谢啦,可以解决创想3D的运行问题。kissing_heart

Reply View the author
YL-Jack
deepin
2024-03-03 18:15
#6
Signal

多谢啦,可以解决创想3D的运行问题。kissing_heart

不用客气

Reply View the author