gpt4 book ai didi

c++ - dbus/dbus.h 在构建到 arm 时没有这样的文件或目录

转载 作者:行者123 更新时间:2023-11-28 06:45:32 47 4
gpt4 key购买 nike

我正在尝试交叉编译我的项目以在 raspberry pi 上使用它,但它找不到 dbus。当我进行经典编译时,这很容易找到。我正在使用 cmake 我已经将 dbus-1 添加到目标链接库并且我正在使用 arm-linux-gnueabihf 进行交叉编译。

有什么想法吗?

编辑:添加我的 CMakeLists.txt :

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

FIND_PACKAGE(glib2) # bluetooth
include_directories(${GLIB2_INCLUDE_DIRS}) # bluetooth

include_directories(${CMAKE_SOURCE_DIR}/../bluez/gdbus)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/attrib)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/src)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/src/shared)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/btio)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/lib)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/client)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/emulator)
include_directories(${CMAKE_SOURCE_DIR}/../bluez/monitor)
include_directories(${CMAKE_SOURCE_DIR}/../bluez)
include_directories(/usr/include/dbus)
set( CMAKE_CXX_FLAGS "-fpermissive" )
# Search every source files
aux_source_directory(. SRC_LIST)

include_directories (/usr)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/gdbus SRC_BLUEZ_GDBUS)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/client SRC_BLUEZ_CLIENT)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/btio SRC_BLUEZ_BTIO_LIST)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/attrib SRC_BLUEZ_ATTRIB_LIST)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/emulator SRC_BLUEZ_EMULATOR)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/lib SRC_BLUEZ_LIB)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/monitor SRC_BLUEZ_MONITOR)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/src SRC_BLUEZ_SRC)
aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/src/shared SRC_BLUEZ_SRC_SHARED)


add_executable(${PROJECT_NAME} ${SRC_LIST})

# Library used in test
add_library(${PROJECT_NAME}-lib
Thread.cpp
NetworkThread.cpp
UdpSocket.cpp)
add_library(MyBluezLib-lib
${SRC_BLUEZ_SRC} ${SRC_BLUEZ_LIB}
${SRC_BLUEZ_GDBUS} ${SRC_BLUEZ_CLIENT} ${SRC_BLUEZ_BTIO_LIST} ${SRC_BLUEZ_ATTRIB_LIST} ${SRC_BLUEZ_EMULATOR}
${SRC_BLUEZ_SRC_SHARED} ${SRC_BLUEZ_MONITOR})

# Link libraries
TARGET_LINK_LIBRARIES (${PROJECT_NAME}
pthread
glog
bluetooth
${GLIB2_LIBRARIES} #bluetooth
readline
expat
dbus-1
dl
MyBluezLib-lib
)

这是我的电话和他的回答:

Scanning dependencies of target MyBluezLib-lib
[ 1%] Building C object src/CMakeFiles/MyBluezLib-lib.dir/home/grosalex/job/stageING3/bluez/src/rfkill.c.obj
In file included from /home/grosalex/job/stageING3/bluez/src/rfkill.c:39:0:
/home/grosalex/job/stageING3/bluez/src/adapter.h:29:23: erreur fatale: dbus/dbus.h: Aucun fichier ou dossier de ce type
#include <dbus/dbus.h>

^

编译终止。

最佳答案

据我所知,您的 dbus 包含目录有误。你有 include_directories(/usr/include/dbus) 并且在我的主机 Linux 中我有以下包含标志,如果我发出 pkg-config --cflags dbus-glib-1 :

-pthread -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include

尝试配置这包括:

include_directories(/usr/include/dbus-1.0)

关于c++ - dbus/dbus.h 在构建到 arm 时没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25076945/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com