Skip to contentSkip to conversation

oprofile 0.9.8: fix compilation on powerpc

PATCH New Thomas De Schampheleire 3 participants 3 messages Mar 21, 2013 – Mar 24, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 oprofile 0.9.8: fix compilation on powerpc

The oprofile build was broken on powerpc since version 0.9.8. This was detected in several autobuilds, like
http://autobuild.buildroot.net/results/6f6c02d18495907d50fcdfc6003ac20d493c55fe/

Thomas Petazzoni had some fixes pending in his own tree, and this patch is partially based on this work (credits to him). Here is an overview:
- I took over (and fixed) the oprofile.mk changes, except for the powerpc- specific part. For powerpc, there is a new dependency to libpfm4.
- I reimported those Yocto patches that were specific to the ppc build issues, but left out the other ones. Those can be added in separate commits.

---
v2: - Only add libpfm4 dependency for powerpc (or when explicitly selected)
(thanks Reuben Dowle)
- Line up with the work of ThomasP, and use Yocto patches where possible.

 package/oprofile/Config.in                                                               |    1 +
 package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch                             |   32 +++++++++++++
 package/oprofile/oprofile-004-fix-ppc64-specific-libpfm-usage.patch                      |  105 ++++++++++++++++++++++++++++++++++++++++++
 package/oprofile/oprofile-005-fix-up-configure-to-handle-architectures-that-do-not.patch |  154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 package/oprofile/oprofile.mk                                                             |   18 ++++++-
 5 files changed, 308 insertions(+), 2 deletions(-)

Note: this is compile-tested on x86 and powerpc, but I was not able to test it on target.

package/oprofile/Config.in +1 -0
@@ -2,6 +2,7 @@ config BR2_PACKAGE_OPROFILE
 	bool "oprofile"
 	select BR2_PACKAGE_POPT
 	select BR2_PACKAGE_BINUTILS
+	select BR2_PACKAGE_LIBPFM4 if BR2_powerpc
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on !BR2_aarch64 # binutils
 	help
package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch new file +32 -0
new file mode 100644
@@ -0,0 +1,32 @@
+Upstream-Status: Backport
+
+From fa889ea74b6b931e241a8cd57e90edc23cd7ab03 Mon Sep 17 00:00:00 2001
+From: William Cohen <[email protected]>
+Date: Mon, 15 Oct 2012 15:09:55 -0500
+Subject: [PATCH] OProfile doesn't build for 32-bit ppc; the operf_utils.cpp
+ compile fails. Need to be able to build the 32-bit ppc
+ version of oprofile to provide the 32-bit ppc java support
+ libraries. The configure only handles the case of ppc64
+ with perf support.
+
+Signed-off-by: William Cohen <[email protected]>
+---
+ configure.ac |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index b739133..7449854 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -104,7 +104,7 @@ AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf
+ if test "$HAVE_PERF_EVENTS" = "1"; then
+ 	PFM_LIB=
+ 	arch="`uname -m`"
+-	if test "$arch" = "ppc64"; then
++	if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
+ 		AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])])
+ 		AC_CHECK_LIB(pfm,pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', [
+ 			AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1',
+-- 
+1.7.9.7
+
package/oprofile/oprofile-004-fix-ppc64-specific-libpfm-usage.patch new file +105 -0

105 lines not on this page · raw message

package/oprofile/oprofile-005-fix-up-configure-to-handle-architectures-that-do-not.patch new file +154 -0

154 lines not on this page · raw message

package/oprofile/oprofile.mk +16 -2
@@ -8,7 +8,12 @@ OPROFILE_VERSION = 0.9.8
 OPROFILE_SITE = http://downloads.sourceforge.net/project/oprofile/oprofile/oprofile-$(OPROFILE_VERSION)
 OPROFILE_LICENSE = GPLv2+
 OPROFILE_LICENSE_FILES = COPYING
-OPROFILE_CONF_OPT = --localstatedir=/var --with-kernel-support
+OPROFILE_CONF_OPT = \
+	--localstatedir=/var \
+	--disable-account-check \
+	--enable-gui=no \
+	--with-kernel=$(STAGING_DIR)/usr
+OPROFILE_AUTORECONF = YES
 OPROFILE_BINARIES = utils/ophelp pp/opannotate pp/oparchive pp/opgprof
 OPROFILE_BINARIES += pp/opreport opjitconv/opjitconv daemon/oprofiled
 OPROFILE_BINARIES += utils/op-check-perfevents pe_profiling/operf libabi/opimport
@@ -29,7 +34,16 @@ ifeq ($(OPROFILE_ARCH),)
 OPROFILE_ARCH = $(BR2_ARCH)
 endif
 
-OPROFILE_DEPENDENCIES = popt binutils
+OPROFILE_DEPENDENCIES = popt binutils host-pkgconf
+ifneq ($(BR2_powerpc)$(BR2_PACKAGE_LIBPFM4),) # powerpc OR libpfm4 selected
+OPROFILE_DEPENDENCIES += libpfm4
+endif
+
+define OPROFILE_CREATE_FILES
+	touch $(@D)/NEWS $(@D)/AUTHORS $(@D)/ChangeLog
+endef
+
+OPROFILE_POST_PATCH_HOOKS += OPROFILE_CREATE_FILES
 
 define OPROFILE_INSTALL_TARGET_CMDS
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/usr/bin
#1 lore raw

PATCH v2 1/1 oprofile 0.9.8: fix compilation on powerpc

Dear Thomas De Schampheleire,

Quoted 12 lines · Thomas De Schampheleire

The oprofile build was broken on powerpc since version 0.9.8. This was detected in several autobuilds, like
http://autobuild.buildroot.net/results/6f6c02d18495907d50fcdfc6003ac20d493c55fe/

Thomas Petazzoni had some fixes pending in his own tree, and this patch is partially based on this work (credits to him). Here is an overview:
- I took over (and fixed) the oprofile.mk changes, except for the powerpc- specific part. For powerpc, there is a new dependency to libpfm4.
- I reimported those Yocto patches that were specific to the ppc build issues, but left out the other ones. Those can be added in separate commits.

Quoted 1 line
Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 oprofile 0.9.8: fix compilation on powerpc

In reply to Thomas De Schampheleire
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Thomas> The oprofile build was broken on powerpc since version 0.9.8. Thomas> This was detected in several autobuilds, like
Thomas> http://autobuild.buildroot.net/results/6f6c02d18495907d50fcdfc6003ac20d493c55fe/

Thomas> Thomas Petazzoni had some fixes pending in his own tree, and this patch is Thomas> partially based on this work (credits to him). Here is an overview:
Thomas> - I took over (and fixed) the oprofile.mk changes, except for the powerpc-
Thomas> specific part. For powerpc, there is a new dependency to libpfm4.
Thomas> - I reimported those Yocto patches that were specific to the ppc build
Thomas> issues, but left out the other ones. Those can be added in separate
Thomas> commits.

..

Thomas> +++ b/package/oprofile/Config.in Thomas> @@ -2,6 +2,7 @@ config BR2_PACKAGE_OPROFILE

 Thomas>  	bool "oprofile"
 Thomas>  	select BR2_PACKAGE_POPT
 Thomas>  	select BR2_PACKAGE_BINUTILS
 Thomas> +	select BR2_PACKAGE_LIBPFM4 if BR2_powerpc
 Thomas>  	depends on BR2_INSTALL_LIBSTDCPP
 Thomas>  	depends on !BR2_aarch64 # binutils
 Thomas>  	help

Thomas> -OPROFILE_DEPENDENCIES = popt binutils
Thomas> +OPROFILE_DEPENDENCIES = popt binutils host-pkgconf
Thomas> +ifneq ($(BR2_powerpc)$(BR2_PACKAGE_LIBPFM4),) # powerpc OR libpfm4 selected Thomas> +OPROFILE_DEPENDENCIES += libpfm4
Thomas> +endif

BR2_PACKAGE_LIBPFM4 is guaranteed to be enabled on powerpc, so I've changed it to just be:

ifeq (ifeq ($(BR2_PACKAGE_LIBPFM4),y)
OPROFILE_DEPENDENCIES += libpfm4
endif

Committed with this change, thanks.

Signature · 1 line
Bye, Peter Korsgaard