armv7交叉编译rsyslog

时间:2024-03-01 17:13:37

armv7交叉编译rsyslog

范围

本文档描述如何对rsyslog进行交叉编译,使其可以工作在zynq设备(armv7)上。研发人员可以根据该文档将相关源码包及编译过程加入到自动编译环境中。

依赖库列表

  • libestr-0.1.11
  • libuuid-1.0.3
  • libfastjson-0.99.8
  • libgcrypt-1.8.7
  • libgpg-error-1.39
  • curl-7.74.0
  • zlib-1.2.11

编译libestr

获取源码

wget http://libestr.adiscon.com/files/download/libestr-0.1.11.tar.gz

编译

tar -xvf libestr-0.1.11.tar.gz
cd libestr-0.1.11/
#仅安装库文件到目录下
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib 
make
make install
cd -

编译libfastjson

获取源码

wget http://download.rsyslog.com/libfastjson/libfastjson-0.99.8.tar.gz

编译

tar -xvf libfastjson-0.99.8.tar.gz
cd libfastjson-0.99.8/
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib 
make
make install
cd -

编译zlib

获取源码

#源码地址:http://prdownloads.sourceforge.net/libpng/zlib-1.2.11.tar.xz?download
wget https://udomain.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.xz

编译

cd zlib-1.2.11/
export CC=arm-linux-gnueabihf-gcc
export LD=arm-linux-gnueabihf-ld
export AR=arm-linux-gnueabihf-ar
./configure  --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib --includedir=/root/rsyslog/include
make
make install
cd -
unset CC
unset LD
unset AR

编译libuuid

获取源码

#https://sourceforge.net/projects/libuuid/
wget https://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz

编译

tar -xvf libuuid-1.0.3.tar.gz
cd libuuid-1.0.3/
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib
make
make install
cd -

编译libgpg-error

获取源码

wget https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.39.tar.bz2

编译

tar -xvf libgpg-error-1.39.tar.bz2 
cd libgpg-error-1.39/
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib
make
make install
cd -

编译libgcrypt

源码获取

wget https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.7.tar.bz2

编译

tar -xvf libgcrypt-1.8.7.tar.bz2
cd libgcrypt-1.8.7/
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib --with-libgpg-error-prefix=/tmp/rsyslog
make
make install
cd -
#解决rsyslog进行configure时报错error: libgcrypt-config not found in PATH
export PATH=$PATH:/tmp/rsyslog/bin

编译curl

源码获取

wget https://curl.se/download/curl-7.74.0.tar.gz

编译

tar -xvf curl-7.74.0.tar.gz
cd curl-7.74.0/
./configure --host=arm-linux-gnueabihf 
make
make install
cd -

编译rsyslog

源码获取

wget https://www.rsyslog.com/files/download/rsyslog/rsyslog-8.2012.0.tar.gz

编译

tar -xvf rsyslog-8.2012.0.tar.gz
cd cd rsyslog-8.2012.0/
./configure --host=arm-linux-gnueabihf --prefix=/tmp/rsyslog --libdir=/root/rsyslog/lib --bindir=/root/rsyslog/bin/ --sbindir=/root/rsyslog/bin/ PKG_CONFIG_PATH=/root/rsyslog/lib/pkgconfig CFLAGS="-I
/root/rsyslog/include"
make
make install
cd -