Bitbake do_package_qa error: Wrong location

Bitbake do_package_qa error: Wrong location

我正在尝试使用 Yocto (Rocko) 为我的 64 位 Armv8-A 构建 openblas-0.3.5。我在网上找到了这个食谱,并稍微调整了一下。但是我收到以下错误:

错误:

ERROR: openblas-0.3.5-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package contains symlink .so: openblas path '/work/aarch64-poky-linux/openblas/0.3.5-r0/packages-split/openblas/usr/lib/libopenblas.so' [dev-so]
WARNING: openblas-0.3.5-r0 do_package_qa: QA Issue: openblas: found library in wrong location: /usr/lib/libopenblas.so.0
openblas: found library in wrong location: /usr/lib/libopenblas_armv8-r0.3.5.so
openblas: found library in wrong location: /usr/lib/libopenblas.so [libdir]
ERROR: openblas-0.3.5-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: openblas-0.3.5-r0 do_package_qa: Function failed: do_package_qa

下面是我的 openblas.bb 文件:

#
#   Copyright (c) 2016 Intel Corporation. All rights reserved.
#   Copyright (c) 2019 Luxoft Sweden AB
#
#   SPDX-License-Identifier: MIT
#

DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
SUMMARY = "OpenBLAS : An optimized BLAS library"
AUTHOR = "Alexander Leiva <norxander@gmail.com>"
HOMEPAGE = "http://www.openblas.net/"
SECTION = "libs"
LICENSE = "BSD-3-Clause"

DEPENDS = "make"

LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0"

SRC_URI = "https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "579bda57f68ea6e9074bf5780e8620bb"
SRC_URI[sha256sum] = "0950c14bd77c90a6427e26210d6dab422271bc86f9fc69126725833ecdaa0e85"

S = "${WORKDIR}/OpenBLAS-${PV}"

do_compile () {
        oe_runmake HOSTCC="${BUILD_CC}" \
        CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
        CROSS_SUFFIX=${HOST_PREFIX} \
        ONLY_CBLAS=1 USE_THREAD=0 \
        HOSTCC="${BUILD_CC}" \
        TARGET=ARMV8 BINARY=64
}

do_install() {
        oe_runmake HOSTCC="${BUILD_CC}" \
        CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
        CROSS_SUFFIX=${HOST_PREFIX} \
        ONLY_CBLAS=1 USE_THREAD=0 \
        HOSTCC="${BUILD_CC}" \
        TARGET=ARMV8 BINARY=64 \
        PREFIX=${D}/usr \
        install     

        rm -rf ${D}${bindir}
        rm -rf ${D}${libdir}/cmake
} 

FILES_${PN} += "${libdir}/*"
FILES_${PN} += "/usr/lib/*"
#FILES_${PN}-dev = "${libdir}/* ${includedir}"

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"

INSANE_SKIP_${PN} += "staticdev"

消除错误的替代方法: 我替换了 -

PREFIX=${D}/usr \ 

PREFIX="${D}/opt/${PN}" \

FILES_${PN} += "${libdir}/*"
FILES_${PN} += "/usr/lib/*"
#FILES_${PN}-dev = "${libdir}/* ${includedir}" 

FILES_${PN}     += "/opt/${PN}"
FILES_${PN}-dev += "/opt/${PN}/lib/lib${PN}.so"
#FILES_${PN}-dbg += "/opt/${PN}/lib/.debug"

问题:

1) 这样做之后,openblas 构建成功,没有报错。但是,当我不得不使用 openblas 时,在电路板启动后,我不得不手动将所有文件从 /opt/openblas 复制到 /usr/lib64/ 和 /usr/include/.

2) 我在 build/tmp/sysroots-components/aarch64/openblas 的 sysroots-components 文件夹中找不到 openblas。

3) 无法将 openblas 用作任何其他配方的依赖项。因为,它安装在 /opt 而不是 /usr 中。 (sysroots-components 中没有 openblas)

所以,我的问题是,如何解决这些问题并在 /usr/lib64 而不是 /usr/lib/opt??

do_install 需要传递正确的 ${libdir},因为 Makefile 假定 $PREFIX/lib 是正确的,而对于您的平台来说它不是。

沿着PREFIX也经过OPENBLAS_LIBRARY_DIR=${libdir}

我使用这个库,我使用这个食谱:

DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
SUMMARY = "OpenBLAS : An optimized BLAS library"
AUTHOR = "Alexander Leiva <norxander@gmail.com>"
HOMEPAGE = "http://www.openblas.net/"
SECTION = "libs"
LICENSE = "BSD-3-Clause"

RDEPENDS_${PN} += "libgfortran"
DEPENDS += " make libgfortran"

LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0"

SRC_URI = "https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "48637eb29f5b492b91459175dcc574b1"
SRC_URI[sha256sum] = "5ef38b15d9c652985774869efd548b8e3e972e1e99475c673b25537ed7bcf394"

S = "${WORKDIR}/OpenBLAS-${PV}"

FLOATABI = "${@bb.utils.contains("TUNE_FEATURES", "vfp", bb.utils.contains("TUNE_FEATURES", "callconvention-hard", " -mfloat-abi=hard", " -mfloat-abi=softfp", d), "" ,d)}"


def map_arch(a, d):
  import re
  if re.match('i.86$', a): return 'ATOM'
  elif re.match('x86_64$', a): return 'ATOM'
  elif re.match('aarch32$', a): return 'ARMV7'
  elif re.match('aarch64$', a): return 'ARMV8'
  return a

def map_bits(a, d):
  import re
  if re.match('i.86$', a): return 32
  elif re.match('x86_64$', a): return 64
  elif re.match('aarch32$', a): return 32
  elif re.match('aarch64$', a): return 64
  return 32

do_compile () {
  oe_runmake HOSTCC="${BUILD_CC} " \
                     CC="${TARGET_PREFIX}gcc ${FLOATABI} ${TOOLCHAIN_OPTIONS}" \
                     PREFIX=${exec_prefix} \
                     CROSS_SUFFIX=${HOST_PREFIX} \
                     ONLY_CBLAS=1 BINARY='${@map_bits(d.getVar('TARGET_ARCH', True), d)}' \
                     TARGET='ARMV7'
}

do_install() {
  oe_runmake HOSTCC="${BUILD_CC}" \
                     CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
                     PREFIX=${exec_prefix} \
                     CROSS_SUFFIX=${HOST_PREFIX} \
                     ONLY_CBLAS=1 BINARY='${@map_bits(d.getVar('TARGET_ARCH', True), d)}' \
                     TARGET='${@map_arch(d.getVar('TARGET_ARCH', True), d)}' \
                     DESTDIR=${D} \
                     install

  rm -rf ${D}${bindir}
  rm -rf ${D}${libdir}/cmake
}

FILES_${PN}     = "${libdir}/*"
FILES_${PN}-dev = "${includedir} ${libdir}/lib${PN}.so"

ARMV8 的配方

DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
SUMMARY = "OpenBLAS : An optimized BLAS library"
AUTHOR = "Alexander Leiva <norxander@gmail.com>"
HOMEPAGE = "http://www.openblas.net/"
SECTION = "libs"
LICENSE = "BSD-3-Clause"

RDEPENDS_${PN} += "libgfortran"
DEPENDS += " make libgfortran"

LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0"

SRC_URI = "https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "48637eb29f5b492b91459175dcc574b1"
SRC_URI[sha256sum] = "5ef38b15d9c652985774869efd548b8e3e972e1e99475c673b25537ed7bcf394"

S = "${WORKDIR}/OpenBLAS-${PV}"

FLOATABI = "${@bb.utils.contains("TUNE_FEATURES", "vfp", bb.utils.contains("TUNE_FEATURES", "callconvention-hard", " -mfloat-abi=hard", " -mfloat-abi=softfp", d), "" ,d)}"


def map_arch(a, d):
  import re
  if re.match('i.86$', a): return 'ATOM'
  elif re.match('x86_64$', a): return 'ATOM'
  elif re.match('aarch32$', a): return 'ARMV7'
  elif re.match('aarch64$', a): return 'ARMV8'
  return a

def map_bits(a, d):
  import re
  if re.match('i.86$', a): return 32
  elif re.match('x86_64$', a): return 64
  elif re.match('aarch32$', a): return 32
  elif re.match('aarch64$', a): return 64
  return 64

do_compile () {
  oe_runmake HOSTCC="${BUILD_CC} " \
                     CC="${TARGET_PREFIX}gcc ${FLOATABI} ${TOOLCHAIN_OPTIONS}" \
                     PREFIX=${exec_prefix} \
                     CROSS_SUFFIX=${HOST_PREFIX} \
                     ONLY_CBLAS=1 BINARY='${@map_bits(d.getVar('TARGET_ARCH', True), d)}' \
                     TARGET='ARMV8'
}

do_install() {
  install -d ${D}${libdir}
  install -d ${D}${libdir}/cmake
  install -d ${D}${libdir}/pkgconfig
  oe_runmake HOSTCC="${BUILD_CC}" \
                     CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
                     PREFIX=${exec_prefix} \
                     CROSS_SUFFIX=${HOST_PREFIX} \
                     ONLY_CBLAS=1 BINARY='${@map_bits(d.getVar('TARGET_ARCH', True), d)}' \
                     TARGET='${@map_arch(d.getVar('TARGET_ARCH', True), d)}' \
                     DESTDIR=${D} \
                     install

  cp -r ${D}/usr/lib/* ${D}/usr/lib64/
  rm -rf ${D}/usr/lib
  rm -rf ${D}/usr/bin
}

RDEPENDS_${PN}-dev = ""
RDEPENDS_${PN}-staticdev = ""

FILES_${PN}-libs = "${libdir}/*"

FILES_${PN}     += "/usr/lib64"
FILES_${PN}-dev = "${includedir} ${libdir}/lib${PN}.so"

INSANE_SKIP_${PN} += "staticdev"