Skip to content

benchmark complile error #70

@rangerToby

Description

@rangerToby

benchmark complile error
device: jetson nano
os: ubuntu18.04
gcc7.4/g++7.4/cmake3.10.2

when i try to compile dabnn and its third part code on jetson nano ubuntu16.04(arm-noAndroid),
cmake .. is all right
when i come to “cmake --build .” ,i got some errors about benchmark code:

In file included from /home/t/project_win/02_190731_BNN/dabnn/benchmark/benchmark_single_model.cpp:3:0:
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h: In instantiation of ‘benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...)::<lambda(benchmark::State&)> [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]’:
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1053:48: required from ‘struct benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]::<lambda(class benchmark::State&)>’
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1052:38: required from ‘benchmark::internal::Benchmark* benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]’/home/t/project_win/02_190731_BNN/dabnn/benchmark/benchmark_single_model.cpp:22:74: required from here
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1053:41: error: variable ‘fn’ has function type
name, [=](benchmark::State& st) { fn(st, args...); });
^~
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1053:41: error: variable ‘fn’ has function type
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h: In instantiation of ‘struct benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]::<lambda(class benchmark::State&)>’:
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1052:38: required from ‘benchmark::internal::Benchmark* benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]’/home/t/project_win/02_190731_BNN/dabnn/benchmark/benchmark_single_model.cpp:22:74: required from here
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1053:41: error: field ‘benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]::<lambda(benchmark::State&)>::’ invalidly declared function type
/home/t/project_win/02_190731_BNN/dabnn/third_party/benchmark/src/../include/benchmark/benchmark.h:1039:22: warning: ‘benchmark::internal::Benchmark* benchmark::RegisterBenchmark(const char*, Lambda&&) [with Lambda = benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]::<lambda(benchmark::State&)>]’, declared using local type ‘benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&)(benchmark::State&, std::__cxx11::basic_string); Args = {char*&}]::<lambda(benchmark::State&)>’, is used but never defined [-fpermissive]
internal::Benchmark* RegisterBenchmark(const char* name, Lambda&& fn) {
^~~~~~~~~~~~~~~~~
benchmark/CMakeFiles/benchmark_single_model.dir/build.make:62: recipe for target 'benchmark/CMakeFiles/benchmark_single_model.dir/benchmark_single_model.cpp.o' failed

i tried to add "add_cxx_compiler_flag(-fpermissive)" in benchmark/CMakeLists.txt , and third_part/benchmark/CMakeLists.txt,but got the same error.
I googled it and got close issue on this link: gabime/spdlog#931

tmp solution :
set CMakeLists.txt
option(BNN_BUILD_BENCHMARK "Build benchmark" OFF)
option(BNN_NET_BENCHMARK "define BNN_BENCHMARK" OFF)
rm old cmake files and compile again, it can be compiled completely.

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