This will enable the mock build to pull the latest test version of ld.

+

This will enable the mock build to pull the latest test version of ld. Next, run the build by executing mock -r /path/to/deltarpm/srpm

−

+

−

Run the build by executing mock -r /path/to/deltarpm/srpm

+

The following error should appear in /var/lib/mock/test/result/build.log :

The following error should appear in /var/lib/mock/test/result/build.log :

Line 119:

Line 117:

−

This indicates that deltarpm used /usr/lib/librpmio.so.0 without explicitly linking to it.

+

This indicates that deltarpm used /usr/lib/librpmio.so.0 without explicitly linking to it. To fix, add -lrpmio to the gcc command for any binaries that use librpmio. In deltarpm, this can be done quickly by changing the Makefile:

−

+

−

To fix, add -lrpmio to the gcc command for any binaries that use librpmio.

Revision as of 20:15, 3 December 2009

Contents

Understanding the (Proposed) Change to DSO Linking

Basics

The default behaviour for ld is to not link objects that are listed as dependencies of another linked object. This is dangerous if the other object is ever changed to occlude the object on which your program depended, causing your program to break without any change to your code.

Under the old system, a program that links with libxml2 and uses dlopen may not link with libdl, and a program that links with libxml2 and uses gzopen may not link with libz. While these programs will work, they will break if libxml2 is ever changed to omit the dependency on libdl/libz.

So, the difference is whether you can refer to a symbol that's in a DSO
that you didn't list explicitly in your link line, but that is a
DT_NEEDED dependency of one of those (or recursively of those, I think).

The big difference is that with the proposed change in place, ld will no longer skip linking needed libraries by default. The current default behaviour will lead ld to skip linking with a library if it is listed as a needed by another library that the program uses. In abstract terms, if libA is needed by libB and your program requires both libA and libB, your program may only link to libB. Then if another version of libB comes out that does not list libA as a needed library, then a recompilation will mysteriously break.

What do I do?

If you encounter this error, the error message will prompt you to explicitly link to the DSO that you need. From the foo example, adding foo3.so will get rid of the error:

gcc -o foo1 foo1.o foo2.so foo3.so -Wl,--rpath-link=.

Example deltarpm

Run fedora-cvs deltarpm or check out a 'devel' version of deltarpm from :

:pserver:anonymous@cvs.fedproject.org:/cvs/pkgs

Go to the devel folder and run 'make srpm' to produce a source rpm.

In /etc/mock, copy the desired fedora-rawhide-*.cfg file to test.cfg. In the test.cfg file, change the root to 'test'.

This indicates that deltarpm used /usr/lib/librpmio.so.0 without explicitly linking to it. To fix, add -lrpmio to the gcc command for any binaries that use librpmio. In deltarpm, this can be done quickly by changing the Makefile: