Issue
I am trying to create an RPM from libraries that have been built externally.
My spec is basically this:
Name: ace-tao
Version: 6.5.3
Release: 1
Summary: ACE and TAO libraries
License: other
Vendor: My Corp
Group: Applications/Engineering
Packager: My Corp <[email protected]>
Prefix: /usr/local/foo
%description
Contains the ACE and TAO libraries.
%install
mkdir -p %{buildroot}/%{prefix}/lib
cp -f %{_sourcedir}/deps/libACE*.so.%{version} %{buildroot}/%{prefix}/lib/
cp -f %{_sourcedir}/deps/libTAO*.so.2.5.3 %{buildroot}/%{prefix}/lib/
(
cd %{buildroot}/%{prefix}/lib/
for lib in libTAO*.so.2.5.3; do
ln -s $lib ${lib%.3}
ln -s $lib ${lib%.5.3}
ln -s $lib ${lib%.2.5.3}
done
)
%files
%defattr(-,root,root,-)
%{prefix}
The TAO library has the requirement that there be symlinks libTAO*.so
, libTAO*.so.2
and libTAO*.so.2.5
to libTAO*.so.2.5.3
, hence the ln
calls.
After I build this with rpmbuild -bb ace-tao.spec
, I get a file ace-tao-6.5.3-1.x86_64.rpm
. However, installing this yields warnings:
15:16:32,868 WARN packaging: ace-tao-6.5.3-1.x86_64 requires libTAO.so.2.5.3()(64bit)
15:16:32,868 WARN packaging: ace-tao-6.5.3-1.x86_64 requires libTAO_CodecFactory.so.2.5.3()(64bit)
15:16:32,868 WARN packaging: ace-tao-6.5.3-1.x86_64 requires libTAO_10RTable.so.2.5.3()(64bit)
... snip ...
Checking the requirements of the package with rpm -qRp ace-tao-6.5.3-1.x86_64.rpm
indeed lists
libTAO.so.2.5.3()(64bit)
libTAO_AnyTypeCode.so.2.5.3()(64bit)
libTAO_CodecFactory.so.2.5.3()(64bit)
... snip ...
The RPM doesn't provide them though:
$ rpm --provides -qp ace-tao-6.5.3-1.x86_64.rpm
ace-tao = 6.5.3-1
ace-tao(x86-64) = 6.5.3-1
Even though it contains them:
$ rpm -qlp ace-tao-6.5.3-1.x86_64.rpm | grep TAO
/usr/local/foo/lib/libTAO.so
/usr/local/foo/lib/libTAO.so.2
/usr/local/foo/lib/libTAO.so.2.5
/usr/local/foo/lib/libTAO.so.2.5.3
/usr/local/foo/lib/libTAO_AnyTypeCode.so
/usr/local/foo/lib/libTAO_AnyTypeCode.so.2
/usr/local/foo/lib/libTAO_AnyTypeCode.so.2.5
/usr/local/foo/lib/libTAO_AnyTypeCode.so.2.5.3
/usr/local/foo/lib/libTAO_CodecFactory.so
/usr/local/foo/lib/libTAO_CodecFactory.so.2
/usr/local/foo/lib/libTAO_CodecFactory.so.2.5
/usr/local/foo/lib/libTAO_CodecFactory.so.2.5.3
... snip ...
Why is that? What do I need to change for the RPM to provide the libraries it contains?
I am on CentOS 7.9.
Solution
In order for RPM's automatic dependencies system to pick up shared objects, they need to have their executable bit set.[1] I suspect you are not doing that here.
So in your %install
section, either use install -Dm 755
instead of cp
, or chmod 755
them. Note that you only need to do this for regular files; symlinks have mode 777
by default.
And although not ideal, you can always declare Provides:
entries manually as a last resort.
P.s. I'm not sure if autodetect will work when you install to non-standard paths (i.e. outside of %{_libdir}
). If setting the executable bit didn't work, you may wish to try installing to %{buildroot}%{_libdir}
instead.
[1] I did search through RPM's source code, but didn't find any explicit documentation of this behaviour. The relevant source code seems to be rpmfc.c
FYI.
Answered By - cyqsimon Answer Checked By - Gilberto Lyons (WPSolving Admin)