无法在yocto中安装共享库

时间:2018-10-12 10:20:49

标签: linux shared-libraries embedded-linux yocto

我写了一个建立共享库的方法。这是食谱

SUMMARY = "test library"
SRC_URI = " file://file1.c \
            file://file2.c \
            file://internal.h" 

LICENSE = "CLOSED"
FILES_${PN} = "libtest.so"
do_compile() {
    ${CC} -fPIC -c ${WORKDIR}/file1.c -o ${WORKDIR}/file1.o
    ${CC} -fPIC -c ${WORKDIR}/file2.c -o ${WORKDIR}/file2.o
    ${CC} -shared -o ${WORKDIR}/libesys.so ${WORKDIR}/file1.o ${WORKDIR}/file2.o 
}

do_install() {
    install -d ${D}${libdir}
    install -m 0644 ${WORKDIR}/libtest.so ${D}${libdir}/
}

它失败并出现以下错误:

ERROR: test-0.1-r0 do_package_qa: QA Issue: -dev package contains non-symlink .so: test-dev path '/work/corei7-64-poky-linux/test/0.1-r0/packages-split/test-dev/usr/lib64/libtest.so' [dev-elf]
ERROR: test-0.1-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/home/jamal/repotest1/build/tmp/work/corei7-64-poky-linux/test/0.1-r0/packages-split/test-dev/usr/lib64/libtest.so' [ldflags]
ERROR: test-0.1-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: test-0.1-r0 do_package_qa: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/jamal/repotest1/build/tmp/work/corei7-64-poky-linux/test/0.1-r0/temp/log.do_package_qa.20989
ERROR: Task (/home/jamal/repotest1/sources/meta-test/recipes-support/test/test_0.1.bb:do_package_qa) failed with exit code '1'

能否请您帮助我找出问题的答案。感谢您的努力。

2 个答案:

答案 0 :(得分:1)

默认打包规则假定库已版本化,而您的库未版本化。

或者安装版本控制的库,或者如果您真的不想https://wiki.yoctoproject.org/wiki/TipsAndTricks/Packaging_Prebuilt_Libraries#Non-versioned_Libraries向您展示如何操作规则。

答案 1 :(得分:0)

LICENSE = "CLOSED"

SRC_URI = "file://greetings.c \
                   file://greetings.h \
                   "
S = "${WORKDIR}"
TARGET_CC_ARCH += "${LDFLAGS}"

#INHIBIT_PACKAGE_STRIP = "1"
#INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""

do_configure () {
                # Specify any needed configure commands here
                :
}

do_compile () {
        ${CC} -fPIC -c ${WORKDIR}/greetings.c -o ${WORKDIR}/greetings.o
        ${CC} -shared -o ${WORKDIR}/libtest.so ${WORKDIR}/greetings.o 
        #g++ -fPIC -shared -Wl,-soname,libtest.so.1 -o libtest.so.1.1.0
}


do_install () {
        install -d ${D}${libdir}
        install -d ${D}${includedir}
#oe_soinstall ${WORKDIR}/libtest.so ${D}${libdir}
        install -m 0644 ${WORKDIR}/libtest.so ${D}${libdir}
        install -m 0755 ${S}/*.h ${D}${includedir}
}