在搜索 -ldeepsort 时跳过不兼容的 ../tracker/libdeepsort.so
Posted
技术标签:
【中文标题】在搜索 -ldeepsort 时跳过不兼容的 ../tracker/libdeepsort.so【英文标题】:skipping incompatible ../tracker/libdeepsort.so when searching for -ldeepsort 【发布时间】:2019-09-24 04:42:26 【问题描述】:我尝试使用 CMake 为 aarch64 设备创建共享库(.so 文件),但是,cmake 编译了 x86-64 类型的脚本。我需要的是 ARM aarch64 格式。如果有人知道请帮帮我?
我的 cmake 文件:
PROJECT(deepsort)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)
AUX_SOURCE_DIRECTORY(./errmsg DIR_SRCS_errmsg)
AUX_SOURCE_DIRECTORY(./thirdPart DIR_SRCS_hungarianoper)
AUX_SOURCE_DIRECTORY(./thirdPart/munkres DIR_SRCS_munkres)
AUX_SOURCE_DIRECTORY(./thirdPart/munkres/adapters DIR_SRCS_munkres_adapters)
AUX_SOURCE_DIRECTORY(./matching DIR_SRCS_matching)
AUX_SOURCE_DIRECTORY(./feature DIR_SRCS_feature)
AUX_SOURCE_DIRECTORY(./common DIR_SRCS_common)
AUX_SOURCE_DIRECTORY(./api DIR_SRCS_api)
include_directories(
./errmsg
./thirdPart
./thirdPart/Eigen
./thirdPart/munkres
./thirdPart/munkres/adapters
./matching
./feature
./common
./api
)
add_library(deepsort SHARED
$DIR_SRCS_errmsg
$DIR_SRCS_hungarianoper
$DIR_SRCS_munkres
$DIR_SRCS_munkres_adapters
$DIR_SRCS_feature
$DIR_SRCS_matching
$DIR_SRCS_api
)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -std=c++0x")
else()
message(STATUS "The compiler $CMAKE_CXX_COMPILER has no C++11 support. Please use a different C++ compiler.")
endif()
【问题讨论】:
【参考方案1】:我通过将 cxx 和 c 变量放在 Cmakelists.txt 文件中解决了这个问题:
set(tools /usr/bin)
set(CMAKE_C_COMPILER $tools/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER $tools/aarch64-linux-gnu-g++)
如果您想在不同的环境中编译,则必须下载链工具。
【讨论】:
以上是关于在搜索 -ldeepsort 时跳过不兼容的 ../tracker/libdeepsort.so的主要内容,如果未能解决你的问题,请参考以下文章