Error building the benchmarks and validation tests
While trying the build the library together with validation test and/or benchmarks, I encountered the following error:
scons: *** [build/tests/benchmark/PerformanceProgramOptions.o] Error 1
scons: *** [build/tests/benchmark/PerformanceUserConfiguration.o] Error 1
In file included from tests/benchmark/Profiler.cpp:24:0:
tests/benchmark/Profiler.h:29:37: fatal error: benchmark/benchmark_api.h: No such file or directory
#include "benchmark/benchmark_api.h"
^
compilation terminated.
scons: *** [build/tests/benchmark/Profiler.o] Error 1
In file included from tests/benchmark/PerformanceProgramOptions.h:27:0,
from tests/benchmark/main.cpp:26:
tests/ProgramOptions.h:31:37: fatal error: boost/program_options.hpp: No such file or directory
#include "boost/program_options.hpp"
^
compilation terminated.
build command:
scons Werror=1 -j8 debug=0 asserts=0 neon=1 opencl=1 embed_kernels=1 os=android arch=arm64-v8a benchmark_tests=1
Do I need to install any third party libraries to build these tests? I have boost-dev installed.
Hi, have you already followed the instruction here to setup the boost and google benchmark environment? https://arm-software.github.io/ComputeLibrary/v17.06/tests.xhtml
I have similar error.
Yes I did setup the boost and google benchmark. The program_options.hpp is located in /usr/include/. Still, I get similar output log as the above comment.
Also, as per https://arm-software.github.io/ComputeLibrary/v17.06/tests.xhtml , I included the LD_LIBRARY_PATH to libboost_program_options.a and libboost_unit_test_framework.a which is generated inside "Stage/lib" folder of "boost_1_64_0".
Can anyone please help and show the process to compile and run for example "GEMM.cpp" under benchmark folder for android from UBUNTU host.
/usr/include/ is for your host headers not your device headers.
Try to put the headers inside an include folder in your ComputeLibrary checkout: ComputeLibrary/include/boost/...
Well, I tried that and now it is included at the time of compilation. However, there are lots of errors like "undefined reference to benchmark::internal::InitializeStreams()'" and "PerformanceProgramOptions.cpp:(.text+0x40): undefined reference to boost::program_options::options_description::m_default_line_length'"
In https://arm-software.github.io/ComputeLibrary/v17.06/tests.xhtml, it is said that, "libbenchmark.a" library is needed by ACL. The example command to build google benchmark is for android 32bit.
cmake -DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER=arm-linux-androideabi-clang++
-DBENCHMARK_ENABLE_LTO=false -DBENCHMARK_ENABLE_TESTING=false ..
However, when I want to compile the library for Android 64bit there are errors. Is there any example to build Google's benchmark and also boost libraries for android 64 bit?
No, there is no separate example. Simply use a 64bit toolchain to build Google benchmark and Boost. For example replace -DCMAKE_CXX_COMPILER=arm-linux-androideabi-clang++ with -DCMAKE_CXX_COMPILER=aarch64-linux-android-g++ to build Google benchmark for 64bit.
Yes, i did that aswell exactly before posting my last comment. If I try to complie using -DCMAKE_CXX_COMPILER=aarch64-linux-android-g++ then I get error like below in case of Google benchmark:
-- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.9.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /home/atul/git_work/Android/aarch64_toolchain_14b/aarch64-linux-android-4.9/bin/aarch64-linux-android-g++ -- Check for working CXX compiler: /home/atul/git_work/Android/aarch64_toolchain_14b/aarch64-linux-android-4.9/bin/aarch64-linux-android-g++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found Git: /usr/bin/git (found version "1.9.1") -- git Version: v1.1.0-ee3cfca6-dirty -- Version: 1.1.0 -- Performing Test HAVE_CXX_FLAG_STD_CXX11 -- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success -- Performing Test HAVE_CXX_FLAG_WALL -- Performing Test HAVE_CXX_FLAG_WALL - Success -- Performing Test HAVE_CXX_FLAG_WEXTRA -- Performing Test HAVE_CXX_FLAG_WEXTRA - Success -- Performing Test HAVE_CXX_FLAG_WSHADOW -- Performing Test HAVE_CXX_FLAG_WSHADOW - Success -- Performing Test HAVE_CXX_FLAG_WERROR -- Performing Test HAVE_CXX_FLAG_WERROR - Success -- Performing Test HAVE_CXX_FLAG_PEDANTIC -- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success -- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS -- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success -- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 -- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed -- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL -- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success -- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING -- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success -- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT -- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT - Success -- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING -- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success -- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY -- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Success -- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile -- Performing Test HAVE_CXX_FLAG_COVERAGE -- Performing Test HAVE_CXX_FLAG_COVERAGE - Success -- Performing Test HAVE_STD_REGEX -- Performing Test HAVE_STD_REGEX -- compiled but failed to run -- Performing Test HAVE_GNU_POSIX_REGEX -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile -- Performing Test HAVE_POSIX_REGEX -- Performing Test HAVE_POSIX_REGEX -- compiled but failed to run CMake Error at CMakeLists.txt:183 (message): Failed to determine the source files for the regular expression backend
-- Configuring incomplete, errors occurred! See also "/home/atul/git_work/Google/benchmark/build/CMakeFiles/CMakeOutput.log". See also "/home/atul/git_work/Google/benchmark/build/CMakeFiles/CMakeError.log".
@atrah22 I had the same problem but resolved it by following the advice in Google Benchmark issue #351 to use -DRUN_HAVE_<...> options.
To wit, I used the following flags:
-DBENCHMARK_ENABLE_LTO=OFF
-DBENCHMARK_ENABLE_TESTING=OFF
-DBUILD_STATIC_LIBS=ON
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_CROSSCOMPILING=1
-DRUN_HAVE_STD_REGEX=0
-DRUN_HAVE_POSIX_REGEX=0
-DRUN_HAVE_GNU_POSIX_REGEX=0
-DRUN_HAVE_STEADY_CLOCK=0
(NB: Use 1 and 0, not ON and OFF.)
I get a failure with the following commands:
$ export CPATH=$CK_ENV_LIB_GBENCHMARK_INCLUDE:$CPATH
$ scons Werror=1 -j1 neon=1 opencl=0 os=linux arch=arm64-v8a build=native benchmark_tests=1
(where the $CK_ENV_LIB_GBENCHMARK_INCLUDE env var points to the include subdirectory of the installation dir with the latest checkout).
Here's the error:
g++ -o build/tests/benchmark/Profiler.o -c -Wno-deprecated-declarations -Wall -DARCH_ARM -Wextra -Wno-unused-parameter -pedantic -Wdisabled-optimization -Wformat=2 -Winit-self -Wstrict-overflow=2 -Wswitch-default -fpermissive -std=gnu++11 -Wno-vla -Woverloaded-virtual -Wctor-dtor-privacy -Wsign-promo -Weffc++ -Wno-format-nonliteral -Wno-overlength-strings -Wno-strict-overflow -Wlogical-op -Wnoexcept -Wstrict-null-sentinel -march=armv8-a -Werror -O3 -ftree-vectorize -Wno-missing-field-initializers -Wno-overloaded-virtual -D_GLIBCXX_USE_NANOSLEEP -DARM_COMPUTE_CPP_SCHEDULER=1 -Iinclude -I. -Ibuild/tests -Itests -Itests -I3rdparty/include tests/benchmark/Profiler.cpp
In file included from tests/benchmark/Profiler.h:29:0,
from tests/benchmark/Profiler.cpp:24:
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark_api.h:19:5: error: #warning is a GCC extension [-Werror]
# warning the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead
^
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark_api.h:19:5: error: #warning the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead [-Werror=cpp]
In file included from /home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark_api.h:25:0,
from tests/benchmark/Profiler.h:29,
from tests/benchmark/Profiler.cpp:24:
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1005:7: error: ‘class benchmark::BenchmarkReporter’ has pointer data members [-Werror=effc++]
class BenchmarkReporter {
^
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1005:7: error: but does not override ‘benchmark::BenchmarkReporter(const benchmark::BenchmarkReporter&)’ [-Werror=effc++]
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1005:7: error: or ‘operator=(const benchmark::BenchmarkReporter&)’ [-Werror=effc++]
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h: In constructor ‘benchmark::BenchmarkReporter::Run::Run()’:
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1017:5: error: ‘benchmark::BenchmarkReporter::Run::benchmark_name’ should be initialized in the member initialization list [-Werror=effc++]
Run()
^
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1017:5: error: ‘benchmark::BenchmarkReporter::Run::report_label’ should be initialized in the member initialization list [-Werror=effc++]
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1017:5: error: ‘benchmark::BenchmarkReporter::Run::error_message’ should be initialized in the member initialization list [-Werror=effc++]
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h: In constructor ‘benchmark::CSVReporter::CSVReporter()’:
/home/anton/CK_TOOLS/lib-gbenchmark-trunk-gcc-5.4.0-linux-64/install/include/benchmark/benchmark.h:1172:3: error: ‘benchmark::CSVReporter::user_counter_names_’ should be initialized in the member initialization list [-Werror=effc++]
CSVReporter() : printed_header_(false) {}
^
cc1plus: all warnings being treated as errors
It will probably go away with -Werror=0 but the deprecation warning is worth listening too.
The following worked for me when building the benchmark library (I had to set one of the POSIX options to 1):
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=aarch64-linux-android-g++ \
-DBENCHMARK_ENABLE_LTO=OFF \
-DBENCHMARK_ENABLE_TESTING=OFF \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CROSSCOMPILING=1 \
-DRUN_HAVE_STD_REGEX=0 \
-DRUN_HAVE_POSIX_REGEX=0 \
-DRUN_HAVE_GNU_POSIX_REGEX=1 \
-DRUN_HAVE_STEADY_CLOCK=0 \
-DBENCHMARK_ENABLE_LTO=false -DBENCHMARK_ENABLE_TESTING=false ..
But I still can't find the right toolset option to build boost. This is what I tried:
./b2 --with-program_options --with-test link=static toolset=aarch64-linux-android-g++ target-os=android define=BOOST_TEST_ALTERNATIVE_INIT_API
I end up with the error:
aarch64.jam: No such file or directory
/home/c-morikawa/tools/boost_1_60_0/tools/build/src/build/toolset.jam:43: in toolset.using
ERROR: rule "aarch64.init" unknown in module "toolset".
Sorry about all these issues, just so you know, we're in the process of writing our own framework, so hopefully dependencies on boost and google benchmark will be removed soon.
Thankyou all. @mo-morikawa Yes, your solution worked in case of Google Benchmark. I also compiled succesfully boost for Android os and aarch64 (arm64-v8a). Below is the sloution:
cd ./boost_1_64_0
./bootsrip.sh
vi ./tools/build/example/user-config.jam
Uncomment "using gcc" under GCC configuration
Replace "using gcc" with "using gcc : arm : aarch64-linux-android-g++;
cp ./tools/build/example/user-config.jam ~/
NOTE: This is because, user-config.jam file is not loaded alike previous versions until it is saved in the home folder.
./b2 --with-program_options --with-test link=static
define=BOOST_TEST_ALTERNATIVE_INIT_API
toolset=gcc-arm target-os=android
NOTE: Now, The libraries will be built in the stage/lib folder for android os and aarch64 (arm64-v8a)
@AnthonyARM Thankyou for your quick replies. Untill the dependencies are removed, it might be helpful for others if there is a tutorial for google benchmark and boost compilation for android os and arm arch or maybe the link to this issue can be posted in case of tutorial.
We've detailed how we built them in the documentation but it looks like you ran into more issues than we did.
I will point people at this thread for extra help.
@atrah22 Thanks a lot! That worked.
Just for the benefit of others who want to try this, I too want to mention that I had to add Werror=0 to build the tests.
@AnthonyARM Thanks again for the help! Google's benchmark gives a number of warnings, so I am looking forward to using ARM's own framework.
Dependency from google benchmark and boost test framework was removed in v17.09 release. Closing issue.