Cross-compiling build logrotate tools

Source: Internet
Author: User
Tags zip
Logrotate is an important tool for log management in Linux, which can automatically truncate (or round) logs, compress, and delete old log files. In the distribution of the desktop or server Linux system This tool is generally easier to install, or default has been brought, but embedded systems generally need to build their own through the source code.
This article explains how to construct logrotate by cross-tool chain.
Since Logrotate relies on the popt library, it is necessary to build the Popt library to build logrotate and then build popt with the Logrotate library.
First, build popt libraryDownload the latest Master branch source package from Https://github.com/devzero2000/POPT Popt-master.zip
1. Extract Popt-master.zip to/home/warmbobo/tools/popt-master/directory, enter this source directory
2. Generate the Configure file
#./autogen.sh
3. Configuring the Cross-compilation environment
1) Create the installation directory
# mkdir Install
2) Add Cross tool chain environment variables
# Export path= $PATH:/home/warmbobo/crosstool/arm-unknown-linux-gnueabi/bin/
3) Configuring the compilation Environment
#./configure--prefix=/home/warmbobo/tools/popt-master/install/--host=arm-linux
4. Build
1) Make
2) make install
The build will generate "include Lib share" three directories in/home/warmbobo/tools/popt-master/install/, where the Lib directory has logrotate compile and run the required library files, The Include directory has the header files we need to compile logrotate.
ii. Construction of LogrotateDownload the latest source code Logrotate-master.zip from Https://github.com/logrotate/logrotate.
1. Unzip and enter the source path/home/warmbobo/tools/logrotate-master/
2. Generate the Configure file
#./autogen.sh
3. Configuring the Cross-compilation environment
1) Add Cross tool chain environment variables
# Export path= $PATH:/home/warmbobo/crosstool/arm-unknown-linux-gnueabi/bin/
2) Configuring the compilation Environment
#./configure--host=arm-linux--prefix=/home/warmbobo/tools/logrotate-master/install/ldflags=-l/home/warmbobo/ Tools/popt-master/install/lib Cppflags=-i/home/warmbobo/tools/popt-master/install/include
Where ldflags specifies logrotate to compile the dependent library lpopt path, whereas cppflags specifies logrotate to compile the dependent header file Popt.h path.
4. Build
1) Make
2) make install
The Sbin/logrotate file is generated in the/home/warmbobo/tools/logrotate-master/install/directory when it is built.
Three, single board operationCopy the compiled generated logrotate file to the/sbin directory of the board, and copy all lib/* files generated by the popt compilation to the single Board/lib/directory:
    Then you can run the logrotate command.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.