Maratyszcza / NNPACK

Acceleration package for neural networks on multi-core CPUs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to build benchmarks -- undefined reference to BenchmarkName

forresti opened this issue · comments

Following the instructions on https://github.com/Maratyszcza/NNPACK#development-builds, I did the following to build NNPACK:

git clone https://github.com/Maratyszcza/NNPACK.git
cd NNPACK
confu setup
./configure.py
ninja 

and it successfully built a bunch of stuff, until it failed with the following error:

[150/196] LINK bin/winograd-bench
FAILED: /path/to/NNPACK/bin/winograd-bench
g++ -pthread  -o /path/to/NNPACK/bin/winograd-bench /path/to/NNPACK/build/bench/winograd.cc.o /path/to/NNPACK/lib/libnnpack.a /path/to/NNPACK/lib/libpthreadpool.a /path/to/NNPACK/lib/libcpuinfo.a /path/to/NNPACK/lib/libclog.a /path/to/NNPACK/lib/libgooglebenchmark.a -lrt
/path/to/NNPACK/lib/libgooglebenchmark.a(benchmark_runner.cc.o): In function `benchmark::internal::RunBenchmark(benchmark::internal::BenchmarkInstance const&, std::vector<benchmark::BenchmarkReporter::Run, std::allocator<benchmark::BenchmarkReporter::Run> >*)':
/path/to/NNPACK/deps/googlebenchmark/src/benchmark_runner.cc:201: undefined reference to `benchmark::BenchmarkName::str[abi:cxx11]() const'
/path/to/NNPACK/lib/libgooglebenchmark.a(benchmark.cc.o): In function `benchmark::RunSpecifiedBenchmarks(benchmark::BenchmarkReporter*, benchmark::BenchmarkReporter*)':
/path/to/NNPACK/deps/googlebenchmark/src/benchmark.cc:402: undefined reference to `benchmark::BenchmarkName::str[abi:cxx11]() const'
/path/to/NNPACK/deps/googlebenchmark/src/benchmark.cc:230: undefined reference to `benchmark::BenchmarkName::str[abi:cxx11]() const'
/path/to/NNPACK/lib/libgooglebenchmark.a(benchmark_register.cc.o): In function `benchmark::internal::BenchmarkFamilies::FindBenchmarks(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<benchmark::internal::BenchmarkInstance, std::allocator<benchmark::internal::BenchmarkInstance> >*, std::ostream*)':
/path/to/NNPACK/deps/googlebenchmark/src/benchmark_register.cc:229: undefined reference to `benchmark::BenchmarkName::str[abi:cxx11]() const'
/path/to/NNPACK/lib/libgooglebenchmark.a(json_reporter.cc.o): In function `benchmark::JSONReporter::PrintRunData(benchmark::BenchmarkReporter::Run const&)':
/path/to/NNPACK/deps/googlebenchmark/src/json_reporter.cc:198: undefined reference to `benchmark::BenchmarkName::str[abi:cxx11]() const'
/path/to/NNPACK/lib/libgooglebenchmark.a(reporter.cc.o):/path/to/NNPACK/deps/googlebenchmark/src/reporter.cc:86: more undefined references to `benchmark::BenchmarkName::str[abi:cxx11]() const' follow
collect2: error: ld returned 1 exit status

(For brevity, I find/replaced my actual path to /path/to.)

When I do a multithreaded ninja build, of the benchmarks fail to build with the above error. I am particularly interested to use the benchmarks, so I definitely want to figure out how to build them.

Any ideas what might be wrong?
I poked around in googlebenchmark for a while, but I been able to diagnose it so far.

Interestingly, when I look at the auto-generated NNPACK/build.ninja file, I see most of the other code files from googlebenchmark (e.g. csv_reporter.cc, statistics.cc), but not benchmark_name.cc. That seems odd.

Outside of NNPACK, I see someone else on the googlebenchmark Issues that someone else had a similar problem with an undefined reference to BenchmarkName, and it turned out that the issue was that the application's build system accidentally ignored benchmark_name.cc.
google/benchmark#895

Google Benchmark added source files, and those need to be reflected in the confu recipe: https://github.com/Maratyszcza/confu/blob/master/confu/recipes/googlebenchmark.py#L24-L43

Alternatively, you can use CMake to build NNPACK.

That worked. Thanks!