Neuron 源码交叉编译时,报”configuration files were considered but not accepted

你好,我是按https://www.emqx.com/zh/blog/how-to-cross-compile-neuron-source-code这篇文章进行操作的。
目前,依赖库的交叉编译是没有问题的。但在Neuron 源码交叉编译时遇到了问题,大概原因是NanoSDK版本不匹配,但我尝试了全部的NanoSDK版本,问题依旧没有解决。

以下是编译环境与日志:

#uname -v
#16~18.04.1-Ubuntu SMP Thu Feb 7 14:06:04 UTC 2019
# uname -a
Linux 100ask 4.18.0-15-generic #16~18.04.1-Ubuntu SMP Thu Feb 7 14:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

(1) neuron

# cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/arm-linux-gnueabihf.cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON
CMake Error at CMakeLists.txt:55 (find_package):
  Could not find a configuration file for package "nng" that is compatible
  with requested version "".

  The following configuration files were considered but not accepted:
     **/_usr/local/lib/cmake/nng/nng-config.cmake_** , version: 1.6.0-pre (64bit)



-- Configuring incomplete, errors occurred!
See also "/opt/module/neuron/build/CMakeFiles/CMakeOutput.log".

(2) NanoSDK安装过程:

# cmake -DBUILD_SHARED_LIBS=OFF -DNNG_TESTS=OFF -DNNG_ENABLE_SQLITE=ON -DNNG_ENABLE_TLS=ON .. && make && sudo make install
....
[100%] Linking C static library libnng.a
[100%] Built target nng
[100%] Built target nng
Install the project...
...
-- Installing: **_/usr/local/lib/cmake/nng/nng-config.cmake_**
-- Installing: /usr/local/lib/cmake/nng/nng-config-version.cmake

neuron 安装的是 arm 架构的,但是 nanosdk 没有指定,所以默认 x86_64,需要统一所编译的架构。

请教下,如何指定呢?另外,再咨询下,NanoSDK如何进行交叉编译,在这篇 https://www.emqx.com/zh/blog/how-to-cross-compile-neuron-source-code文章中,只有NanoSDK还是按x86编译的(其它依赖库是按arm架构编译的)。

问题已解决,NanoSDK需要进行交叉编译(cmake -DBUILD_SHARED_LIBS=OFF -DNNG_TESTS=OFF -DNNG_ENABLE_SQLITE=ON -DNNG_ENABLE_TLS=ON -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_STAGING_PREFIX=/opt/externs/libs/arm-linux-gnueabihf -DCMAKE_PREFIX_PATH=/opt/externs/libs/arm-linux-gnueabihf … && make && make install)
且在中间临时生成的 CMakeCache.txt中修改NanoSDK库路径(nng_DIR:PATH=/opt/externs/libs/arm-linux-gnueabihf/lib/cmake/nng)