While working on building Asterisk 16.0.0 RPMs I ran across a very unhelpful
error message. When attempting to install the generated RPM file via YUM it
finds a dependency on glibc 2.14 which is not available for CentOS 6. Since I
knew that my asterisk.spec
used to generate the RPM didn’t declare the
dependency and that the Docker image I was using to compile the source was using
glibc 2.12 I was at a bit of a loss.
[root@4eece9df947a ~]# yum install ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Examining ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm: asterisk-16.0.0-1.el6.x86_64
Marking ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
* base: mirrors.usinternet.com
* epel: mirror.steadfastnet.com
* extras: mirrors.usinternet.com
* updates: mirrors.usinternet.com
Resolving Dependencies
--> Running transaction check
---> Package asterisk.x86_64 0:16.0.0-1.el6 will be installed
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: asterisk-16.0.0-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: asterisk-16.0.0-1.el6.x86_64 (/asterisk-16.0.0-1.el6.x86_64)
Requires: libc.so.6(GLIBC_2.14)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Since my spec didn’t declare the dependency my next step was to try and narrow
down where the dependency was being introduced. In order to do that my first
step was to get the shared libraries out of the RPM. It is possible to extract
them from the RPM using
rpm2cpio
and cpio
but for me the easiest way was to re-run the rpmbuild
command with the -bi
flag rather than the -ba
flag I had been using.
According to the man page:
-ba
Build binary and source packages (after doing the %prep, %build, and %install stages).
-bi
Do the “%install” stage from the spec file (after doing the %prep and %build stages). This generally involves the equivalent of a “make install”.
Once the shared libraries were compiled it is just a matter of iterating over
each of them and using ldd
to print out their dependencies.
[root@4eece9df947a ~]# find ~/rpmbuild/BUILDROOT \
-type f \
-regextype posix-extended \
-regex '.*\.so(\.[0-9]+)?' \
-exec ldd {} \; | \
grep 'GLIBC_2.14'
~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/format_ogg_opus.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/format_ogg_opus.so)
~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_silk.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_silk.so)
~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_g729a.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_g729a.so)
~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_opus.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64/usr/lib64/asterisk/modules/codec_opus.so)
It turns out that make install
downloads these precompiled libraries.
Unfortunately they are not properly compiled to run on CentOS 6. Since I have no
need for these particular libraries I can just disable them using
menuselect
.
%if 0%{?el6}
menuselect/menuselect \
--disable codec_opus \
--disable codec_silk \
--disable codec_g729a \
menuselect.makeopts
%endif
And now I can rebuild the RPM and install it!
[root@4eece9df947a ~]# rpm -ba ~/rpmspec/SPECS/asterisk.spec
... lots of boring output ...
Checking for unpackaged file(s): /usr/lib/rpm/check-files ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64
Wrote: ~/rpmbuild/SRPMS/asterisk-16.0.0-1.el6.src.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/asterisk-devel-16.0.0-1.el6.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/asterisk-debuginfo-16.0.0-1.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var~/rpm-tmp.Nze4wO
+ umask 022
+ cd ~/rpmbuild/BUILD
+ cd asterisk-16.0.0
+ /bin/rm -rf ~/rpmbuild/BUILDROOT/asterisk-16.0.0-1.el6.x86_64
+ exit 0
[root@4eece9df947a ~]# yum install -y ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Examining ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm: asterisk-16.0.0-1.el6.x86_64
Marking ~/rpmbuild/RPMS/x86_64/asterisk-16.0.0-1.el6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
* base: mirrors.usinternet.com
* epel: d2lzkl7pfhq30w.cloudfront.net
* extras: mirrors.usinternet.com
* updates: mirrors.usinternet.com
Resolving Dependencies
--> Running transaction check
---> Package asterisk.x86_64 0:16.0.0-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
asterisk x86_64 16.0.0-1.el6 /asterisk-16.0.0-1.el6.x86_64 196 M
Transaction Summary
================================================================================
Install 1 Package(s)
Total size: 196 M
Installed size: 196 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : asterisk-16.0.0-1.el6.x86_64 1/1
Verifying : asterisk-16.0.0-1.el6.x86_64 1/1
Installed:
asterisk.x86_64 0:16.0.0-1.el6
Complete!
Success!