在docker中编译OB初始化时报错

【 使用环境 】 测试环境
【 OB 】
【 使用版本 】最新版本
【问题描述】在docker中构建ob出错 fatal error: ‘os/signpost.h’ file not found
【复现路径】

dockerfile如下

FROM centos:7

RUN yum install -y yum-utils
RUN yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo

RUN yum install -y obclient

RUN yum install -y ob-deploy
RUN source /etc/profile.d/obd.sh

RUN yum -y install git
RUN git clone https://github.com/oceanbase/oceanbase.git

WORKDIR /oceanbase/
RUN yum install -y wget rpm* cpio make glibc-devel glibc-headers binutils
RUN sh build.sh --init

【问题现象及影响】
运行
sh build.sh --init

输出

-- observer_add_target ob_sql_simd
CMake Error at src/sql/CMakeLists.txt:1129 (message):
  Generate sql parser failed and check error in
  /oceanbase/src/sql/parser/_gen_parser.error


-- Configuring incomplete, errors occurred!
See also "/oceanbase/build_debug/CMakeFiles/CMakeOutput.log".
See also "/oceanbase/build_debug/CMakeFiles/CMakeError.log".
[build.sh][ERROR] Failed to generate Makefile

其中 /oceanbase/build_debug/CMakeFiles/CMakeError.log 的内容为

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
clang version 11.0.1 (git@gitlab.alibaba-inc.com:oceanbase-ce-publish/ob-deps.git 0235b6078aa2a9f8dc8f65ec5e94ce5d1394f022)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /oceanbase/deps/3rd/usr/local/oceanbase/devtools/bin
Determining if the os_signpost_interval_begin exist failed with the following output:
Change Dir: /oceanbase/build_debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_81cc0/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_81cc0.dir/build.make CMakeFiles/cmTC_81cc0.dir/build
gmake[1]: Entering directory `/oceanbase/build_debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_81cc0.dir/CheckSymbolExists.c.o
/oceanbase/deps/3rd/usr/local/oceanbase/devtools/bin/clang   --gcc-toolchain=/oceanbase/deps/3rd/usr/local/oceanbase/devtools -fdebug-prefix-map=/oceanbase=.  -fcolor-diagnostics -ffunction-sections -funique-internal-linkage-names -fdebug-info-for-profiling -fmax-type-align=8   -DFATAL_ERROR_HANG -fPIC -Werror=date-time -Werror=unguarded-availability-new -w  -fPIE -MD -MT CMakeFiles/cmTC_81cc0.dir/CheckSymbolExists.c.o -MF CMakeFiles/cmTC_81cc0.dir/CheckSymbolExists.c.o.d -o CMakeFiles/cmTC_81cc0.dir/CheckSymbolExists.c.o -c /oceanbase/build_debug/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/oceanbase/build_debug/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:10: fatal error: 'os/signpost.h' file not found
#include <os/signpost.h>
         ^~~~~~~~~~~~~~~
1 error generated.
gmake[1]: *** [CMakeFiles/cmTC_81cc0.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory `/oceanbase/build_debug/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_81cc0/fast] Error 2


File /oceanbase/build_debug/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <os/signpost.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef os_signpost_interval_begin
  return ((int*)(&os_signpost_interval_begin))[argc];
#else
  (void)argc;
  return 0;
#endif
}

【附件】

1 个赞

宿主机是什么操作系统,是Ubuntu 22吗?

是centos 7
CentOS Linux release 7.9.2009 (Core)
Linux version 3.10.0-1160.80.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) )、

在centos7的宿主机上,安装了一个centos7的docker镜像?

是的,你那边能够复现这个问题吗

我也有同样的问题,报错的内容和Anobody的完全一致,我在以下环境下试过都是一样的:

  1. 宿主机是Ubuntu 20.04.5 LTS,Docker是从oceanbase/centos7:latest拉取的。
    2.宿主机是Ubuntu 20.04.5 LTS,用的是VM Workstation Pro 15安装的centos7.6。

问题原因

这个报错出现是在cmake生成makefile阶段,运行src/sql/parser/gen_parser.sh抛出的异常,定位到是由于m4依赖缺失导致的,大概率是用户没有按照官网的wiki去编译导致的

问题解决

根据官方安装安装m4依赖即可

文档地址

以centos为例子:


yum install git wget rpm* cpio make glibc-devel glibc-headers binutils m4

by the way:错误提示不够直接,可以优化一下

如果m4已经安装,还是遇到类似问题:
可以
cd src/sql/parser
手动执行一下
bash gen_parser.sh
看看有没有错误信息来帮助解决问题

1 个赞