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


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


...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.


- 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] Ubuntu – Package Search Results -- libiberty
[3] UbuntuUpdates - Package "libiberty-dev" (precise 12.04)

oprofile_debian.diff (5.18 KB)

build_llvm-toolchain.sh (6.44 KB)

[ CC llvm-dev ]

Hi Chris,

please see <https://llvm.org/bugs/show_bug.cgi?id=28736>.

- Sedat -