Re: [DynInst_API:] Improving dyninst rpm packaging


Date: Thu, 14 Jun 2012 15:05:59 -0400
From: William Cohen <wcohen@xxxxxxxxxx>
Subject: Re: [DynInst_API:] Improving dyninst rpm packaging
On 06/13/2012 05:37 PM, Matthew LeGendre wrote:
> 
> Will,
> 
> Thanks for the patches.  The notests patch is trivially correct.  The versioning patch is more complicated and will need review, but the ideas are right.
> 
> -Matt
> 
> On Wed, 13 Jun 2012, William Cohen wrote:
>> Hi,
>>
>> I have gotten back to the dyninst packaging for rpm.  I have been using the dyninst/dyninst_proccontrol branch. One of the things that occurred during the build was that it would attempt build all the tests. This is undesired because it requires many other packages and greatly slows the build.  I am not sure that the the attached dyninst-notest.patch is the best way to address this, but it eliminates the undesired build of the tests.
>>
>> The resulting dyninst rpms were not installable because all the linking is done with unversioned shared libaries (libcommon.so) then later the library names are changed in the install to versions names (libcommon.so.8.0). The rpmbuild process goes through and looks for implicit library dependencies using ldd (http://www.rpm.org/max-rpm/s1-rpm-depend-auto-depend.html), and finds that the libraries use the unversioned names rather than the versioned names.  The dyninst-vers.patch is an attempt to make the linker get the correct versions of the libraries. dyninst builds, but the resulting rpms do not install because of the library versioning issue.
>>
>> There is a scratch build of an proccontrol git branch and these patches at:
>>
>> http://koji.fedoraproject.org/koji/taskinfo?taskID=4159913
>>
>> -Will
>>

Hi Matt,

I did some looking around and found that other packages using shared libaries force the so name with something like
 "-Wl,-soname,your_soname" when the .so file is linked/built.  If this option isn't include in the linking of the .so file then the name used is what ever the file (or symbolic link) name is. So the question is how to best get this option into the make files.

Maybe in the various make.module.tmpl files:

LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)

Something like the attached patch. It might not be complete and might not work on other architectures or OSs, but I was able to build an rpm on x86_64 successfully and install the resulting RPMs.

There is an f17 scratch build of the same SRPM at:

http://koji.fedoraproject.org/koji/taskinfo?taskID=4163339


-Will
diff --git a/common/make.module.tmpl dyninst/common/make.module.tmpl
index bbb653f..1a5504d 100644
--- a/common/make.module.tmpl
+++ dyninst/common/make.module.tmpl
@@ -42,7 +42,7 @@ endif
 LDFLAGS     += $(LIBDIR)
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD)
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= 
 CXXFLAGS	+=  $(G_PTHREAD)
 else
diff --git a/dynC_API/make.module.tmpl dyninst/dynC_API/make.module.tmpl
index 4877486..a016ece 100644
--- a/dynC_API/make.module.tmpl
+++ dyninst/dynC_API/make.module.tmpl
@@ -22,7 +22,7 @@ LDFLAGS += -L../../common/$(PLATFORM) -L../../symtabAPI/$(PLATFORM) -L../../dyni
 LDFLAGS     += $(LIBDIR)
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD)
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= -fPIC
 CXXFLAGS	+= -fPIC $(G_PTHREAD)
 else
diff --git a/dyninstAPI/make.module.tmpl dyninst/dyninstAPI/make.module.tmpl
index fabb448..378fea7 100644
--- a/dyninstAPI/make.module.tmpl
+++ dyninst/dyninstAPI/make.module.tmpl
@@ -54,7 +54,7 @@ LDFLAGS     += -L../../stackwalk/$(PLATFORM)
 
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD) 
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= -fPIC
 CXXFLAGS	+= -fPIC $(G_PTHREAD)
 else
diff --git a/dyninstAPI_RT/i386-unknown-linux2.4/Makefile dyninst/dyninstAPI_RT/i386-unknown-linux2.4/Makefile
index aa39e22..4f4619a 100644
--- a/dyninstAPI_RT/i386-unknown-linux2.4/Makefile
+++ dyninst/dyninstAPI_RT/i386-unknown-linux2.4/Makefile
@@ -18,7 +18,7 @@ endif
 
 # Now make any necessary architecture specific changes to variables:
 LD		= $(GCC)
-LDFLAGS         += -shared
+LDFLAGS         += -shared -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= -O2
 
 # if we want to produce a shared object...
diff --git a/dyninstAPI_RT/x86_64-unknown-linux2.4/Makefile dyninst/dyninstAPI_RT/x86_64-unknown-linux2.4/Makefile
index 3f72429..bd761eb 100644
--- a/dyninstAPI_RT/x86_64-unknown-linux2.4/Makefile
+++ dyninst/dyninstAPI_RT/x86_64-unknown-linux2.4/Makefile
@@ -17,7 +17,7 @@ endif
 
 # Now make any necessary architecture specific changes to variables:
 LD		= $(GCC)
-LDFLAGS         += -shared
+LDFLAGS         += -shared -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 LDFLAGS		+= -m64
 CFLAGS		+= -Wall -m64 -DMUTATEE64
 
diff --git a/instructionAPI/make.module.tmpl dyninst/instructionAPI/make.module.tmpl
index 34d4bdc..f8fe036 100644
--- a/instructionAPI/make.module.tmpl
+++ dyninst/instructionAPI/make.module.tmpl
@@ -21,7 +21,7 @@ LDFLAGS += -lcommon
 LDFLAGS     += -L../../common/$(PLATFORM)
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD)
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= -fPIC -g
 CXXFLAGS	+= -fPIC $(G_PTHREAD) -felide-constructors -g
 else
diff --git a/parseAPI/make.module.tmpl dyninst/parseAPI/make.module.tmpl
index ee27ef6..59bb98d 100644
--- a/parseAPI/make.module.tmpl
+++ dyninst/parseAPI/make.module.tmpl
@@ -19,7 +19,7 @@ LDFLAGS += -L../../common/$(PLATFORM) -L../../symtabAPI/$(PLATFORM) -lcommon -ls
 LDFLAGS     += $(LIBDIR)
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD)
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= -fPIC
 CXXFLAGS	+= -fPIC $(G_PTHREAD)
 else
diff --git a/proccontrol/make.module.tmpl dyninst/proccontrol/make.module.tmpl
index 10522ac..d0cc6ed 100644
--- a/proccontrol/make.module.tmpl
+++ dyninst/proccontrol/make.module.tmpl
@@ -39,7 +39,7 @@ LDFLAGS += -L../../common/$(PLATFORM)
 
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared
+LDFLAGS		+= -shared -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= 
 CXXFLAGS	+= 
 else
diff --git a/stackwalk/make.module.tmpl dyninst/stackwalk/make.module.tmpl
index 16e7c07..f68eab7 100644
--- a/stackwalk/make.module.tmpl
+++ dyninst/stackwalk/make.module.tmpl
@@ -31,7 +31,7 @@ endif
 LDFLAGS += -L$(TO_CORE)/common/$(PLATFORM) -L$(LIBRARY_DEST)
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared
+LDFLAGS		+= -shared -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= 
 CXXFLAGS	+= 
 else
diff --git a/symtabAPI/make.module.tmpl dyninst/symtabAPI/make.module.tmpl
index e922497..3c24e17 100644
--- a/symtabAPI/make.module.tmpl
+++ dyninst/symtabAPI/make.module.tmpl
@@ -57,7 +57,7 @@ endif
 
 ifndef USES_NATIVE_CC
 LD		= $(GXX)
-LDFLAGS		+= -shared $(G_PTHREAD_LD)
+LDFLAGS		+= -shared $(G_PTHREAD_LD) -Wl,-soname,$(TARGET).$(RELEASE_NUM)
 CFLAGS		+= 
 CXXFLAGS	+= $(G_PTHREAD)
 else
[← Prev in Thread] Current Thread [Next in Thread→]