[Pdns-users] Building pdns RPMs using custom LDAP libraries/headers

Nikolaos Milas nmilas at admin.noa.gr
Mon Apr 8 20:36:55 UTC 2013


On 22/3/2013 10:46 μμ, a b wrote:

> Actually, you could try the following in the .spec file; this assumes 
> %_prefix=/usr/local/openldap in your .rpmmacros, since you wrote that 
> you would rather not change it:
>
> O='$$O'; export O
> ORIGIN='$ORIGIN'; export ORIGIN
>
> CPPFLAGS="${CPPFLAGS} -I%{_prefix}/include"; export CPPFLAGS
> LDFLAGS="${LDFLAGS} -L%{_libdir} 
> -R${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; 
> export LDFLAGS
> CFLAGS="${CFLAGS} 
> -Wl,-L%{_libdir},-R${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; 
> export CFLAGS
> CXXFLAGS="${CXXFLAGS} 
> -Wl,-L%{_libdir},-R${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; 
> export CXXFLAGS
>
> %configure ...

I tried with:

.rpmmacros:
%_topdir %(echo $HOME)/rpmbuild
%_prefix=/usr/local/openldap

and I added in the spec file:

O='$$O'; export O
ORIGIN='$ORIGIN'; export ORIGIN
CPPFLAGS="${CPPFLAGS} -I%{_prefix}/include"; export CPPFLAGS
LDFLAGS="${LDFLAGS} -L%{_libdir} 
-rpath${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; export 
LDFLAGS
CFLAGS="${CFLAGS} 
-Wl,-L%{_libdir},-rpath${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; 
export CFLAGS
CXXFLAGS="${CXXFLAGS} 
-Wl,-L%{_libdir},-rpath${ORIGIN}:${ORIGIN}/../%{_lib}:${ORIGIN}/../../%{_lib}:%{_libdir}"; 
export CXXFLA

but it exited with an error:

================================================================================================ 

+ O='$$O'
+ export O
+ ORIGIN='$ORIGIN'
+ export ORIGIN
+ CPPFLAGS=' -I=/usr/local/openldap/include'
+ export CPPFLAGS
+ LDFLAGS=' -L=/usr/local/openldap/lib64 
-rpath$ORIGIN:$ORIGIN/../lib64:$ORIGIN/../../lib64:=/usr/local/openldap/lib64'
+ export LDFLAGS
+ CFLAGS=' 
-Wl,-L=/usr/local/openldap/lib64,-rpath$ORIGIN:$ORIGIN/../lib64:$ORIGIN/../../lib64:=/usr/local/openldap/lib64'
+ export CFLAGS
+ CXXFLAGS=' 
-Wl,-L=/usr/local/openldap/lib64,-rpath$ORIGIN:$ORIGIN/../lib64:$ORIGIN/../../lib64:=/usr/local/openldap/lib64'
+ export CXXFLAGS
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.WrpSHX
+ umask 022
+ cd /home/pdnsbuilder/rpmbuild/BUILD
+ cd pdns-3.2
+ LANG=C
+ export LANG
+ unset DISPLAY
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-I=/usr/local/openldap/lib64/gfortran/modules'
+ export FFLAGS
+ ./configure --build=x86_64-redhat-linux-gnu 
--host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu 
--program-prefix= --prefix==/usr/local/openldap 
--exec-prefix==/usr/local/openldap --bindir==/usr/local/openldap/bin 
--sbindir==/usr/local/openldap/sbin --sysconfdir=/etc 
--datadir==/usr/local/openldap/share 
--includedir==/usr/local/openldap/include 
--libdir==/usr/local/openldap/lib64 
--libexecdir==/usr/local/openldap/libexec --localstatedir=/var 
--sharedstatedir=/var/lib --mandir=/usr/share/man 
--infodir=/usr/share/info --sysconfdir=/etc/powerdns 
--libdir==/usr/local/openldap/lib64 --with-sqlite3 
--with-socketdir=/var/run/pdns-server --with-modules= 
'--with-dynmodules=pipe gmysql gpgsql gsqlite3 ldap'
configure: error: expected an absolute directory name for --exec_prefix: 
=/usr/local/openldap
error: Bad exit status from /var/tmp/rpm-tmp.WrpSHX (%build)

================================================================================================ 


But let's step back for a while.

Why can't I build with the actual, unmodified, spec file using 
*standard* system libraries? See below:

================================================================================================ 

...
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.fMa02U
+ umask 022
+ cd /home/pdnsbuilder/rpmbuild/BUILD
+ cd pdns-3.2
+ LANG=C
+ export LANG
+ unset DISPLAY
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-I/usr/lib64/gfortran/modules'
+ export FFLAGS
+ ./configure --build=x86_64-redhat-linux-gnu 
--host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu 
--program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin 
--sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share 
--includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec 
--localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man 
--infodir=/usr/share/info --sysconfdir=/etc/powerdns --libdir=/usr/lib64 
--with-sqlite3 --with-socketdir=/var/run/pdns-server --with-modules= 
'--with-dynmodules=pipe gmysql gpgsql gsqlite3 ldap'
...
checking ldap.h usability... yes
checking ldap.h presence... yes
checking for ldap.h... yes
checking lber.h usability... yes
checking lber.h presence... yes
checking for lber.h... yes
checking for ldap_set_option in -lldap_r... no
checking for ldap_set_option in -lldap... no
configure: error: ldap library (libldap) not found
error: Bad exit status from /var/tmp/rpm-tmp.fMa02U (%build)
================================================================================================ 


Why it can't find the default system libraries (which are indeed in 
/usr/lib64/) ??? It's the first time this happens to me. I have built 
many packages (Postfix, Dovecot, Openldap, etc.) and I have never had a 
problem building using the default spec file.

Thanks,
Nick




More information about the Pdns-users mailing list