1
votes

Preface: Auto dependencies (AutoReqProv) is ON

As the title says, we have a shared object that is provided by the RPM package we have built, so it is placed in the %files section of the spec file. However, we have executable files in the %files section as well, that are dependent on this .so. So, with auto dependencies on, it is trying to resolve this issue during install of this package. Obviously, this .so has not been installed yet on the target system because it is apart of the package being installed. So, it throws an install error.

Has anyone experienced this issue before? Auto dependencies being on is a requirement for this, so removing it is a last ditch effort.

**Edit: Here is the %files section of my spec file. The .so in question is located in /usr/local/%{name}

%files
%defattr(-,root,root)
/usr/local/%{name}
/usr/bin/*
/etc/ld.so.conf.d/*
/etc/opt/aubit4gl2
/usr/lib/*
%attr(0755, -, -) /usr/local/bin/c4glpg
%attr(0755, -, -) /usr/local/bin/c4glpg2

The error is this:

error: Failed dependencies:
libaubit4gl.so is needed by aubit4gl2-10.0.4-2.i686

Edit 2: Here is the install section of the rpmbuild command output

make[1]: Leaving directory `/home/bhand/rpmbuild/BUILD/aubit4gl2-10.0.4/aubit4gl2'
+ cp -a aubit4gl2/atomix4pg/sqldist /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/local/aubit4gl2/atomix4pg
+ cp -a aubit4gl2/etc/aubitrc /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/etc/opt/aubit4gl2
+ sed -i 's/^AUBITETC=.*/AUBITETC=\/etc\/opt\/aubit4gl2/g' /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/etc/opt/aubit4gl2/aubitrc
+ sed -i 's/^AUBITDIR=.*/AUBITDIR=\/usr\/local\/aubit4gl2/g' /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/etc/opt/aubit4gl2/aubitrc
+ sed -i 's/^AUBITDIR_SRC=.*/AUBITDIR_SRC=\/usr\/local\/aubit4gl2/g' /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/etc/opt/aubit4gl2/aubitrc
+ echo '# NOBLE: Make aubit utils only create 32-bit output'
+ echo CFLAGS=-m32
+ ln -s /usr/local/aubit4gl2/lib/libaubit4gl.so /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/lib/libaubit4gl.so
+ ln -s /usr/local/aubit4gl2/atomix4pg/bin/c4glpg /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/local/bin/c4glpg
+ ln -s /usr/local/aubit4gl2/atomix4pg/bin/c4glpg2 /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/local/bin/c4glpg2
+ ln -s /usr/local/aubit4gl2/bin/amake /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/bin/amake
+ ln -s /usr/local/aubit4gl2/bin/aubit /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/bin/aubit
+ ln -s /usr/local/aubit4gl2/bin/aubit-config /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/bin/aubit-config
Processing files: aubit4gl2-10.0.4-2.i686
warning: Explicit %attr() mode not applicaple to symlink: /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/local/bin/c4glpg
warning: Explicit %attr() mode not applicaple to symlink: /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386/usr/local/bin/c4glpg2
Provides: libA4GL_HTML.so libA4GL_file.so libA4GL_memcache.so libA4GL_pcre.so libA4GL_pick.so libA4GL_roman.so libA4GL_string.so libDATA_module.so libDATA_module_definition.so libDATA_report.so libDATA_struct_form.so libEXREPORT_NOPDF.so libFORM_GENERIC.so libFORM_NOFORM.so libFORM_XDR.so libHELP_std.so libLEX_C.so libLEX_CS.so libLEX_EC.so libLEX_PERL.so libLEX_WRITE.so libLOGREPPROC_CSV.so libLOGREPPROC_HTML.so libLOGREPPROC_TXT.so libLOGREP_CSV.so libLOGREP_HTML.so libLOGREP_TXT.so libMSG_NATIVE.so libPACKER_FORMXML.so libPACKER_GZPACKED.so libPACKER_MEMPACKED.so libPACKER_PACKED.so libPACKER_PERL.so libPACKER_XDR.so libPACKER_XML.so libRPC_NORPC.so libRPC_XDR.so libSQLPARSE_INFORMIX.so libSQLPARSE_NONE.so libSQL_FILESCHEMA.so libSQL_nosql.so libSQL_unixodbc.so libUI_CONSOLE.so libUI_HL_GTK.so libUI_HL_TUI.so libUI_HL_TUIN.so libUI_TUI.so libUI_TUI_wide.so libUI_XML.so libXDRPACKER_module.so libXDRPACKER_module_definition.so libXDRPACKER_report.so libXDRPACKER_struct_form.so libaubit4gl-1.2_39.so libbarcode.so libchannel.so liberrhook_sample.so aubit4gl2 = 10.0.4-2 aubit4gl2(x86-32) = 10.0.4-2 perl(report) perl(using)
Requires(interp): /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires(post): /bin/sh
Requires(postun): /bin/sh
Requires: /bin/sh /usr/bin/perl libatk-1.0.so.0 libaubit4gl-1.2_39.so libaubit4gl.so libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.1.3) libc.so.6(GLIBC_2.12) libc.so.6(GLIBC_2.2) libc.so.6(GLIBC_2.2.3) libc.so.6(GLIBC_2.3) libc.so.6(GLIBC_2.7) libcairo.so.2 libcurl.so.4 libdl.so.2 libdl.so.2(GLIBC_2.0) libdl.so.2(GLIBC_2.1) libfontconfig.so.1 libform.so.5 libformw.so.5 libfreetype.so.6 libgdk-x11-2.0.so.0 libgdk_pixbuf-2.0.so.0 libgio-2.0.so.0 libglib-2.0.so.0 libgobject-2.0.so.0 libgtk-x11-2.0.so.0 libm.so.6 libm.so.6(GLIBC_2.0) libncurses.so.5 libncursesw.so.5 libodbc.so.2 libpanel.so.5 libpanelw.so.5 libpango-1.0.so.0 libpangocairo-1.0.so.0 libpangoft2-1.0.so.0 libpcre.so.1 libpthread.so.0 libpthread.so.0(GLIBC_2.0) libtinfo.so.5 libz.so.1 perl(DBI) perl(Date::Calc) perl(strict) perl(using) rtld(GNU_HASH)
Processing files: libaubit4gl-1.2_39-2.i686
Provides: libaubit4gl = 1.2_39-2 libaubit4gl(x86-32) = 1.2_39-2 libaubit4gl-1.2_39.so
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.1.3) libc.so.6(GLIBC_2.3) libc.so.6(GLIBC_2.7) libcurl.so.4 libdl.so.2 libdl.so.2(GLIBC_2.0) libdl.so.2(GLIBC_2.1) libm.so.6 libm.so.6(GLIBC_2.0) libz.so.1 rtld(GNU_HASH)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386
Wrote: /home/bhand/rpmbuild/SRPMS/aubit4gl2-10.0.4-2.src.rpm
Wrote: /home/bhand/rpmbuild/RPMS/i686/aubit4gl2-10.0.4-2.i686.rpm
Wrote: /home/bhand/rpmbuild/RPMS/i686/libaubit4gl-1.2_39-2.i686.rpm
Executing(%clean): /bin/sh -e /home/bhand/rpmbuild/tmp/rpm-tmp.wtiBPg
+ umask 022
+ cd /home/bhand/rpmbuild/BUILD
+ cd aubit4gl2-10.0.4
+ rm -rf /home/bhand/rpmbuild/BUILDROOT/aubit4gl2-10.0.4-2.i386
+ exit 0
cp ~/rpmbuild/RPMS/i686/aubit4gl2-10.0.4-2.i686.rpm aubit4gl2-10.0.4-2.centos.7.postgres.i686.rpm
cp ~/rpmbuild/RPMS/i686/libaubit4gl-1.2_39-2.i686.rpm libaubit4gl-1.2_39-2.i686.rpm
cp RELEASENOTES aubit4gl2-10.0.4-2.centos.7.postgres.i686.RELEASENOTES

Edit 3: The output of rpm -qlvp aubit4gl2-10.0.4-2.centos.7.postgres.i686.rpm

rpm -qlvp nscaubit4gl2-10.0.4-2.centos.7.postgres.i686.rpm | grep libaubit4gl
lrwxrwxrwx    1 root    root                       42 Oct 11 14:06 /usr/lib/libaubit4gl.so -> /usr/local/nscaubit4gl2/lib/libaubit4gl.so
-rwxr-xr-x    1 root    root                  2439297 Oct 11 14:06 /usr/local/nscaubit4gl2/lib/libaubit4gl-1.2_39.so
lrwxrwxrwx    1 root    root                       21 Oct 11 14:06 /usr/local/nscaubit4gl2/lib/libaubit4gl.so -> libaubit4gl-1.2_39.so
5
a library and a binary in the same package should not throw errors. There must be something else going one. Can you give use the %files section as well as the error you get when trying to install that rpm ? - Chris Maes
I have updated my answer with what you've asked for. I don't completely understand how it should be okay, though. If that .so is provided by our RPM (i.e: not installed on the target system), and one of the executables requires it, I would expect to have an error. Or is RPM supposed to be smart enough to handle that? - pid_1
rpm is supposed to be smart enough. However; /usr/local/ is NOT in the LD_LIBRARY_PATH by default; so I don't think that's a good idea. I would suggest you to install your lib in /usr/lib. Also to be sure that your .so is packaged well, run rpm -qlp <your produced rpm file> and check if your .so is in the list. - Chris Maes
Well, the library starts off in /usr/local/%{name}. It is placed into /usr/lib during the install process. But, with auto deps on, it can't even get to the install because of this failing dependency on a library that isn't installed yet. I've got a little less than a year of experience with linux/rpm, so this is just a beginner's theory. I could be totally wrong, but this error makes sense to me. Just don't know how to work around it right now. Oh, and querying for the library in the package is successful. - pid_1
I've been packaging rpms for three years now. I can guarantee you I never had an issue packaging library and executable together! The problem must lie somewhere else... When you query your package, the so shows up in /usr/lib? - Chris Maes

5 Answers

2
votes

Make sure the library has the executable bits on.

1
votes

If any file in the package's %files list is a shared library, the library's SONAME is automatically added to the list of capabilities the package provides.

In my case SONAME for the shared library is empty. After setting SONAME for shared library(as below using -Wl option in gcc) packging the modified shared library worked fine (automatically resolved capabilities).

To test whether SONAME is set properly you can use command objdump -p libaubit4gl.so | grep SONAME

SONAME is assigned/embedded into shared library during linking as below

gcc -shared -fPIC -Wl,-soname,libaubit4gl.so -o libaubit4gl.so foo.o bar.o baz.o -lc

SONAME can be different from file name libaubit4gl.so. (Note: This is not as per standard but suggesting this to get rid of your error. However if you want to name shared library as per standards see versioning a shared library

0
votes

You could have your spec file create two .rpm files: a libaubit4gl one and a aubit4gl one. The first provides this library and the other one requires it.

At least, this seems kind of good practice to me, at least if the library can be used w/o the binary.

0
votes

I added "Provides: libaubit4gl.so" to my spec file and it works now. For some reason, RPM was saying that the aubit4gl package was not providing this .so.

I'm still not 100% on why that is. But, this is what solved my problem.

0
votes

I was having a similar problem. I was setting the executable bits on the created library with %file %attr, but it turned out that I wasn't setting the executable bits in my %install phase.

Setting the shared library file to 755 during %install AND %files fixed the problem.

I'm guessing that rpmbuild looks at the files in the BUILD directory for its analysis, so they have to be correct there, not just after the "rpm -i" installation.