Thursday, April 8, 2010

GCC RPM Packaging - Stage 1 - New Error - Update

So after encountering that problem, I jumped on IRC and again went to my usual support channels
#fedora-devel and #seneca on irc.freenode.net.

I first approached my professor Chris Tyler under the name ctyler on #seneca and asked him if he has encountered or had any information about the build error I received.

He noted the problem I am having related to rpath (runpath) and it is a common problem. So he provided me a link (here) from the fedora project wiki which provides some information on how to bypass this error and also he suggests I look at the GCC 4.4.3 rawhide spec file and see if there are any patches they used for the rpath.

A snippet of information from the Fedora Project Wiki Page on rpath

Sometimes, code will hardcode specific library paths when linking binaries (using the -rpath or -R flag). This is commonly referred to as an rpath. Normally, the dynamic linker and loader (ld.so) resolve the executable's dependencies on shared libraries and load what is required. However, when -rpath or -R is used, the location information is then hardcoded into the binary and is examined by ld.so in the beginning of the execution. Since the Linux dynamic linker is usually smarter than a hardcoded path, we usually do not permit the use of rpath in Fedora.



First, I went through the Fedora wiki tried a combination of methods to get pass this error.

The first way using the following flag with configure --disable-rpath. Adding this flag with my other flags, my syntax looks like this:

./configure --disable-multilib --disable-rpath

So with the new change, I started to build again and again after 53mins I still received the same error.

So I consulted with my professor again, and he suggest I use the second method of removing the rpath. "As a last resort, Fedora has a package called chrpath. When this package is installed, you can run chrpath --delete on the files which contain rpath." Information provided from the Fedora Project wiki.

So what I had to do was add the package chrpath as a BuildRequire and add the following line

chrpath --delete $RPM_BUILD_ROOT%{_bindir}/xapian-tcpsrv to my spec file.

I so added this line to the %prep section hoping it would work, and after 4 mins of building it failed. So I must of placed it in the wrong section, since I've been busy for the last 2 days I was unable to ask anyone for help in regards to the placement of this line.

My next step was look at the GCC 4.4.3 rawhide spec file and see if they used any patches. To my surprise they used the following patch for their build : gcc44-libtool-no-rpath.patch

I did a search online for the patch and found a site that hosted it. (here). Also being such a noob as I am, when I went to the rpmbuild/SOURCE directory, I noticed that all the patches related to GCC 4.4.3 were all there. So I am safe to assume that the source rpm of the GCC 4.4.3 rawhide contained all the patches required to build 4.4.3.

So added a line to my patch section for the patch and tried to build again.

After 53 mins I get the same rpath error.


So, for now I will leave it at that and work on it another day. Ciao!!

0 comments:

Post a Comment