11:51:42 <CyrusYzGTt> #startmeeting
11:51:42 <zodbot> Meeting started Fri Jun 25 11:51:42 2010 UTC.  The chair is CyrusYzGTt. Information about MeetBot at http://wiki.debian.org/MeetBot.
11:51:42 <zodbot> Useful Commands: #action #agreed #halp #info #idea #link #topic.
11:54:43 <CyrusYzGTt> UnderstandingDSOLinkChange - FedoraProject                                                             http://fedoraproject.org/w/index.php?title=Under...
11:54:43 <CyrusYzGTt> UnderstandingDSOLinkChange
11:54:43 <CyrusYzGTt> Understanding the (Proposed) Change to DSO Linking
11:54:43 <CyrusYzGTt> A quick list of packages that were found to have DSO link issues in mock builds is at DSOLinkBugs
11:54:44 <CyrusYzGTt> Basics
11:54:46 <CyrusYzGTt> The default behaviour for ld allows users to 'indirectly' link to required objects/libraries through intermediate objects/libraries. While this is convenient, it can
11:54:51 <CyrusYzGTt> also be dangerous because it makes your program's dependencies tied to the dependencies of other objects. If those objects ever change their linkages, they
11:54:54 <CyrusYzGTt> can break your program without any changes to your own code!
11:54:59 <CyrusYzGTt> For example :
11:54:59 <CyrusYzGTt> libxml2.so has:
11:55:00 <CyrusYzGTt> NEEDED              Shared library: [libdl.so.2]
11:55:06 <CyrusYzGTt> NEEDED              Shared library: [libz.so.1]
11:55:06 <CyrusYzGTt> Under the old system, a program that links with libxml2 and uses dlopen need not link with libdl, and a program that links with libxml2 and uses gzopen need
11:55:07 <CyrusYzGTt> not link with libz. While these programs will work, they will break if libxml2 is ever changed to omit the dependency on libdl/libz.
11:55:10 <CyrusYzGTt> What's the difference?
11:55:12 <CyrusYzGTt> For example (courtesy Roland McGrath):
11:55:14 <CyrusYzGTt> ==> foo1.c <==
11:55:16 <CyrusYzGTt> #include <stdio.h>
11:55:20 <CyrusYzGTt> extern int foo ();
11:55:22 <CyrusYzGTt> int
11:55:24 <CyrusYzGTt> main ()
11:55:26 <CyrusYzGTt> {
11:55:28 <CyrusYzGTt> printf ("%d\n", foo ());
11:55:30 <CyrusYzGTt> }
11:55:32 <CyrusYzGTt> ==> foo2.c <==
11:55:34 <CyrusYzGTt> extern int foo ();
11:55:39 <CyrusYzGTt> int bar () { return foo (); }
11:55:40 <CyrusYzGTt> ==> foo3.c <==
11:55:40 <CyrusYzGTt> int foo () { return 0; }
11:55:42 <CyrusYzGTt> Prepare position-independent code:
11:55:44 <CyrusYzGTt> gcc -g -fPIC -c foo1.c foo2.c foo3.c
11:55:47 <CyrusYzGTt> Generate foo3.so:
11:55:50 <CyrusYzGTt> gcc -shared -o foo3.so foo3.o
11:55:52 <CyrusYzGTt> Generate foo2.so, linking foo3.so:
11:55:54 <CyrusYzGTt> gcc -shared -o foo2.so foo2.o foo3.so
11:55:56 <CyrusYzGTt> The proposed change will affect the next step: Creating foo1.
11:55:58 <CyrusYzGTt> Current
11:56:00 <CyrusYzGTt> A call to gcc will succeed qu
11:56:02 <CyrusYzGTt> What do I do?
11:56:04 <CyrusYzGTt> 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
11:56:07 <CyrusYzGTt> the error:
11:56:09 <CyrusYzGTt> gcc -o foo1 foo1.o foo2.so foo3.so -Wl,--rpath-link=.
11:56:11 <CyrusYzGTt> Example deltarpm
11:56:13 <CyrusYzGTt> Run fedora-cvs deltarpm or check out a 'devel' version of deltarpm from :
11:56:15 <CyrusYzGTt> :pserver:anonymous@cvs.fedproject.org:/cvs/pkgs
11:56:17 <CyrusYzGTt> Go to the devel folder and run 'make srpm' to produce a source rpm.
11:56:22 <CyrusYzGTt> In /etc/mock, copy the desired fedora-rawhide-*.cfg file to test.cfg. In the test.cfg file, change the root to 'test'.
11:56:24 <CyrusYzGTt> Add the following to test.cfg:
11:56:26 <CyrusYzGTt> [ld-test]
11:56:28 <CyrusYzGTt> name=ld-test
11:56:30 <CyrusYzGTt> baseurl=http://roland.fedorapeople.org/ld-test/
11:56:32 <CyrusYzGTt> enabled=1
11:56:34 <CyrusYzGTt> gpgcheck=0
11:56:52 <CyrusYzGTt> (Note that the changes to ld are within gcc-4.4.3-5.fc13 so this step should not be necessary)
11:56:52 <CyrusYzGTt> 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
11:56:52 <CyrusYzGTt> The following error should appear in /var/lib/mock/test/result/build.log :
11:56:52 <CyrusYzGTt> RPM build errors:
11:56:52 <CyrusYzGTt> /usr/bin/ld.bfd: rpmdumpheader.o: undefined reference to symbol 'Fopen'
11:56:53 <CyrusYzGTt> /usr/bin/ld.bfd: note: 'Fopen' is defined in DSO /usr/lib/librpmio.so.0 so try adding it to the linker command line
11:56:54 <CyrusYzGTt> /usr/lib/librpmio.so.0: could not read symbols: Invalid operation
11:56:59 <CyrusYzGTt> *** /usr/bin/ld: ld behavior mismatch! ***
11:57:00 <CyrusYzGTt> *** /usr/bin/ld.bfd succeeeded ***
11:57:00 <CyrusYzGTt> *** /usr/bin/ld.bfd --no-add-needed exits 1 ***
11:57:02 <CyrusYzGTt> *** arguments: --eh-frame-hdr --build-id -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o rpmdumpheader
11:57:03 <CyrusYzGTt> /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crt1.o /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crti.o /usr/lib/gcc/i686-redhat-linux/4.4.2/crtbegin.o
11:57:06 <CyrusYzGTt> -L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat-linux/4.4.2/../../.. rpmdumpheader.o -lrpm -lgcc
11:57:09 <CyrusYzGTt> --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-redhat-linux/4.4.2/crtend.o
11:57:12 <CyrusYzGTt> /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crtn.o
11:57:14 <CyrusYzGTt> collect2: ld returned 1 exit status
11:57:16 <CyrusYzGTt> make: *** [rpmdumpheader] Error 1
11:57:20 <CyrusYzGTt> 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.
11:57:23 <CyrusYzGTt> In deltarpm, this can be done quickly by changing the Makefile:
11:57:25 <CyrusYzGTt> rpmdumpheader: rpmdumpheader.o
11:57:27 <CyrusYzGTt> -        $(CC) $(LDFLAGS) $^ -lrpm -o $@
11:57:29 <CyrusYzGTt> +        $(CC) $(LDFLAGS) $^ -lrpm -lrpmio -o $@
11:57:31 <CyrusYzGTt> Retrieved from "https://fedoraproject.org/wiki/UnderstandingDSOLinkChange"
11:57:33 <CyrusYzGTt> @endmeeting
11:57:35 <CyrusYzGTt> #endmeeting