海思3518ev300平台交叉编译bluez-5.50

 我把所有要下载的库(需要手动下载),做成了一键编译安装脚本:https://download.csdn.net/download/laoyouji/11644690

一、编译glib-2.40.0依赖以下库:

zlib-1.2.11(https://www.zlib.net/zlib-1.2.11.tar.gz)
expat-2.2.7(https://codeload.github.com/libexpat/libexpat/tar.gz/R_2_2_7)
libffi-3.2.1(ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz)
gettext-0.20(http://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.tar.xz)
pcre-8.38(如果使用glib-2.50.0版本则还依赖此库,2.40.0不需要)

 

编译glib-2.40.0(http://gensho.ftp.acc.umu.se/pub/gnome/sources/glib/2.40/glib-2.40.0.tar.xz)时,只有一个报错:

gdate.c: In function 'g_date_strftime':
gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]
       tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
       ^~~~~~

参考以下链接解决:https://blog.csdn.net/princeofdream/article/details/74733973
 

diff --git a/glib/gdate.c b/glib/gdate.c
index 0dfd801..44ba06d 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -2494,7 +2494,10 @@ g_date_strftime (gchar       *s,
        * recognize whether strftime actually failed or just returned "".
        */
       tmpbuf[0] = '\1';
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
       tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
+#pragma GCC diagnostic pop
       if (tmplen == 0 && tmpbuf[0] != '\0')
         {
           g_free (tmpbuf);

二、交叉编译dbus-1.10(https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-1.10/dbus-dbus-1.10.tar.bz2):

cd dbus-dbus-1.10
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure \
        --prefix=${PREFIX_DIR} \
        --host=arm-himix100-linux \
        CC=arm-himix100-linux-gcc \
        --with-x=no \
        --disable-tests \
        --enable-abstract-sockets \
        CFLAGS=-I${PREFIX_DIR}/include \
        LDFLAGS=-L${PREFIX_DIR}/lib

make -j4
make install

三、交叉编译 bluez-5.50(https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz):
1、依赖以下库:ncurses-6.1(https://invisible-island.net/datafiles/release/ncurses.tar.gz)、readline-7.0(ftp://ftp.cwru.edu/pub/bash/readline-7.0.tar.gz)、libical-1.0.0(https://codeload.github.com/libical/libical/tar.gz/v1.0.0);
2、开始编译:

tools/test-runner.c:129:51: error: 'MS_STRICTATIME' undeclared here (not in a function)
  { "devtmpfs", "/dev",     "mode=0755", MS_NOSUID|MS_STRICTATIME },
                                                   ^~~~~~~~~~~~~~
tools/test-runner.c: In function 'prepare_sandbox':


编译 tools/test-runner.c 时会提示找不到 MS_STRICTATIME 的定义,直接修改源文件 ./tools/test-runner.c,在文件开头的地方添加:

#ifndef MS_STRICTATIME
#define MS_STRICTATIME (1 << 24)
#endif

参考链接:https://blog.csdn.net/JiYeon67/article/details/79042742
                  https://blog.csdn.net/wang_shuai_ww/article/details/41774477
                  https://www.cnblogs.com/dong1/p/8271385.html

四、工具使用测试:
1、运行dbus:

./dbus-daemon --config-file=/etc/dbus-1/system.conf --print-address

运行dbus前需要做一些工作:
 

mkdir -p /tmp/dbus/var/run/dbus/
vi/etc/passwd,在最后添加messagebus:x:500:500::/tmp/dbus:/bin/sh (或者configure --with-dbus-user=root,使用此选项则不需添加messagebux这个新用户)
编译完dbus后,在安装目录有system.conf,我把这个配置文件放到了/etc/dbus-1/system.conf,这个文件里的编译路径全部换成/tmp/dbus,之前我设置的编译路径太长会报错;

2、运行bluez:

 

你可能感兴趣的:(hisi)