我正在使用QNX编译mlpack。请继续报告以下错误:CMakeLists.txt:28 (message):QNX_HOST environment variable not set!!!
的CMake错误我在CMakeLists.txt
中添加了以下内容:
set (QNX_HOST “/data/QNX/qnx700/host/linux”)
set (QNX_TARGET “/data/QNX/qnx700/target/qnx7”)
我首先执行了以下命令:
source /etc/bash.bashrc_qnx qnx_aarch64
source /data/QNX/qnx700/qnxsdp-env.sh
=>
QNX_HOST=/data/QNX/qnx700/host/linux/x86_64
QNX_TARGET=/data/QNX/qnx700/target/qnx7
MAKEFLAGS=-I/data/QNX/qnx700/target/qnx7/usr/include
和cmake ..
但sudo make
命令仍然报告错误–"error: environment variables QNX_HOST and QNX_TARGET not defined
"。以下是零件文档CMakeLists.txt的内容:
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_HOST_SYSTEM_NAME QNX)
set(QNX_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 7.0.0)
set(CMAKE_CROSSCOMPILING 1)
set( TOOLCHAIN QNX )
set(CMAKE_SYSROOT "$ENV{TOOLCHAIN_PATH}")
#set (QNX_HOST "/data/QNX/qnx700/host/linux")
#set (QNX_TARGET "/data/QNX/qnx700/target/qnx7")
set(QNX_HOST "$ENV{QNX_HOST}")
set(QNX_TARGET "$ENV{QNX_TARGET}")
message(STATUS "*********************************")
message(STATUS "${QNX_HOST}")
message(STATUS "${QNX_TARGET}")
message(STATUS "*********************************")
#Check environment variables
if ("$ENV{QNX_HOST}" STREQUAL "")
#message(FATAL_ERROR "QNX_HOST environment variable not set")
endif()
if ("$ENV{QNX_TARGET}" STREQUAL "")
#message(FATAL_ERROR "QNX_TARGET environment variable not set")
endif()
set(CMAKE_C_COMPILER "/data/QNX/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc")
set(CMAKE_CXX_COMPILER "/data/QNX/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-g++")
#set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-linux-gnu-g++")
set(CMAKE_CXX_STANDARD 14) # C++14...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS ON) #...without compiler extensions like gnu++14
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
当我在没有sudo的情况下运行make
时,它仍然会报告一个错误——-
[ 10%] Linking CXX executable ../../bindings/julia/mlpack/build/bin/generate_jl_sparse_coding
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ddot_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgeqrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemm_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesdd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgels_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dnrm2_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlansy_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyevd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlange_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgecon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlangb_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyrk_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgelsd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ilaenv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyev_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dorgqr_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgtsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpocon_'
collect2: error: ld returned 1 exit status
src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/build.make:119: recipe for target 'src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding' failed
make[2]: *** [src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding] Error 1
CMakeFiles/Makefile2:6388: recipe for target 'src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all' failed
make[1]: *** [src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
有人知道我该怎么办吗?
您需要确保已将QNX构建工具链添加到您的环境中。QNX提供"qnxsdp-env.sh"shell脚本(或适用于Windows的QNX-sdp-env.bat(来设置工具链。这将设置所有适当的环境变量。在尝试使用任何其他构建命令(如cmake、make、qcc等(之前运行此脚本。
根据您的示例推断,您在Linux主机上使用QNX 7.0,请尝试:
$ source /data/QNX/qnxsdp-env.sh
$ cmake
注意,source
很重要:它指示shell运行脚本,这样它就可以修改当前的shell环境,而不是在子shell中启动它。如果在没有source
的情况下运行脚本,则该脚本将无效。
参考:http://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.prog/topic/devel_OS_version.html