CentOS 7 编译安装 clickhouse_fdw 遇到的问题及解决办法

常规的编译安装操作步骤如下:

git clone https://github.com/ildus/clickhouse_fdw
sudo yum install libcurl-devel libuuid-devel
cd clickhouse_fdw
mkdir build && cd build
cmake ..
make && make install

出现的问题基本都在官方 Github 上给出解决方案了,所以如果大家安装细心的话,应该不会出现以下问题。
在这里插入图片描述

问题一:cmake 版本问题

错误:

[postgres@allinone build]$ cmake ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.5 or higher is required.  You are running version 2.8.12.2


-- Configuring incomplete, errors occurred!

解决方法:

实际上服务器上是有 cmake 3 的,只需要将命令改为 cmake3 运行即可:

cmake3 ..

问题二:

错误:

CMake Error in src/CMakeLists.txt:
  Target "clickhouse_fdw" requires the language dialect "CXX17" (with
  compiler extensions), but CMake does not know the compile flags to use to
  enable it.
...

解决方法:

需要升级 gcc:

wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.gz
tar -xvzf gcc-7.2.0.tar.gz
cd gcc-7.2.0
./contrib/download_prerequisites
./configure \
    --enable-bootstrap \
    --enable-languages=c,c++,fortran,lto \
    --with-bugurl=http://bugzilla.redhat.com/bugzilla \
    --enable-shared \
    --enable-threads=posix \
    --enable-checking=release \
    --disable-multilib \
    --with-system-zlib \
    --enable-__cxa_atexit \
    --disable-libunwind-exceptions \
    --enable-gnu-unique-object \
    --enable-linker-build-id \
    --with-gcc-major-version-only \
    --enable-plugin \
    --with-linker-hash-style=gnu \
    --enable-initfini-array \
    --enable-libmpx \
    --enable-gnu-indirect-function \
    --with-tune=generic \
    --build=x86_64-redhat-linux
make -j4
sudo make install
sudo sh -c 'echo /usr/local/lib > /etc/ld.so.conf.d/1-gcc.conf'
sudo sh -c 'echo /usr/local/lib64 >> /etc/ld.so.conf.d/1-gcc.conf'
sudo ldconfig -v

也可以根据官方提供的方案,升级编译工具:devtoolset-7
https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
具体步骤掠过。

升级完成后,将本地的 CMakeCache 删掉,重新执行即可。

问题三:

错误:

[ 58%] Building C object src/CMakeFiles/clickhouse_fdw.dir/http.c.o
In file included from /usr/include/curl/curl.h:2251:0,
                 from /home/postgres/clickhouse_fdw/src/include/clickhouse_internal.h:4,
                 from /home/postgres/clickhouse_fdw/src/http.c:10:
/home/postgres/clickhouse_fdw/src/http.c: In function ‘ch_http_simple_query’:
/home/postgres/clickhouse_fdw/src/http.c:148:31: error: ‘CURLOPT_PATH_AS_IS’ undeclared (first use in this function); did you mean ‘CURLOPT_MAIL_AUTH’?
  curl_easy_setopt(conn->curl, CURLOPT_PATH_AS_IS, 1);
                               ^
/home/postgres/clickhouse_fdw/src/http.c:148:31: note: each undeclared identifier is reported only once for each function it appears in
/home/postgres/clickhouse_fdw/src/http.c:159:32: error: ‘CURLOPT_XFERINFOFUNCTION’ undeclared (first use in this function); did you mean ‘CURLOPT_WRITEFUNCTION’?
   curl_easy_setopt(conn->curl, CURLOPT_XFERINFOFUNCTION, curl_progressfunc);
                                ^
/home/postgres/clickhouse_fdw/src/http.c:160:32: error: ‘CURLOPT_XFERINFODATA’ undeclared (first use in this function); did you mean ‘CURLOPT_WRITEDATA’?
   curl_easy_setopt(conn->curl, CURLOPT_XFERINFODATA, conn);
                                ^
make[2]: *** [src/CMakeFiles/clickhouse_fdw.dir/http.c.o] Error 1
make[1]: *** [src/CMakeFiles/clickhouse_fdw.dir/all] Error 2
make: *** [all] Error 2

解决方法:

从这里下载 curl 的所有包:https://cbs.centos.org/koji/buildinfo?buildID=1408
上传到服务器上,然后执行安装:

sudo rpm -Uvh  *curl*rpm --nodeps
sudo yum install libmetalink

End~

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿福Chris

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值