CentOS method of using Checkinstall to make RPM package

Source: Internet
Author: User
Tags documentation gettext locale centos rpmbuild

First, the installation of Checkinstall
Currently the latest version is 1.6.2, you can download the installation in the following way.

The code is as follows Copy Code
wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz
Tar zxvf checkinstall-1.6.2.tar.gz
CD checkinstall-1.6.2
Make && make install

However, when I install on the centos6.5 X64, it is not as simple as the above write, you may encounter the following problems in the installation process, you need to solve.

Problem 1, make when MSGFMT error

The error content is:

/bin/sh:line 5:msgfmt:command not found
Make: * * * [ALL] Error 1
This can be addressed by installing the GetText package:

The code is as follows Copy Code
[Root@localhost ~]# Rpm-qf/usr/bin/msgfmt
Gettext-0.17-16.el6.x86_64

Problem 2, make when Installwatch error

The error content is as follows:

The code is as follows Copy Code
[Root@localhost checkinstall-1.6.2]# make
for file in Locale/checkinstall-*.po; Todo
Case ${file} in
LOCALE/CHECKINSTALL-TEMPLATE.PO);;
*)
Out= ' echo $file | Sed-s ' s/po/mo/';
Msgfmt-o ${out} ${file};
If [$?!= 0]; Then
Exit 1;
fi;
;;
ESAC;
Done
Make-c Installwatch
MAKE[1]: Entering directory '/usr/local/src/checkinstall-1.6.2/installwatch '
Gcc-wall-c-d_gnu_source-dpic-fpic-d_reentrant-dversion= "0.7.0beta7" installwatch.c
installwatch.c:2942:error:conflicting types for ' readlink '
/usr/include/unistd.h:828:note:previous declaration of ' Readlink ' is here
installwatch.c:3080:error:conflicting types for ' Scandir '
/usr/include/dirent.h:252:note:previous declaration of ' Scandir ' is here
MAKE[1]: * * * [INSTALLWATCH.O] Error 1
MAKE[1]: Leaving directory '/usr/local/src/checkinstall-1.6.2/installwatch '
Make: * * * [ALL] Error 2

This error requires modification of the Installwatch/installwatch.c file, and the specific parts that need to be modified are as follows:

Modify 101 Lines

The code is as follows Copy Code

static int (*true_scandir) (const char *,struct dirent * * *,
Int (*) (const struct dirent *),
Int (*) (const void *,const void *));
To
static int (*true_scandir) (const char *,struct dirent * * *,
Int (*) (const struct dirent *),
Int (*) (const struct dirent **,const struct dirent *));
Modify the 121 lines at:

static int (*true_scandir64) (const char *,struct dirent64 * * *,
Int (*) (const struct Dirent64 *),
Int (*) (const void *,const void *));
To
static int (*true_scandir64) (const char *,struct dirent64 * * *,
Int (*) (const struct Dirent64 *),
Int (*) (const struct Dirent64 **,const struct dirent64 *));
Modify the 2941 lines:

#if (Glibc_minor <= 4)
To
#if (0)
Modify the 3080 lines:

int Scandir (const char *dir,struct dirent ***namelist,
Int (*select) (const struct dirent *),
Int (*compar) (const void *,const void *)) {
To
int Scandir (const char *dir,struct dirent ***namelist,
Int (*select) (const struct dirent *),
Int (*compar) (const struct dirent **,const struct dirent *)) {
Modify the 3692 lines:

int scandir64 (const char *dir,struct dirent64 ***namelist,
Int (*select) (const struct Dirent64 *),
Int (*compar) (const void *,const void *)) {
To
int scandir64 (const char *dir,struct dirent64 ***namelist,
Int (*select) (const struct Dirent64 *),
Int (*compar) (const struct Dirent64 **,const struct Dirent64 *)) {

Finish before making.

Installed on Ubuntu, because you can use apt to install directly, so did not encounter the above mentioned problems, in the CentOS encountered problems reference: Http://www.patrickmin.com/linux/tip.php?name= Checkinstall_fedora_13

Question 3, rpmbuild error

After the previous two problems are resolved, Checkinstall appears to be normal, but the following error is encountered during use.

/root/rpmbuild has no SOURCES directory. Please write the path to
The RPM source directory tree:
The reason for this problem is because Checkinstall still need rpmbuild to do the underlying support, if not installed Rpmbuild, will appear above the error. The workaround is as follows:

The code is as follows Copy Code
Yum install gcc rpm-build pcre-devel rpmdevtools

After the installation is complete, you will need to run the Rpmdev-setuptree command to create a catalog view, as follows:

#rpmdev-setuptree
#cd/root
#tree-L 1 rpmbuild/
rpmbuild/
├──build
├──rpms
├──sources
├──specs
└──srpms
Question 4, ld.so error

The error occurs under the x64 system, and the x86 system does not have the problem. The error here is also in the process of generating RPM package Checkinstall, the error content is:

ERROR:ld.so:object '/usr/local/lib64/installwatch.so ' from ld_preload cannot to be preloaded:ignored.
The workaround is as follows:

[Root@localhost ~]# echo "/usr/local/lib64" >/etc/ld.so.conf.d/installwatch.conf
[Root@localhost ~]# ln-s/usr/local/lib/installwatch.so/usr/local/lib64/installwatch.so
[Root@localhost ~]# Ldconfig
Second, Checkinstall make RPM package
Here take Tengine as an example, make a tengine rpm package, the following steps:

The code is as follows Copy Code
[Root@localhost Src]tar ZXVF tengine-2.0.1.tar.gz
[Root@localhost SRC]CD tengine-2.0.1
[Root@localhost tengine-2.0.1]#./configure--prefix=/usr/local--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--user=nginx--group=nginx
--with-http_ssl_module--with-http_flv_module
--with-http_stub_status_module
--with-http_gzip_static_module
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--with-pcre--with-http_realip_module
--with-http_addition_module
--with-http_sub_module--with-http_dav_module
--with-http_mp4_module--with-http_random_index_module
--with-http_secure_link_module--with-file-aio--with-http_upstream_check_module
--with-http_limit_conn_module=shared
--with-http_limit_req_module=shared
[Root@localhost tengine-2.0.1] #make
[Root@localhost tengine-2.0.1]# Checkinstall
Checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz
This software is released under the GNU GPL.
The package documentation directory./doc-pak does not exist.
Should I Create a default set of package docs? [Y]: Y
Preparing Package Documentation ... Ok
Please choose the packaging method for you want to use.
Slackware [S], RPM [R] or Debian [D]? R
Please write a description for the package.
End your description with a empty line or EOF.
>> Tengine for 361way.com
>>
**************************************
RPM Package Creation Selected * * *
**************************************
This package is built according to these values:
1-summary: [Tengine for 361way.com order by Yang]
2-name: [Tengine]
3-version: [2.0.1]
4-release: [1]
5-license: [GPL]
6-group: [Applications/system]
7-architecture: [x86_64]
8-source location: [tengine-2.0.1]
9-alternate source location: []
10-requires: []
11-provides: [Tengine]
Enter a number to the change any of the them or press ENTER to continue:
Installing with make install ...
========================= Installation Results ===========================
Make-f Objs/makefile Install
MAKE[1]: Entering directory '/usr/local/src/tengine-2.0.1 '
test-d '/usr/local ' | | Mkdir-p '/usr/local '
............................................................ Omitted
**********************************************************************
Done. The new package has been saved to
/root/rpmbuild/rpms/x86_64/tengine-2.0.1-1.x86_64.rpm
Can install it in your system anytime using:
Rpm-i tengine-2.0.1-1.x86_64.rpm
**********************************************************************

After completion, you can take the RPM package just generated to the same system on the host to install the use of the installation can also be the following command to view the details of the RPM package information:

The code is as follows Copy Code
[ROOT@KVM ~]# Rpm-qpi tengine-2.0.1-1.x86_64.rpm
Name:tengine Relocations: (not relocatable)
version:2.0.1 Vendor: (none)
Release:1 build Date:tue 2014 10:39:02 AM CST
Install Date: (not installed) build Host:localhost
Group:applications/system Source rpm:tengine-2.0.1-1.src.rpm
size:2345906 LICENSE:GPL
Signature: (None)
packager:checkinstall-1.6.2
Summary:tengine for 361way.com
Description:
Tengine for 361way.com

Note: The RPM package at this time may encounter errors on other hosts by Rpm-i installation, because we customize a lot of parameters at compile time. Examples of the above tengine rpm will be used when the error is as follows:

#nginx
Nginx: [Emerg] Getpwnam ("Nginx") failed
The cause of the error is simple because we used the--user=nginx--group=nginx parameter when we compiled it. The error occurs on the new host because the user does not exist. If you want to solve this problem, you can modify the install file or make file before compiling, create new users, add new custom directories, and then compile the RPM package to be OK.

Related Article

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.