这是一次失败的尝试,如果是寻找解决方案的请离开,如果有想一起探讨的大神,可以看下我安装的过程,并在评论区留言,非常感谢。
经过如下过程的尝试,最终证明了,arm架构的centos7.6是无法安装GCC-5.4的。
但是华为的客服说此版本自带的GCC-4.8.5也是可以支持PostGIS的,我会另起一篇文章记录过程。
PostGIS概述
PostGIS Extension是PostgreSQL的空间数据库扩展,提供如下空间信息服务功能:空间对象、空间索引、空间操作函数和空间操作符。PostGIS Extension完全遵循OpenGIS规范。GaussDB 200提供PostGIS Extension(版本为PostGIS-2.4.2)。
GaussDB 200中PostGIS Extension依赖第三方开源软件如下。依赖的第三方软件需要用户进行单独安装,具体请参考PostGIS安装。
- Geos 3.6.2
- Proj 4.9.2
- Json 0.12.1
- Libxml2 2.7.1
PostGIS安装
GaussDB 200数据库的PostGIS Extension源码包可通过网站获取。该Extension需使用GCC-5.4(GNU编译器套件)进行编译安装。在整个安装过程中,可使用make -sj和make install -sj命令并行加速编译,-sj命令极低概率性出现安装错误,如果安装失败则请使用make和make install进行串行安装。
GCC-5.4
GCC-5.4(GNU编译器套件)编译器安装。若集群中已经安装GCC-5.4编译器,可直接跳过本步骤。
PostGIS安装依赖GCC-5.4编译器。GCC-5.4编译器推荐使用源码由低版本的gcc和g++编译器进行升级安装。若集群中没有低版本gcc和g++编译器,可以通过挂载操作系统镜像等方法进行安装,这里不做赘述。GCC-5.4编译器相关依赖软件包,包括gcc-5.4.0、gmp-4.3.2、mpfr-2.4.2、mpc-1.0.3,安装包下载地址分别为:
gcc-5.4.0 gmp-4.3.2 mpfr-2.4.2 mpc-1.0.3
启动环境变量
以操作系统用户omm登录安装有MPPDB服务的任一主机。执行source ${BIGDATA_HOME}/mppdb/.mppdbgs_profile命令启动环境变量。
su - omm
source ${BIGDATA_HOME}/mppdb/.mppdbgs_profile
创建安装目录
创建GCC安装主目录GAUSSHOME/gcc/packages,并下载软件包gcc-5.4.0.tar.gz、gmp-4.3.2.tar.gz、mpc-1.0.3.tar.gz、mpfr-2.4.2.tar.gz至$GAUSSHOME/gcc/packages目录。
mkdir $GAUSSHOME/gcc
mkdir $GAUSSHOME/gcc/packages
mv gcc-5.4.0.tar.gz $GAUSSHOME/gcc/packages/gcc-5.4.0.tar.gz
mv gmp-4.3.2.tar.gz $GAUSSHOME/gcc/packages/gmp-4.3.2.tar.gz
mv mpc-1.0.3.tar.gz $GAUSSHOME/gcc/packages/mpc-1.0.3.tar.gz
mv mpfr-2.4.2.tar.gz $GAUSSHOME/gcc/packages/mpfr-2.4.2.tar.gz
mv postgis-xc-master.zip $GAUSSHOME/gcc/packages/postgis-xc-master.zip
解压下载软件
cd $GAUSSHOME/gcc/packages
tar -xzf gcc-5.4.0.tar.gz
tar -xzf gmp-4.3.2.tar.gz
tar -xzf mpc-1.0.3.tar.gz
tar -xzf mpfr-2.4.2.tar.gz
创建GCC安装目录
mkdir $GAUSSHOME/gcc/gcc-5.4.0
mkdir $GAUSSHOME/gcc/gcc-5.4.0/depend
mkdir $GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2
mkdir $GAUSSHOME/gcc/gcc-5.4.0/depend/mpfr-2.4.2
mkdir $GAUSSHOME/gcc/gcc-5.4.0/depend/mpc-1.0.3
mkdir $GAUSSHOME/gcc/gcc-5.4.0/depend/gcc
安装gmp-4.3.2
进入$GAUSSHOME/gcc/packages/gmp-4.3.2目录,执行下列命令完成gmp安装操作。
cd $GAUSSHOME/gcc/packages/gmp-4.3.2
- 生成Makefile文件
./configure --prefix $GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2 --build=aarch64-unknown-linux-gnu
因为我的系统是arm架构的,会报如下错误信息
checking build system type... ./configfsf.guess: unable to guess system type
This script, last modified 2008-04-14, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run (./configfsf.guess) is already up to date, please
send the following data and any information you think might be
pertinent to in order to provide the needed
information to handle your system.
config.guess timestamp = 2008-04-14
uname -m = aarch64
uname -r = 4.14.0-115.el7a.0.1.aarch64
uname -s = Linux
uname -v = #1 SMP Sun Nov 25 20:54:21 UTC 2018
/usr/bin/uname -p = aarch64
/bin/uname -X =
hostinfo =
/bin/universe =
/usr/bin/arch -k =
/bin/arch = aarch64
/usr/bin/oslevel =
/usr/convex/getsysinfo =
UNAME_MACHINE = aarch64
UNAME_RELEASE = 4.14.0-115.el7a.0.1.aarch64
UNAME_SYSTEM = Linux
UNAME_VERSION = #1 SMP Sun Nov 25 20:54:21 UTC 2018
configure: error: cannot guess build type; you must specify one
从错误提示看,不能有效的识别的我的系统类型,但是给出了解决方案,就是根据官方地址给出的内容,更新两个配置文件config.guess、config.sub,官方内容如下:
config.guess
config.sub
修改之后重新执行configure,可以顺利通过了。
- 编译
make -sj
- 安装
make install -sj
安装mpfr-2.4.2
进入$GAUSSHOME/gcc/packages/mpfr-2.4.2目录,执行以下命令完成mpfr安装操作。
cd $GAUSSHOME/gcc/packages/mpfr-2.4.2
- 生成Makefile文件
./configure --prefix $GAUSSHOME/gcc/gcc-5.4.0/depend/mpfr-2.4.2 --with-gmp=$GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2 --build=aarch64-unknown-linux-gnu
出现同样的报错信息。
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to disable maintainer-specific portions of Makefiles... yes
checking build system type... ./config.guess: unable to guess system type
This script, last modified 2009-06-10, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to in order to provide the needed
information to handle your system.
config.guess timestamp = 2009-06-10
uname -m = aarch64
uname -r = 4.14.0-115.el7a.0.1.aarch64
uname -s = Linux
uname -v = #1 SMP Sun Nov 25 20:54:21 UTC 2018
/usr/bin/uname -p = aarch64
/bin/uname -X =
hostinfo =
/bin/universe =
/usr/bin/arch -k =
/bin/arch = aarch64
/usr/bin/oslevel =
/usr/convex/getsysinfo =
UNAME_MACHINE = aarch64
UNAME_RELEASE = 4.14.0-115.el7a.0.1.aarch64
UNAME_SYSTEM = Linux
UNAME_VERSION = #1 SMP Sun Nov 25 20:54:21 UTC 2018
configure: error: cannot guess build type; you must specify one
同样根据官方提供的材料更新对应的脚本。
config.guess
config.sub
- 编译
make -sj
- 安装
make install -sj
安装mpc-1.0.3
进入$GAUSSHOME/gcc/packages/mpc-1.0.3目录,执行下列命令完成mpc安装操作。
cd $GAUSSHOME/gcc/packages/mpc-1.0.3
- 生成Makefile文件
./configure --prefix=$GAUSSHOME/gcc/gcc-5.4.0/depend/mpc-1.0.3 --with-gmp=$GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2 --with-mpfr=$GAUSSHOME/gcc/gcc-5.4.0/depend/mpfr-2.4.2 --build=aarch64-unknown-linux-gnu
这次没有报错,顺利往下进行。
- 编译
make -sj
- 安装
make install -sj
安装gcc-5.4.0
- 添加lib路径至~/.bashrc。
在vim编辑器中打开~/.bashrc文档。
vim ~/.bashrc
添加以下内容:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2/lib:$GAUSSHOME/gcc/gcc-5.4.0/depend/mpfr-2.4.2/lib:$GAUSSHOME/gcc/gcc-5.4.0/depend/mpc-1.0.3/lib
执行如下命令使设置生效。
source ~/.bashrc
- 进入$GAUSSHOME/gcc/packages/gcc-5.4.0目录
cd $GAUSSHOME/gcc/packages/gcc-5.4.0
我再做这一步的是报了如下错误
-bash: cd: /opt/huawei/Bigdata/om-server_6.5.1/OMS/gaussdb/gcc/packages/gcc-5.4.0: No such file or directory
原因是环境变量$GAUSSHOME失效了,应该是上一步添加lib造成的,重新执行了启动环境变量的脚本。
source ${BIGDATA_HOME}/mppdb/.mppdbgs_profile
- 生成Makefile文件
./configure --prefix=$GAUSSHOME/gcc/gcc-5.4.0/depend/gcc -disable-multilib --with-gmp=$GAUSSHOME/gcc/gcc-5.4.0/depend/gmp-4.3.2 -enable-languages=c,c++ --with-mpfr=$GAUSSHOME/gcc/gcc-5.4.0/depend/mpfr-2.4.2 --with-mpc=$GAUSSHOME/gcc/gcc-5.4.0/depend/mpc-1.0.3 --build=aarch64-unknown-linux-gnu
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... no
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
- 编译
make -sj
报错
Cleaning up unneeded directories:
fixincludes is done
mkdir -p -- aarch64-unknown-linux-gnu/libgcc
Checking multilib configuration for libgcc...
Configuring stage 1 in aarch64-unknown-linux-gnu/libgcc
configure: creating cache ./config.cache
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /bin/install -c
checking for gawk... gawk
checking for aarch64-unknown-linux-gnu-ar... ar
checking for aarch64-unknown-linux-gnu-lipo... lipo
checking for aarch64-unknown-linux-gnu-nm... /opt/huawei/Bigdata/mppdb/core/gcc/packages/gcc-5.4.0/host-aarch64-unknown-linux-gnu/gcc/nm
checking for aarch64-unknown-linux-gnu-ranlib... ranlib
checking for aarch64-unknown-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for aarch64-unknown-linux-gnu-gcc... /opt/huawei/Bigdata/mppdb/core/gcc/packages/gcc-5.4.0/host-aarch64-unknown-linux-gnu/gcc/xgcc -B/opt/huawei/Bigdata/mppdb/core/gcc/packages/gcc-5.4.0/host-aarch64-unknown-linux-gnu/gcc/ -B/opt/huawei/Bigdata/mppdb/core/gcc/gcc-5.4.0/depend/gcc/aarch64-unknown-linux-gnu/bin/ -B/opt/huawei/Bigdata/mppdb/core/gcc/gcc-5.4.0/depend/gcc/aarch64-unknown-linux-gnu/lib/ -isystem /opt/huawei/Bigdata/mppdb/core/gcc/gcc-5.4.0/depend/gcc/aarch64-unknown-linux-gnu/include -isystem /opt/huawei/Bigdata/mppdb/core/gcc/gcc-5.4.0/depend/gcc/aarch64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/opt/huawei/Bigdata/mppdb/core/gcc/packages/gcc-5.4.0/aarch64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
- 安装
make install -sj
然后,就没有然后了。