车载项目需要移植dbus到android系统中
sudo apt-get install libtool
./autogen.sh
./configure --prefix=build
make
make install
fatal error: 'Windows.h' file not found
解决:
apt-get install mingw-w64
No need to regenerate ninja file
Starting ninja...
FAILED: ninja: 'external/dbus-1.15.8/dbus/dbus-socket-set.c', needed by 'out/target/product/trinket/obj/SHARED_LIBRARIES/libdbus_intermediates/dbus-socket-set.o', missing and no known rule to make it
10:48:19 ninja failed with: exit status 1
最新的dbus 中dbus没有dbus-socket-set.c
No need to regenerate ninja file
Starting ninja...
FAILED: ninja: 'external/dbus-1.15.8/dbus/dbus-socket-set-poll.c', needed by 'out/target/product/trinket/obj/SHARED_LIBRARIES/libdbus_intermediates/dbus-socket-set-poll.o', missing and no known rule to make it
10:57:36 ninja failed with: exit status 1
最新的dbus 中dbus没有dbus-socket-set-poll.c
In file included from external/dbus-1.15.8/dbus/dbus-sha.c:27:
In file included from external/dbus-1.15.8/dbus/dbus-internals.h:33:
external/dbus-1.15.8/dbus/../dbus/dbus-types.h:33:10: fatal error: 'dbus/dbus-arch-deps.h' file not found
#include
^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
将dbus编译生成的.h文件copy到dbus
external/dbus-1.15.8/dbus/dbus-sysdeps-unix.c:78:10: fatal error: 'execinfo.h' file not found
#include
解决:
config.h 中注释掉宏控
/* Define to 1 if you have backtrace(). */
//#define HAVE_BACKTRACE 1
ysdeps-unix.o external/dbus-1.15.8/dbus/dbus-sysdeps-unix.c"
external/dbus-1.15.8/dbus/dbus-sysdeps-unix.c:3016:31: error: use of undeclared identifier 'SYS_pidfd_open'
int pid_fd = (int) syscall (SYS_pidfd_open, pid, 0);
^
config.h中注释掉宏控
/* Define to 1 if you have the declaration of `SYS_pidfd_open', and to 0 if
you don't. */
//#define HAVE_DECL_SYS_PIDFD_OPEN 1
external/dbus-1.15.8/dbus/dbus-internals.c:183:1: error: '_assertion' declared as an array with a negative size
_DBUS_STATIC_ASSERT (sizeof (void *) == DBUS_SIZEOF_VOID_P);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/dbus-1.15.8/dbus/../dbus/dbus-internals.h:485:36: note: expanded from macro '_DBUS_STATIC_ASSERT'
typedef struct { char _assertion[(expr) ? 1 : -1]; } \
^~~~~~~~~~~~~~~
1 error generated.
dbus-internals.h 修改
#define _DBUS_STATIC_ASSERT(expr) \
typedef struct { char _assertion[(expr) ? 1 :0]; } \
_DBUS_PASTE (_DBUS_STATIC_ASSERT_, __LINE__) _DBUS_GNUC_UNUSED
external/dbus-1.15.8/dbus/dbus-marshal-basic.c:1683:30: error: implicit conversion from 'long long' to 'dbus_int64_t' (aka 'long') changes value from 1254130450431 to -1 [-Werror,-Wconstant-conversion]
dbus_int64_t array8[3] = { DBUS_INT64_CONSTANT (0x123ffffffff),
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/dbus-1.15.8/dbus/../dbus/dbus-arch-deps.h:41:58: note: expanded from macro 'DBUS_INT64_CONSTANT'
#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##L))
^~~~~~
<scratch space>:106:1: note: expanded from here
0x123ffffffffL
^~~~~~~~~~~~~~
:: Android.mk 修改
LOCAL_CFLAGS += -Wno-constant-conversion
roid_arm64_armv8-a_kryo300_core/obj/bionic/libc/arch-common/bionic/crtend_so.o"
ld.lld: error: undefined symbol: _dbus_pollable_set_epoll_new
>>> referenced by dbus-pollable-set.c:37 (external/dbus-1.15.8/dbus/dbus-pollable-set.c:37)
>>> out/target/product/trinket/obj/SHARED_LIBRARIES/libdbus_intermediates/dbus-pollable-set.o:(_dbus_pollable_set_new)
ld.lld: error: undefined symbol: _dbus_pollable_set_poll_new
>>> referenced by dbus-pollable-set.c:43 (external/dbus-1.15.8/dbus/dbus-pollable-set.c:43)
>>> out/target/product/trinket/obj/SHARED_LIBRARIES/libdbus_intermediates/dbus-pollable-set.o:(_dbus_pollable_set_new)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Android.mk 修改:
添加dbus-pollable-set-epoll.c
external/dbus-1.15.8/bus/selinux.c:48:10: fatal error: 'selinux/selinux.h' file not found
#include
^~~~~~~~~~~~~~~~~~~
/* SELinux support */
#define HAVE_SELINUX 1
待续