[llvm-dev] [PGO] cmake: Check for opagent.h when building with -DLLVM_USE_OPROFILE=ON

Sedat Dilek via llvm-dev llvm-dev at lists.llvm.org
Sun Jul 24 06:45:42 PDT 2016


Hi,

I am building a llvm-toolchain v3.8.1 and use...

PGO_CMAKE_OPTS="-DLLVM_USE_OPROFILE=ON"

...in my build-script (see file-attachments).

My build stopped saying... <opagent.h> not found.

[1] says...

00024 #include <opagent.h>

So, it is possible to check for the existence of <opagent.h> in the
cmake/configure stage *before* starting the build.
It is not very pleasant to see the build breaking.

NOTE: Ubuntu/precise has no official oprofile package available which
ships "/usr/include/opagent.h".

I did not check if upstream has a fix or workaround for this.

Thanks.

Regards,
- Sedat -

[1] http://llvm.org/docs/doxygen/html/OProfileWrapper_8h_source.html

P.S.: Note2myself: Backporting oprofile v0.9.9

For backporting oprofile v0.9.9 from Ubuntu/trusty I needed
libiberty-dev from kubuntu-ppa/backports PPA software repository.
Furthermore, hack around to disable the build of oprofile-gui and
java-related libs (see attached diff-file).

[2] http://packages.ubuntu.com/search?keywords=libiberty
[3] http://www.ubuntuupdates.org/package/kubuntu-ppa_backports/precise/main/base/libiberty-dev
-------------- next part --------------
--- oprofile-0.9.9.orig/debian/changelog	2014-04-05 01:20:04.000000000 +0200
+++ oprofile-0.9.9/debian/changelog	2016-07-24 15:22:51.270272652 +0200
@@ -1,3 +1,19 @@
+oprofile (0.9.9-0ubuntu8~precise+dileks1) precise; urgency=low
+
+  * Suppress building of oprofile-gui and libjvmti-oprofile0 packages.
+  * debian/control
+    + Downgrade to automake in Build-Depends
+    + Remove Build-Depends for oprofile-gui and libjvmti-oprofile0
+    + Remove Packages sections of oprofile-gui and libjvmti-oprofile0
+  * debian/rules:
+    + Remove aclocal options from autogen line
+    + Drop unavailable options from configure line
+    + Remove lines referring to oprofile-gui and libjvmti-oprofile0
+  * Build against libiberty-dev (20131116-1~ubuntu12.04~ppa1) from kubuntu-ppa/backports.
+  * Rebuild on Ubuntu/precise. 
+
+ -- Sedat Dilek <sedat.dilek at gmail.com>  Sun, 24 Jul 2016 15:17:10 +0200
+
 oprofile (0.9.9-0ubuntu8) trusty; urgency=medium
 
   * debian/patches/Fix-up-event-codes-for-marked-architected-events.patch:
--- oprofile-0.9.9.orig/debian/control	2014-03-10 18:14:55.000000000 +0100
+++ oprofile-0.9.9/debian/control	2016-07-24 15:22:51.270272652 +0200
@@ -6,7 +6,7 @@ XSBC-Original-Maintainer: LIU Qi <liuqi8
 Uploaders: Roberto C. Sanchez <roberto at connexer.com>
 Standards-Version: 3.9.3
 Build-Depends:
- automake1.10,
+ automake,
  binutils-dev,
  libiberty-dev,
  libpfm4-dev [ppc64 ppc64el],
@@ -15,14 +15,11 @@ Build-Depends:
  docbook-xsl,
  g++ (>>3.3.1),
  libpopt-dev,
- libqt4-dev,
  libtool,
  libx11-dev,
  pkg-config,
- qt4-dev-tools,
  xsltproc,
- zlib1g-dev,
- default-jdk
+ zlib1g-dev
 Homepage: http://oprofile.sourceforge.net
 Vcs-Browser: http://git.printk.org/?p=liuqi/debian/oprofile.git;a=summary
 Vcs-git: git://git.printk.org/liuqi/debian/oprofile.git
@@ -45,7 +42,6 @@ Depends:
  ${shlibs:Depends}
 Replaces: oprofile-common
 Recommends: binutils
-Suggests: oprofile-gui
 Description: system-wide profiler for Linux systems
  OProfile is a performance profiling tool for Linux systems, capable
  of profiling all running code at low overhead.  It consists of a
@@ -74,24 +70,3 @@ Description: system-wide profiler for Li
  for turning data into information.
  .
  This package contains the opagent runtime library.
-
-Package: libjvmti-oprofile0
-Architecture: linux-any
-Depends: ${misc:Depends}, ${shlibs:Depends}
-Description: system-wide profiler for Linux systems (Java runtime library)
- OProfile is a performance profiling tool for Linux systems, capable
- of profiling all running code at low overhead.  It consists of a
- daemon for collecting sample data, plus several post-profiling tools
- for turning data into information.
- .
- This package contains the jvmti_oprofile runtime library for Java support.
-
-Package: oprofile-gui
-Architecture: linux-any
-Replaces: oprofile
-Depends: debconf | debconf-2.0, oprofile, ${misc:Depends}, ${shlibs:Depends}
-Recommends: binutils
-Description: system-wide profiler for Linux systems (GUI components)
- This package contains only the GUI components of the oprofile package.
- This allows oprofile to be used on machines that require a much
- smaller footprint, or that do not wish to use an X Windows interface.
--- oprofile-0.9.9.orig/debian/rules	2014-03-10 18:14:55.000000000 +0100
+++ oprofile-0.9.9/debian/rules	2016-07-24 15:40:39.682239142 +0200
@@ -18,9 +18,9 @@ endif
 
 configure: config-stamp 
 config-stamp: $(QUILT_STAMPFN)
-	cd $(CURDIR) && ACLOCAL=aclocal-1.10 AUTOMAKE=automake-1.10 ./autogen.sh
+	cd $(CURDIR) && AUTOMAKE=automake ./autogen.sh
 #	cd $(CURDIR) && autoreconf -vfi
-	cd $(CURDIR) && ./configure --host=$(DEB_HOST_GNU_TYPE) --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-qt-includes=/usr/include/qt4 --with-kernel-support --disable-werror --enable-gui=qt4 --with-java=/usr/lib/jvm/default-java
+	cd $(CURDIR) && ./configure --host=$(DEB_HOST_GNU_TYPE) --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-werror --enable-gui=no --with-java=no
 	touch config-stamp
 
 build-arch: configure build-arch-stamp
@@ -54,24 +54,17 @@ install: build
 	cd $(CURDIR) && DESTDIR=$(CURDIR)/debian/oprofile $(MAKE) install 
 
 	# Move some files to their proper location
-	mv debian/oprofile/usr/bin/oprof_start \
-	   debian/oprofile-gui/usr/bin
-	cp debian/oprofile/usr/share/man/man1/oprofile.1 \
-	   debian/oprofile-gui/usr/share/man/man1/oprof_start.1
+	# oprofile-gui: Remove man-page
+	rm -f debian/oprofile/usr/share/man/man1/oprof_start.1
 
 	mkdir -p debian/libopagent1/usr/lib
-	mkdir -p debian/libjvmti-oprofile0/usr/lib
 	mv debian/oprofile/usr/lib/oprofile/libopagent.so.* \
 	  debian/libopagent1/usr/lib/
-	mv debian/oprofile/usr/lib/oprofile/libjvmti_oprofile.so.* \
-	  debian/libjvmti-oprofile0/usr/lib/
-	for i in debian/libopagent1/usr/lib/*.so.* \
-	         debian/libjvmti-oprofile0/usr/lib/*.so.*; do \
+	for i in debian/libopagent1/usr/lib/*.so.*; do \
 	  b=$$(basename $$i); \
 	  ln -sf ../$$b debian/oprofile/usr/lib/oprofile/$$b; \
 	done
 	ln -sf libopagent.so.1 debian/oprofile/usr/lib/libopagent.so
-	ln -sf libjvmti_oprofile.so.0 debian/oprofile/usr/lib/libjvmti_oprofile.so
 
 	# Fixup non-empty-dependency_libs-in-la-file lintian error
 	sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build_llvm-toolchain.sh
Type: application/x-sh
Size: 6593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160724/427a9863/attachment-0001.sh>


More information about the llvm-dev mailing list