benchmark
benchmark copied to clipboard
master is broken on Android
master
version (I tested revision c9311a44e1280853632fe2472345dd04514a2f74) fails to build on Android, with the error:
/Users/marat/benchmark/src/sysinfo.cc:586:21: error: use of undeclared identifier 'getloadavg'
const int nelem = getloadavg(res.data(), kMaxSamples);
^
1 error generated.
Repro:
git clone https://github.com/google/benchmark.git
cd benchmark
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/android/ndk/build/cmake/android.toolchain.cmake -DBENCHMARK_ENABLE_TESTING=OFF ..
make
It looks like android is being reported as BENCHMARK_OS_LINUX, but it doesn't have getloadavg.
The right fix is likely to define a BENCHMARK_OS_ANDROID and then make sure everything that currently is compiled in is also compiled when that is defined.
On Mon, Nov 26, 2018 at 6:50 PM Marat Dukhan [email protected] wrote:
master version (I tested revision c9311a4 https://github.com/google/benchmark/commit/c9311a44e1280853632fe2472345dd04514a2f74) fails to build on Android, with the error:
/Users/marat/benchmark/src/sysinfo.cc:586:21: error: use of undeclared identifier 'getloadavg' const int nelem = getloadavg(res.data(), kMaxSamples); ^ 1 error generated.
Repro:
git clone https://github.com/google/benchmark.gitcd benchmark mkdir build && cd build cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/android/ndk/build/cmake/android.toolchain.cmake -DBENCHMARK_ENABLE_TESTING=OFF .. make
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/benchmark/issues/731, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfIMlIQxqbi9f7pKq3cQXelyOCoz8M6ks5uzDfxgaJpZM4Yznil .
So how does one fix this? I do not understand @dominichamon 's answer.
Someone using android will have to make it build, and submit a PR.