pytorch / pytorch/cpuinfo

`USE_SYSTEM_GOOGLEBENCHMARK` does not build with benchmark-1.9.4

Open
#313 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.2k
Forks
409
PR merge metrics
No merged PRs in 30d

Description

I'm trying to package cpuinfo for pkgsrc. We prefer to use already existing packages instead of including copies of the same sources, so I tried using the pkgsrc google-benchmark package, which is currently at version 1.9.4 (the latest as of today).

Using this, the build breaks with:

[61/66] Building CXX object CMakeFiles/init-bench.dir/bench/init.cc.o
FAILED: [code=1] CMakeFiles/init-bench.dir/bench/init.cc.o
/scratch/wip/cpuinfo/work/.cwrapper/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -I/scratch/wip/cpuinfo/work/cpuinfo-33ed0be77d7767d0e2010e2c3cf972ef36c7c307/include -O2 -g -fstack-clash-protection -I/usr/pkg/include -MD -MT C
MakeFiles/init-bench.dir/bench/init.cc.o -MF CMakeFiles/init-bench.dir/bench/init.cc.o.d -o CMakeFiles/init-bench.dir/bench/init.cc.o -c /scratch/wip/cpuinfo/work/cpuinfo-33ed0be77d7767d0e2010e2c3cf972ef36c7c307/bench/in
it.cc
In file included from /scratch/wip/cpuinfo/work/cpuinfo-33ed0be77d7767d0e2010e2c3cf972ef36c7c307/bench/init.cc:1:
/scratch/wip/cpuinfo/work/.buildlink/include/benchmark/benchmark.h:1487:56: error: no matching function for call to 'make_unique<benchmark::internal::FunctionBenchmark>(const char [19], <unresolved overloaded function ty
pe>)'
 1486 |           ::benchmark::internal::make_unique<                         \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1487 |               ::benchmark::internal::FunctionBenchmark>(#__VA_ARGS__, \
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
 1488 |                                                         __VA_ARGS__)))
      |                                                         ~~~~~~~~~~~~
/scratch/wip/cpuinfo/work/cpuinfo-33ed0be77d7767d0e2010e2c3cf972ef36c7c307/bench/init.cc:10:1: note: in expansion of macro 'BENCHMARK'
   10 | BENCHMARK(cpuinfo_initialize)->Iterations(1)->Unit(benchmark::kMillisecond);
      | ^~~~~~~~~
In file included from /usr/include/g++/memory:75,
                 from /scratch/wip/cpuinfo/work/.buildlink/include/benchmark/benchmark.h:178:
/usr/include/g++/bits/unique_ptr.h:1096:5: note: candidate: 'template<class _Tp, class ... _Args> std::__detail::__invalid_make_unique_t<_Tp> std::make_unique(_Args&& ...)' (deleted)
 1096 |     make_unique(_Args&&...) = delete;
      |     ^~~~~~~~~~~
/usr/include/g++/bits/unique_ptr.h:1096:5: note:   template argument deduction/substitution failed:
/usr/include/g++/bits/unique_ptr.h: In substitution of 'template<class _Tp> using __invalid_make_unique_t = typename std::__detail::_MakeUniq::__invalid_type [with _Tp = benchmark::internal::FunctionBenchmark]':
/usr/include/g++/bits/unique_ptr.h:1096:5:   required by substitution of 'template<class _Tp, class ... _Args> std::__detail::__invalid_make_unique_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = benchmark::internal::Fu
nctionBenchmark; _Args = <missing>]'
/scratch/wip/cpuinfo/work/cpuinfo-33ed0be77d7767d0e2010e2c3cf972ef36c7c307/bench/init.cc:10:1:   required from here
/usr/include/g++/bits/unique_ptr.h:1057:11: error: no type named '__invalid_type' in 'struct std::__detail::_MakeUniq<benchmark::internal::FunctionBenchmark>'
 1057 |     using __invalid_make_unique_t = typename _MakeUniq<_Tp>::__invalid_type;
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/g++/bits/unique_ptr.h:1086:5: note: candidate: 'template<class _Tp> std::__detail::__unique_ptr_array_t<_Tp> std::make_unique(size_t)'
 1086 |     make_unique(size_t __num)
      |     ^~~~~~~~~~~
/usr/include/g++/bits/unique_ptr.h:1086:5: note:   candidate expects 1 argument, 2 provided
/usr/include/g++/bits/unique_ptr.h:1071:5: note: candidate: 'std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = benchmark::internal::FunctionBenchmark; _Args = {}; __detail::__unique_ptr_t<_Tp>
= __detail::__unique_ptr_t<benchmark::internal::FunctionBenchmark>]'
 1071 |     make_unique(_Args&&... __args)
      |     ^~~~~~~~~~~
/usr/include/g++/bits/unique_ptr.h:1071:5: note:   candidate expects 0 arguments, 2 provided
[63/66] Building CXX object CMakeFiles/init-test.dir/test/init.cc.o

When I provide the version 1.6.1 that DownloadGoogleBenchmark.cmake tries to fetch, the build succeeds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DownloadGoogleBenchmark.cmake and bench/init.cc, then compare the system benchmark 1.9.4 interface with the bundled 1.6.1 version that succeeds. Verify the compatibility change by rebuilding with USE_SYSTEM_GOOGLEBENCHMARK enabled and running the init test in test/init.cc.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.