Skip to content

USE_SYSTEM_GOOGLEBENCHMARK does not build with benchmark-1.9.4 #313

@0-wiz-0

Description

@0-wiz-0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions