4

I'm trying to create an RPM of my package, which is built using automake and libtool, and I've encountered a problem: rpmbuild aborts upon discovering that the installed programs of the package contain the pathname of the installation directory for the package's sharable libraries (due to automake's use of the -rpath option of ld).

I understand that rpmbuild does this in order to guarantee that the package is relocatable. My question is what to do about it. I could eliminate the use of sharable libraries (and lose their benefits) or I could tell automake to not install the sharable libraries (which would stop it from using the -rpath option) and then install them anyway. The cost of this latter option is that it would require that the user always have a correctly-set LD_LIBRARY_PATH environment variable -- plus it seems like a bit of a kludge.

Is there another option?

What would you do?

Steve Emmerson
  • 7,702
  • 5
  • 33
  • 59
  • 1
    If you install the libraries as a separate package from the executable, the problem should go away. – William Pursell Jun 28 '11 at 18:45
  • While I don't like it, that is another possible solution. I'll keep it in mind. – Steve Emmerson Jun 28 '11 at 19:47
  • @William Pursell: I know that's usually the done thing on debian (see e.g., `zeromq-bin`, `libzmq0`, `libzmq-dev` all coming from the one source package). Do you have a link that shows that's best practise for RPM? – Jack Kelly Jun 28 '11 at 21:50
  • @Jack I don't have a link--overall I've found documentation for this sort of thing bad and/or obsolete. I'll try to post a sample spec file later today in exchange for all of the criticism I'm sure it deserves! – William Pursell Jun 29 '11 at 11:19
  • 1
    @Jack This looks promising: http://tinymelinux.com/doku.php/build-rpms:splitting (I haven't read it completely, though) – William Pursell Jun 29 '11 at 11:22
  • Could you please clarify this: "rpmbuild aborts upon discovering that the installed programs of the package contain the pathname of the installation directory for the package's sharable libraries (due to automake's use of the -rpath option of ld)."? I've been adding RPATHs to my dynamic executables at build time, and rpmbuild has never complained about it. – jayhendren Jul 28 '14 at 20:25
  • @jayhendren The package contains a library and a program that links against the library. After installation, the installed program contains a reference to the installed, shareable library. My `rpmbuild` refuses to create an RPM file when that is the case. – Steve Emmerson Jul 29 '14 at 02:17
  • @SteveEmmerson could you provide more detail? I understood the first time around, but I don't see why RPM would care one whit about your RPATH or RUNPATH. That is really bizarre. I am able to link an executable against whatever I want, no problem, and put it into an rpm. – jayhendren Jul 29 '14 at 17:52
  • @jayhendren Unfortunately, I switched from GNU's autotools to CMake for creating the binary distribution before I solved this problem and CMake doesn't have this problem. – Steve Emmerson Jul 29 '14 at 21:23

1 Answers1

3

The details of this depend on the particular package's build system and which libtool version it is using.

Here are the relevant packaging guidelines from Fedora: http://fedoraproject.org/wiki/PackagingGuidelines#Beware_of_Rpath

Here is the analogous page from Debian: http://wiki.debian.org/RpathIssue

Wikipedia also has some relevant links: http://en.wikipedia.org/wiki/Rpath_(linking)

So you will need to try a few of the suggested techniques for getting rid of the rpath, but which one will work depends on the specifics of your package.

Peter Eisentraut
  • 35,221
  • 12
  • 85
  • 90