第一步:首先安装编译环境 yum -y install gcc-c++ lzo-devel zlib-devel autoconf automake libtool make 第二步:下载源码包并解压 wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz tar -zxvf lzo-2.10.tar.gz cd lzo-2.10/
编译后可能会遇到以下错误,出现错误的原因是源码中缺少对龙芯loongarch架构的支持:
configure: Configuring LZO 2.10 checking build system type... autoconf/config.guess: unable to guess system type This script (version 2017-02-07), has failed to recognize the operating system you are using. If your script is old, overwrite config.guess and config.sub with the latest versions from: http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub If autoconf/config.guess has already been updated, send the following data and any information you think might be pertinent to config-patches@gnu.org to provide the necessary information to handle your system. config.guess timestamp = 2017-02-07 uname -m = loongarch64 uname -r = 4.19.190-2.lns8.loongarch64 uname -s = Linux uname -v = #1 SMP Sat Sep 18 06:47:40 UTC 2021 /usr/bin/uname -p = loongarch64 /bin/uname -X = hostinfo = /bin/universe = /usr/bin/arch -k = /bin/arch = loongarch64 /usr/bin/oslevel = /usr/convex/getsysinfo = UNAME_MACHINE = loongarch64 UNAME_RELEASE = 4.19.190-2.lns8.loongarch64 UNAME_SYSTEM = Linux UNAME_VERSION = #1 SMP Sat Sep 18 06:47:40 UTC 2021 configure: error: cannot guess build type; you must specify one
解决以上错误需要修改以下两个文件,在编译配置中增加对loongarch的支持:
第一个:autoconf/config.guess
[root@localhost lzo-2.10]# cd autoconf/ [root@localhost autoconf]# vi config.guess
在行476下添加对loongarch架构的支持:
loongarch64:*:*) echo loongarch64 4exit ;;
在行1000下添加对loongarch64下系统的支持:
loongarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;;
保存:
:wq
第二个:autoconf/config.sub
[root@localhost autoconf]# vi config.sub
在行274下增加CPU的支持语句:
| loongarch64 \
在行400下增加cpu类型的说明:
| loongarch64-* \
保存:
:wq
完成以下修改后重新进行配置和编译:
重新配置:
./configure -enable-shared -prefix=/opt/hadoop/lzo/
# 开始编译安装 make make install
编译成功后,可以在/opt/hadoop/lzo/看到生成编译后的文件