GreatSQL社区

搜索

[已解决] GreatSQL-5.7.36官方源码编译失败

732 7 2024-4-8 10:04
docker容器启动centos7.9系统,官网下载GreatSQL-GreatSQL-5.7.36-39.tar.gz源码,解压后进入GreatSQL-GreatSQL-5.7.36-39/build-gs目录参考README.md执行编译源码命令
bash -xe ./percona-server-5.7_builder.sh --builddir=`pwd`/workdir --get_sources=0  --install_deps=1 --with_ssl=1 --build_tarball=1 --no_git_info=1 --local_boost=1
编译失败,CMakeError.log报错如下,找不到pthread库函数定义,可是系统是有自带libpthread库的。请教各路大神,编译失败的原因可能是什么?如何解决?谢谢!


Run Build Command(s):/usr/bin/gmake cmTC_6a78d/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_6a78d.dir/build.make CMakeFiles/cmTC_6a78d.dir/build
gmake[1]: Entering directory `/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6a78d.dir/src.c.o
/opt/rh/devtoolset-10/root/usr/bin/gcc   -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -DPERCONA_INNODB_VERSION=5.7.36 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_6a78d.dir/src.c.o   -c /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_6a78d
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/cmTC_6a78d.dir/link.txt --verbose=1
/opt/rh/devtoolset-10/root/usr/bin/gcc -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -DPERCONA_INNODB_VERSION=5.7.36 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_6a78d.dir/src.c.o  -o cmTC_6a78d
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: CMakeFiles/cmTC_6a78d.dir/src.c.o: in function `main':
/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:11: undefined reference to `pthread_create'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:12: undefined reference to `pthread_detach'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:13: undefined reference to `pthread_cancel'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:14: undefined reference to `pthread_join'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:15: undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_6a78d] Error 1
gmake[1]: Leaving directory `/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_6a78d/fast] Error 2


Source file was:
#include <pthread.h>

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/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp

系统自带的libpthread库版本如下:

[root@babb133d7dad build-gs]# ll /lib64/libpthread*
-rwxr-xr-x 1 root root 142144 May 18  2022 /lib64/libpthread-2.17.so
-rw-r--r-- 1 root root   1764 May 18  2022 /lib64/libpthread_nonshared.a
-rw-r--r-- 1 root root    222 May 18  2022 /lib64/libpthread.so
lrwxrwxrwx 1 root root     18 Feb 29 09:03 /lib64/libpthread.so.0 -> libpthread-2.17.so

请教各路大神,编译失败的原因可能是什么?如何解决?谢谢!
全部回复(7)
yejr 2024-4-8 10:09:38
GreatSQL社区微信公众号明天会推一篇MySQL 5.7编译方法的文章,届时可以参考下
gavindu85 2024-4-8 10:58:04
yejr 发表于 2024-4-8 10:09
GreatSQL社区微信公众号明天会推一篇MySQL 5.7编译方法的文章,届时可以参考下 ...

好的,另外我编译时优化了percona-server-5.7_builder.sh脚本,更新了里面mecab相关的源码包下载地址。
yejr 2024-4-9 08:55:11
gavindu85 发表于 2024-4-8 10:58
好的,另外我编译时优化了percona-server-5.7_builder.sh脚本,更新了里面mecab相关的源码包下载地址。 ...

https://mp.weixin.qq.com/s/d2v_2KIhA0vEL8L4boASTQ
gavindu85 2024-4-9 17:42:40
yejr 发表于 2024-4-8 10:09
GreatSQL社区微信公众号明天会推一篇MySQL 5.7编译方法的文章,届时可以参考下 ...

看了MySQL 5.7编译方法,没有遇到GreatSQL-5.7.36编译失败类似问题,参考不了,有GreatSQL-5.7编译方法的文章吗?
yejr 2024-4-10 09:04:06
gavindu85 发表于 2024-4-9 17:42
看了MySQL 5.7编译方法,没有遇到GreatSQL-5.7.36编译失败类似问题,参考不了,有GreatSQL-5.7编译方法的 ...

目前没有专门针对GreatSQL 5.7整理编译文档

先参考这份吧 https://greatsql.cn/docs/8032-25 ... th-source-code.html

可以把你的详细过程贴出来,包括错误日志文件
gavindu85 2024-4-15 14:27:14
yejr 发表于 2024-4-10 09:04
目前没有专门针对GreatSQL 5.7整理编译文档

先参考这份吧 https://greatsql.cn/docs/8032-25/user-manua ...

docker容器启动centos7.9系统,官网下载GreatSQL-GreatSQL-5.7.36-39.tar.gz源码,解压后进入GreatSQL-GreatSQL-5.7.36-39/build-gs目录参考README.md执行编译源码命令
bash -xe ./percona-server-5.7_builder.sh --builddir=`pwd`/workdir --get_sources=0  --install_deps=1 --with_ssl=1 --build_tarball=1 --no_git_info=1 --local_boost=1
编译失败,cmake编译详细输出及错误日志见附件,主要错误在于如下编译为何链接不到系统的libpthread库?
Run Build Command(s):/usr/bin/gmake cmTC_6a78d/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_6a78d.dir/build.make CMakeFiles/cmTC_6a78d.dir/build
gmake[1]: Entering directory `/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6a78d.dir/src.c.o
/opt/rh/devtoolset-10/root/usr/bin/gcc   -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -DPERCONA_INNODB_VERSION=5.7.36 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_6a78d.dir/src.c.o   -c /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_6a78d
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/cmTC_6a78d.dir/link.txt --verbose=1
/opt/rh/devtoolset-10/root/usr/bin/gcc -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -DPERCONA_INNODB_VERSION=5.7.36 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_6a78d.dir/src.c.o  -o cmTC_6a78d
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: CMakeFiles/cmTC_6a78d.dir/src.c.o: in function `main':
/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:11: undefined reference to `pthread_create'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:12: undefined reference to `pthread_detach'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:13: undefined reference to `pthread_cancel'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:14: undefined reference to `pthread_join'
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp/src.c:15: undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_6a78d] Error 1
gmake[1]: Leaving directory `/home/dujh/dev/greatsql/GreatSQL-GreatSQL-5.7.36-39/build-gs/workdir/TARGET/bld/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_6a78d/fast] Error 2




Source file was:
#include <pthread.h>


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;
}

cmake输出及报错.zip

49.63 KB, 下载次数: 0, 下载积分: 金币 -1

yejr 2024-4-15 15:23:57
yejr 发表于 2024-4-9 08:55
https://mp.weixin.qq.com/s/d2v_2KIhA0vEL8L4boASTQ

建议先采用本文中的编译方式,确认编译环境构建没问题后再尝试使用 percona-server-5.7_builder.sh 脚本构建。

从我以往的构建经历来看,调用 percona-server-5.7_builder.sh 构建时,通常还需要编译环境能连上墙外的服务器,因为要下载安装一些依赖包,否则很容易失败。
gavindu85

5

主题

0

博客

13

贡献

新手上路

Rank: 1

积分
21

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-11-24 10:17 , Processed in 0.024606 second(s), 22 queries , Redis On.
快速回复 返回顶部 返回列表