错误找不到-lz在基于debian的容器上构建MariaDB

时间:2016-11-13 17:22:18

标签: docker mariadb

我试图在基于Debian的容器上构建MariaDB。但它无法找到z库。

这是容器图像脚本:

FROM debian

RUN apt-get update
RUN apt-get install -y libncurses-dev
RUN apt-get install -y build-essential;
RUN apt-get install -y cmake;

COPY mariadb-10.1.18.tar.gz /usr/bin/
WORKDIR /usr/bin/
RUN gzip -d mariadb-10.1.18.tar.gz
RUN tar -xvf mariadb-10.1.18.tar
RUN ln -s mariadb-10.1.18 mariadb

WORKDIR /usr/bin/mariadb/
RUN mkdir install; mkdir install/data; mkdir install/var; mkdir install/etc; mkdir install/tmp

RUN cd /usr/bin/mariadb/;
RUN rm -f CMakeCache.txt;
RUN cmake \
  -DCMAKE_INSTALL_PREFIX=/usr/bin/mariadb/install \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DMYSQL_DATADIR=/usr/bin/mariadb/install/data \
  -DDOWNLOAD_BOOST=1 \
  -DWITH_BOOST=/usr/bin/mariadb/install/boost \
  -DMYSQL_UNIX_ADDR=/usr/bin/mariadb/install/tmp/mariadb.sock

控制台输出:

[ 77%] Building CXX object storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/log_print.cc.o
Linking CXX shared library libft.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/build.make:1323: recipe for target 'storage/tokudb/PerconaFT/ft/libft.so' failed
make[2]: *** [storage/tokudb/PerconaFT/ft/libft.so] Error 1
CMakeFiles/Makefile2:3438: recipe for target 'storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all' failed
make[1]: *** [storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c make' returned a non-zero code: 2

1 个答案:

答案 0 :(得分:1)

更改容器脚本并指定CMake参数-DWITH_ZLIB=bundled以在extra / zlib中使用zlib源或通过apt-get install zlib-devel安装zlib