dbus / dbus.h建立到arm时没有这样的文件或目录

时间:2014-08-01 09:22:30

标签: c++ c cross-compiling dbus

我正在尝试交叉编译我的项目,以便在树莓派上使用它,但它找不到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>

                   ^

汇编终结。

1 个答案:

答案 0 :(得分:1)

据我所知,你有错误的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)