cmakeクロスコンパイルgrpc問題の解決について:Failed to determine the source files for the regular expression backend


cmakeクロスコンパイルGRPCでは、次の正規表現が検出されなかったという問題が発生し、grpcのcross compileに失敗しました.
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- 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
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- compiled but failed to run
CMake Error at third_party/benchmark/CMakeLists.txt:229 (message):
  Failed to determine the source files for the regular expression backend


-- Configuring incomplete, errors occurred!


解決策は次の通りです.cmakeにはtryがあります.runの検査プログラムはシステムの各C++コンパイルの特性を検査して、公式のドキュメントは書きます:
When cross compiling, the executable compiled in the first step usually cannot be run on the build host. The try_run command checks the CMAKE_CROSSCOMPILING variable to detect whether CMake is in cross-compiling mode. If that is the case, it will still try to compile the executable, but it will not try to run the executable unless the CMAKE_CROSSCOMPILING_EMULATOR variable is set. Instead it will create cache variables which must be filled by the user or by presetting them in some CMake script file to the values the executable would have produced if it had been run on its actual target platform.

だから-DCMAKEを追加したらCROSSCOMPILING=trueのオプションの場合、検出プログラムにエラーが発生します.これらの特性変数を0に設定すると、手動で設定したことを示します.-DRUN_HAVE_std_REGEX -DRUN_HAVE_GNU_POSIX_REGEX -DRUN_HAVE_POSIX_REGEX -DRUN_HAVE_STEADY_CLOCKには次のような方法があります.
cmake .. -DCMAKE_CROSSCOMPILING=true -DCMAKE_C_COMPILER=/mnt/workspace/osrc/tools/cross_compiler/bin/arm-linux-gnueabihf-gcc  -DCMAKE_CXX_COMPILER=/mnt/tools/cross_compiler/bin/arm-linux-gnueabihf-g++  -DRUN_HAVE_GNU_POSIX_REGEX=0


後続の構成に成功しました.
-- 
-- 3.7.0.0
-- git Version: v1.4.0-e776aa02
-- Version: 1.4.0
-- Performing Test HAVE_STD_REGEX -- compiled but failed to run
-- Performing Test HAVE_GNU_POSIX_REGEX -- success
-- Performing Test HAVE_POSIX_REGEX -- compiled but failed to run
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- compiled but failed to run
-- Performing Test BENCHMARK_HAS_O3_FLAG
-- Performing Test BENCHMARK_HAS_O3_FLAG - Success
-- Performing Test BENCHMARK_HAS_CXX03_FLAG
-- Performing Test BENCHMARK_HAS_CXX03_FLAG - Success
-- Performing Test BENCHMARK_HAS_WNO_ODR
-- Performing Test BENCHMARK_HAS_WNO_ODR - Success
-- Configuring done
-- Generating done