Yocto,如何在 Target 中添加 libmosquitto

Yocto, how to add libmosquitto in Target

Open Embedded Mosquitto recipe 将 mosquitto 安装为守护进程,但 Target 上没有 libmosquitto.so。

如何修改配方以安装库?

已经创建 mosquitto_%.bbappend 并尝试用类似的东西扩展 do_install 函数。

    do_install_append() {
        install -m 0755 ${FILES_libmosquitto1} ${D}${libdir}/
    }

编辑:

深入挖掘,发现 libmosquitto.so 在构建和图像目录中可用,就像 Layer shippes 一样。所以我一定是在创建 rootfs 时遗漏了一些东西。

bitbake mosquitto -c configure
bitbake mosquitto -c compile
bitbake mosquitto -c install

WORKDIR=./build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/mosquitto/1.6.12-r0

# lib is available in after do_compile
cd ${WORKDIR}/build/lib
tree
├── libmosquitto.so -> libmosquitto.so.1
├── libmosquitto.so.1 -> libmosquitto.so.1.6.12
└── libmosquitto.so.1.6.12

# lib is available after do_install, also headers and binary is available (in include, sbin respectively)
cd ${WORKDIR}/image/usr/lib
tree
├── libmosquitto.so -> libmosquitto.so.1
├── libmosquitto.so.1 -> libmosquitto.so.1.6.12
└── libmosquitto.so.1.6.12

要完成我的 rubberduck 调试,只需将正确的包添加到 IMAGE_INSTALL

  • mosquitto,安装服务器
  • libmosquitto1libmosquittopp1、安装库(libmosquitto 不起作用)
  • mosquitto-clients,安装 mosquitto_pub,_sub 命令

所以只需将想要的包添加到 IMAGE_INSTALL

IMAGE_INSTALL_append = " \
                    libmosquitto1 \
                    libmosquittopp1 \
"