Skip to content

eXtremeDB问题记录

make 失败

问题描述

解压extremedb_8.3_fusion_linux_arm64_eval.tar.gz后,在eXtremeDB根目录运行make 报错:

bash
make: *** [/home/wwu/eXtremeDB/include/rules.makefile:717: /home/wwu/eXtremeDB/samples/native/core/00-ddl/obj-00-ddl-Linux-arm64-exec-offs-ndbg/sampleddl.h] Error 2

当前运行环境:

bash
# uname -a
Linux rt-ics 4.19.232-rt104 (RK3568_WEB-S3568-V11_g95c42ce9d) #8 SMP PREEMPT RT Fri Apr 28 14:36:39 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

# gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

# gcc -dumpmachine
aarch64-linux-gnu

# ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31

原因分析

  1. 根据文档Step 1: Database Definition 定义 mydb.mco ,在 host/bin 下输入命令:

    bash
    # ../../host/bin/mcocomp mydb.mco

    报错:

    bash
    bash: ../../host/bin/mcocomp: cannot execute binary file: Exec format error

    该版本的DDL编译器(mcocomp)是x86_64主机平台的,无法在ARM上运行。 下载arm平台的DDL编译器替换原 mcocomp,重新 make,报错:

    bash
    make: *** [/home/wwu/eXtremeDB/include/rules.makefile:717: /home/wwu/eXtremeDB/samples/native/core/00-ddl/obj-00-ddl-Linux-arm64-exec-offs-ndbg/sampleddl.h] Error 1
  2. 继续在 host/bin 下输入命令:

    bash
    # ../../host/bin/mcocomp mydb.mco

    报错:

    bash
     ../../host/bin/mcocomp: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ../../host/bin/mcocomp)

    查看系统glibc库版本:

    bash
     # strings /lib/aarch64-linux-gnu/libc.so.6 |grep GLIBC_
     GLIBC_2.17
     GLIBC_2.18
     GLIBC_2.22
     GLIBC_2.23
     GLIBC_2.24
     GLIBC_2.25
     GLIBC_2.26
     GLIBC_2.27
     GLIBC_2.28
     GLIBC_2.29
     GLIBC_2.30
     GLIBC_PRIVATE

    网上查找的教程都说升级glibc库很有可能导致系统崩溃,但技术支持不给回复。

  3. 尝试安装更高版本的glibc库。网上查到的方案:

    If you need glibc version other than the one shipped with ubuntu, one way is to install manually to a temp location in your $HOME. (installing in /usr would mess up with existing glibc in case something goes wrong)

    bash
    mkdir $HOME/glibc/ && cd $HOME/glibc
    wget <http://ftp.gnu.org/gnu/libc/glibc-2.32.tar.gz>
    tar -xvzf glibc-2.32.tar.gz
    mkdir build
    mkdir glibc-2.32-install
    cd build
    ~/glibc/glibc-2.32/configure --prefix=$HOME/glibc/glibc-2.32-install
    make
    make install

    Now you should have glibc 2.32 installed in the installation directory check with ~/glibc/glibc-2.32-install/bin/ldd --version

    下载glibc-2.34,到./configure这步报错:

    bash
    # ../glibc-2.34/configure --prefix=/home/wwu/glibc/glibc-2.34-install
    
    configure: error:
    ***These critical programs are missing or too old: gawk bison
    *** Check the INSTALL file for required versions.

    缺少 gawk 和 bison 这两个包。

    1. gawk 下载地址: gawk

      解压后执行命令配置编译:

      bash
      ./configure --prefix=/usr/local/gawk4.2
      make

      如果想要测试结果,可以运行下面这个命令行检测:

      bash
      make check

      安装软件包:

      bash
      make install

      创建软链接:

      bash
      ln -s /usr/local/gawk4.2/bin/awk /usr/bin/gawk
    2. bison 下载地址: bison

      解压后执行命令配置编译:

      bash
      ./configure
      make

      如果想要测试结果,可以运行下面这个命令行检测:

      bash
      make check

      安装软件包:

      bash
      make install

      检查版本:

      bash
      bison -V

    至此,glibc-2.34安装成功:

    bash
    # glibc-2.34-install/bin/ldd --version
    ldd (GNU libc) 2.34
  4. 修改软链接

    bash
    # ll /lib/aarch64-linux-gnu/libc.so.6
    lrwxrwxrwx 1 root root 12 Apr  7  2022 /lib/aarch64-linux-gnu/libc.so.6 -> libc-2.31.so*
    # cp -d /lib/aarch64-linux-gnu/libc.so.6 /lib/aarch64-linux-gnu/libc.so.6.bak # 备份软链接
    # ll /lib/aarch64-linux-gnu/libc.so.6.bak
    lrwxrwxrwx 1 root root 12 Jun 13 20:16 /lib/aarch64-linux-gnu/libc.so.6.bak -> libc-2.31.so*
    
    # ln -sf /home/wwu/glibc/glibc-2.34-install/lib/libc.so.6 /lib/aarch64-linux-gnu/libc.so.6
    # ll /lib/aarch64-linux-gnu/libc.so.6.bak
    Segmentation fault

    喜提 Segmentation fault

    恢复原来的软链接。

解决方案

还得是技术支持。

技术支持应该是在x86-64平台上重建了项目,参考:

If your host platform is x86_64 Linux, in order to build the samples please un-tar the tarball on the host machine, and make sure that the toolchain is accessible:

$ export PATH=/opt/toolchains/gcc-11.3/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu/bin:$PATH

Then navigate to the eXtremeDB root installation directory and run the following command (on the host server):

$ make TARGET_PLATFORM=aarch64-none-linux-gnu all

不同的目标环境需要不同的 toolchain 。

抽空学习一下交叉编译。

基于 VitePress 构建