Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pkgconfig benchmark.pc not modified with addition of -lpfm when BENCHMARK_ENABLE_LIBPFM=On #1908

Open
Corin-EU opened this issue Jan 17, 2025 · 0 comments

Comments

@Corin-EU
Copy link

When the option BENCHMARK_ENABLE_LIBPFM=On is used, the installed CMAKE files provide the necessary test to find libpfm when other software using cmake is being built with benchmark as a dependency.

However no requirement to include libpfm as a library is added to the pkgconfig benchmark.pc file is added.

So unless one manually appends -lpfm to the benchmark.pc line for Libs

--- benchmark.pc.ORIG      2025-01-17 21:05:44.622488319 +0100
+++ benchmark.pc        2025-01-17 21:07:35.562542402 +0100
@@ -7,6 +7,6 @@
Description: Google microbenchmark framework
Version: 1.9.1

-Libs: -L${libdir} -lbenchmark
+Libs: -L${libdir} -lbenchmark -lpfm
Libs.private: -lpthread 
Cflags: -I${includedir}

when building software which uses benchmark via pkg-config eg movit (high-performance, high-quality video filters) the following error for undefined references to pfm_get_os_event and pfm_initialize occurs when linking

        /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /var/tmp/root/BUILD/BUILD_movit_20250117_195233/ccAqTAKg.ltrans3.ltrans.o: in function `benchmark::internal::PerfCounters::Create(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':

       <artificial>:(.text+0x8445): undefined reference to `pfm_get_os_event_encoding' 
       /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x894c): undefined reference to `pfm_initialize'

At first I tried appending -lpfm on the Libs.private line but that did not work but next test with it on the Libs line did work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant