MysqlProxy: No package ‘lua5.1′ found

Somehow my Lua rpm package missed the /usr/lib/pkgconfig/lua.pc file and MysqlProxy couldn’t detect Lua install:

[vitalie@silver tmp]$ rpmbuild -ta --define 'with_lua 1' mysql-proxy-0.6.0.tar.gz
 
[...]
 
checking for LUA... checking for LUA... configure: error: Package requirements (lua5.1 >= 5.1) were not met:
 
No package 'lua5.1' found
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
 
Alternatively, you may set the environment variables LUA_CFLAGS
and LUA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

The solution was to specify LUA_CFLAGS and LUA_LIBS variables:

[vitalie@silver tmp]$ LUA_CFLAGS="-I/usr/include" LUA_LIBS="-llua -lm -ldl" rpmbuild -ta --define 'with_lua 1' mysql-proxy-0.6.0.tar.gz
 
[...]
 
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) libevent-1.1a.so.1()(64bit) libglib-2.0.so.0()(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.2.5)(64bit) rtld(GNU_HASH)
Processing files: mysql-proxy-debuginfo-0.6.0-0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vitalie/rpmbuild/tmp/mysql-proxy-0.6.0-0-root
Wrote: /home/vitalie/rpmbuild/SRPMS/mysql-proxy-0.6.0-0.src.rpm
Wrote: /home/vitalie/rpmbuild/RPMS/x86_64/mysql-proxy-0.6.0-0.x86_64.rpm
Wrote: /home/vitalie/rpmbuild/RPMS/x86_64/mysql-proxy-debuginfo-0.6.0-0.x86_64.rpm
Executing(%clean): /bin/sh -e /home/vitalie/rpmbuild/tmp/rpm-tmp.9187
 
[...]

References:

Install FreeImage on CentOS/RHEL 5

FreeImage is not yet available as RPM on CentOS/RHEL, so we’ll create one.

Before installing required libraries by FreeImage, configure yum to use Dag’s repositories, see this post how it can be done.

Learn how to setup your account to build RPMS as non-privileged user:
http://www.cherpec.com/2009/01/build-rpms-as-simple-user/

[root@lynx ~] yum install libjpeg-devel libpng-devel libtiff-devel libmng-devel openexr-devel zlib-devel
 
[...]

Next, download the following files from FreeImage’s website and put them in your SOURCES directory:

And download freeimage.spec and place it in the SPECS directory.

Now, you are ready to build FreeImage, switch to SPECS directory and build FreeImage package:

[joe@lynx SPECS]$ rpmbuild -ba freeimage.spec
 
[...]
 
+ umask 022
+ cd /home/joe/rpmbuild/BUILD
+ cd FreeImage
+ DOCDIR=/home/joe/rpmbuild/tmp/freeimage-3.11.0-buildroot/usr/share/doc/freeimage-3.11.0
+ export DOCDIR
+ rm -rf /home/joe/rpmbuild/tmp/freeimage-3.11.0-buildroot/usr/share/doc/freeimage-3.11.0
+ /bin/mkdir -p /home/joe/rpmbuild/tmp/freeimage-3.11.0-buildroot/usr/share/doc/freeimage-3.11.0
+ cp -pr FreeImage3110.pdf /home/joe/rpmbuild/tmp/freeimage-3.11.0-buildroot/usr/share/doc/freeimage-3.11.0
+ exit 0
Provides: libfreeimage.so.3()(64bit)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libstdc++.so.6()(64bit) libstdc++.so.
Processing files: freeimage-debuginfo-3.11.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/joe/rpmbuild/tmp/freeimage-3.11.0-buildroot
Wrote: /home/joe/rpmbuild/SRPMS/freeimage-3.11.0-1.src.rpm
Wrote: /home/joe/rpmbuild/RPMS/x86_64/freeimage-3.11.0-1.x86_64.rpm
Wrote: /home/joe/rpmbuild/RPMS/x86_64/freeimage-debuginfo-3.11.0-1.x86_64.rpm

Build RPMs as simple user

It’s not recommended to build your RPMS as root. You can build them as simple user, to accomplish this, you need to create a file called .rpmmacros in your home directory (we’ll assume that your user name is joe and your home directory is /home/joe):

# ~/.rpmmacros
%_topdir /home/joe/rpmbuild
%_tmppath %{_topdir}/tmp

Then create required directories:

[joe@lynx ~]$ mkdir -p ~/rpmbuild/{BUILD,RPMS/{noarch,i386,i586,i686,x86_64},SOURCES,SPECS,SRPMS,tmp}

You are ready to build your RPMS as simple user.