Skip to contentSkip to conversation

perf.bb: fix multilib build

PATCH In review Robert Yang 2 participants 5 messages Aug 12, 2014 – Sep 2, 2014

lore
Share & tools
lore
#0 lore raw

cover perf.bb: fix multilib build

The following changes since commit 4321c553d5ae816e566234e981a0815bba046d39:

SIGGEN_EXCLUDERECIPES_ABISAFE: add initscripts (2014-08-11 17:44:09 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/perf
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/perf

Robert Yang (1):
perf.bb: fix multilib build

 meta/recipes-kernel/perf/perf.bb |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 perf.bb: fix multilib build

Fixed:

$ bitbake perf lib32-perf
ERROR: QA Issue: lib32-perf: Files/directories were installed but not shipped
  /usr/lib64
  /usr/lib64/traceevent
  /usr/lib64/traceevent/plugins
  /usr/lib64/traceevent/plugins/plugin_function.so
  /usr/lib64/traceevent/plugins/plugin_scsi.so
  /usr/lib64/traceevent/plugins/plugin_hrtimer.so
  /usr/lib64/traceevent/plugins/plugin_kmem.so
  /usr/lib64/traceevent/plugins/plugin_jbd2.so
  /usr/lib64/traceevent/plugins/plugin_xen.so
  /usr/lib64/traceevent/plugins/plugin_mac80211.so
  /usr/lib64/traceevent/plugins/plugin_cfg80211.so
  /usr/lib64/traceevent/plugins/plugin_sched_switch.so
  /usr/lib64/traceevent/plugins/plugin_kvm.so [installed-vs-shipped]

The perf.do_configure edits kernel's ${STAGING_KERNEL_DIR}/tools/perf/config/Makefile, there would be problems since kernel doesn't have multilib, and the build result is undetermined.

Previously, the sed command changed libdir to /usr/lib64 (or 32) in the Makefile, so the build result was different if we build perf (64) first or lib32-perf first.

Use the weak assignment "libdir ?=" to instead of "libdir =" will fix the problem since the multilib builds are in different processes, and they won't affect each other any more.

The sed command will match both $(prefix)/$(lib) and $(prefix)/lib since the Makefile may has been modified before this patch.

---
 meta/recipes-kernel/perf/perf.bb |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-kernel/perf/perf.bb +5 -3
index bfd210c..ebfedb9 100644
@@ -121,10 +121,12 @@ do_configure_prepend () {
     # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit
     # build, with a 64 bit multilib, the arch won't match and the detection of a 
     # 64 bit build (and library) are not exected. To ensure that libraries are
-    # installed to the correct location, we can make the substitution in the 
-    # config/Makefile. For non multilib builds, this has no impact.
+    # installed to the correct location, we can use the weak assignment in the
+    # config/Makefile.
     if [ -e "${S}/tools/perf/config/Makefile" ]; then
-        sed -i 's,libdir = $(prefix)/$(lib),libdir = $(prefix)/${baselib},' ${S}/tools/perf/config/Makefile
+        # Match $(prefix)/$(lib) and $(prefix)/lib
+        sed -i 's,^libdir = \($(prefix)/.*lib\),libdir ?= \1,' \
+            ${S}/tools/perf/config/Makefile
     fi
     # We need to ensure the --sysroot option in CC is preserved
     if [ -e "${S}/tools/perf/Makefile.perf" ]; then
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 48 lines · Robert Yang

Fixed:

$ bitbake perf lib32-perf
ERROR: QA Issue: lib32-perf: Files/directories were installed but not shipped
  /usr/lib64
  /usr/lib64/traceevent
  /usr/lib64/traceevent/plugins
  /usr/lib64/traceevent/plugins/plugin_function.so
  /usr/lib64/traceevent/plugins/plugin_scsi.so
  /usr/lib64/traceevent/plugins/plugin_hrtimer.so
  /usr/lib64/traceevent/plugins/plugin_kmem.so
  /usr/lib64/traceevent/plugins/plugin_jbd2.so
  /usr/lib64/traceevent/plugins/plugin_xen.so
  /usr/lib64/traceevent/plugins/plugin_mac80211.so
  /usr/lib64/traceevent/plugins/plugin_cfg80211.so
  /usr/lib64/traceevent/plugins/plugin_sched_switch.so
  /usr/lib64/traceevent/plugins/plugin_kvm.so [installed-vs-shipped]

The perf.do_configure edits kernel's ${STAGING_KERNEL_DIR}/tools/perf/config/Makefile, there would be problems since kernel doesn't have multilib, and the build result is undetermined.

Previously, the sed command changed libdir to /usr/lib64 (or 32) in the Makefile, so the build result was different if we build perf (64) first or lib32-perf first.

Use the weak assignment "libdir ?=" to instead of "libdir =" will fix the problem since the multilib builds are in different processes, and they won't affect each other any more.

The sed command will match both $(prefix)/$(lib) and $(prefix)/lib since the Makefile may has been modified before this patch.

---
 meta/recipes-kernel/perf/perf.bb |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-kernel/perf/perf.bb +0 -2
index bfd210c..ebfedb9 100644
@@ -121,10 +121,12 @@ do_configure_prepend () {
     # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit
     # build, with a 64 bit multilib, the arch won't match and the detection of a 
     # 64 bit build (and library) are not exected. To ensure that libraries are
-    # installed to the correct location, we can make the substitution in the 
-    # config/Makefile. For non multilib builds, this has no impact.

meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 132

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +5 -1
+    # installed to the correct location, we can use the weak assignment in the
+    # config/Makefile.
     if [ -e "${S}/tools/perf/config/Makefile" ]; then
-        sed -i 's,libdir = $(prefix)/$(lib),libdir = $(prefix)/${baselib},' ${S}/tools/perf/config/Makefile
+        # Match $(prefix)/$(lib) and $(prefix)/lib
+        sed -i 's,^libdir = \($(prefix)/.*lib\),libdir ?= \1,' \
+            ${S}/tools/perf/config/Makefile
     fi
     # We need to ensure the --sysroot option in CC is preserved
     if [ -e "${S}/tools/perf/Makefile.perf" ]; then

What happens if both lib32-perf and lib64-perf are being built at the same time?

${S} is shared here so we should not be making changes to it. Your patch doesn't make things worse I guess but there is still a horribly big race here :(

Cheers,

Richard

#3 lore raw
Quoted 54 lines · Richard Purdie
Quoted 53 lines · Robert Yang

Fixed:

$ bitbake perf lib32-perf
ERROR: QA Issue: lib32-perf: Files/directories were installed but not shipped
   /usr/lib64
   /usr/lib64/traceevent
   /usr/lib64/traceevent/plugins
   /usr/lib64/traceevent/plugins/plugin_function.so
   /usr/lib64/traceevent/plugins/plugin_scsi.so
   /usr/lib64/traceevent/plugins/plugin_hrtimer.so
   /usr/lib64/traceevent/plugins/plugin_kmem.so
   /usr/lib64/traceevent/plugins/plugin_jbd2.so
   /usr/lib64/traceevent/plugins/plugin_xen.so
   /usr/lib64/traceevent/plugins/plugin_mac80211.so
   /usr/lib64/traceevent/plugins/plugin_cfg80211.so
   /usr/lib64/traceevent/plugins/plugin_sched_switch.so
   /usr/lib64/traceevent/plugins/plugin_kvm.so [installed-vs-shipped]

The perf.do_configure edits kernel's ${STAGING_KERNEL_DIR}/tools/perf/config/Makefile, there would be problems since kernel doesn't have multilib, and the build result is undetermined.

Previously, the sed command changed libdir to /usr/lib64 (or 32) in the Makefile, so the build result was different if we build perf (64) first or lib32-perf first.

Use the weak assignment "libdir ?=" to instead of "libdir =" will fix the problem since the multilib builds are in different processes, and they won't affect each other any more.

The sed command will match both $(prefix)/$(lib) and $(prefix)/lib since the Makefile may has been modified before this patch.

---
  meta/recipes-kernel/perf/perf.bb |    8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-kernel/perf/perf.bb +3 -3
index bfd210c..ebfedb9 100644
@@ -121,10 +121,12 @@ do_configure_prepend () {
      # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit
      # build, with a 64 bit multilib, the arch won't match and the detection of a
      # 64 bit build (and library) are not exected. To ensure that libraries are
-    # installed to the correct location, we can make the substitution in the
-    # config/Makefile. For non multilib builds, this has no impact.
+    # installed to the correct location, we can use the weak assignment in the
+    # config/Makefile.
      if [ -e "${S}/tools/perf/config/Makefile" ]; then
-        sed -i 's,libdir = $(prefix)/$(lib),libdir = $(prefix)/${baselib},' ${S}/tools/perf/config/Makefile
+        # Match $(prefix)/$(lib) and $(prefix)/lib
Quoted 9 lines

meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 132

Quoted 5 lines
meta/recipes-kernel/perf/perf.bb +2 -0
+        sed -i 's,^libdir = \($(prefix)/.*lib\),libdir ?= \1,' \
+            ${S}/tools/perf/config/Makefile
      fi
      # We need to ensure the --sysroot option in CC is preserved
      if [ -e "${S}/tools/perf/Makefile.perf" ]; then

What happens if both lib32-perf and lib64-perf are being built at the same time?

Thanks for the reply, I tested "bitbake lib32-perf lib64-perf" just now:

MACHINE = "qemux86-64"
require conf/multilib.conf
MULTILIBS = "multilib:lib32 multilib:lib64"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
DEFAULTTUNE_virtclass-multilib-lib64 = "x86-64"

$ bitbake lib32-perf lib64-perf
$ bitbake lib32-perf lib64-perf -ccleansstate && bitbake lib32-perf lib64-perf

It worked well, and built 3 of them:

$ bitbake lib32-perf lib64-perf perf
$ bitbake lib32-perf lib64-perf perf -ccleansstate && bitbake lib32-perf lib64-perf perf

It worked well, too. And it didn't work without the patch, we would get the installed-vs-shipped error as showed in the commit message.

The patch changes "libdir =" to "libdir ?=" in the Makefile so that different processes have different libdir, then it works.

// Robert

Quoted 12 lines

${S} is shared here so we should not be making changes to it. Your patch doesn't make things worse I guess but there is still a horribly big race here :(

Cheers,

Richard

#4 lore raw
In reply to Robert Yang

Any comments on this one, please ? This can fix the qa error when build multilib:

    ERROR: QA Issue: lib32-perf: Files/directories were installed but not shipped
      /usr/lib64
      /usr/lib64/traceevent
      /usr/lib64/traceevent/plugins
      /usr/lib64/traceevent/plugins/plugin_function.so
      /usr/lib64/traceevent/plugins/plugin_scsi.so
      /usr/lib64/traceevent/plugins/plugin_hrtimer.so
      /usr/lib64/traceevent/plugins/plugin_kmem.so
      /usr/lib64/traceevent/plugins/plugin_jbd2.so
      /usr/lib64/traceevent/plugins/plugin_xen.so
      /usr/lib64/traceevent/plugins/plugin_mac80211.so
      /usr/lib64/traceevent/plugins/plugin_cfg80211.so
      /usr/lib64/traceevent/plugins/plugin_sched_switch.so
      /usr/lib64/traceevent/plugins/plugin_kvm.so [installed-vs-shipped]

And I usually see it.

// Robert

Quoted 15 lines · Robert Yang

The following changes since commit 4321c553d5ae816e566234e981a0815bba046d39:

   SIGGEN_EXCLUDERECIPES_ABISAFE: add initscripts (2014-08-11 17:44:09 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/perf
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/perf

Robert Yang (1):
perf.bb: fix multilib build

  meta/recipes-kernel/perf/perf.bb |    8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)