Search code examples
linuxpackageyoctobitbakeopenblas

Bitbake do_package_qa error: Wrong location


I'm trying to build openblas-0.3.5 with Yocto (Rocko) for my 64-bit Armv8-A. I've found this recipe online and i tweaked it a bit. But i got the following error:

Error:

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

Below is my openblas.bb file:

#
#   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 <[email protected]>"
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"

Alternative way of removing errors: I replaced -

PREFIX=${D}/usr \ 

with

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

and

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

with

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

ISSUES:

1) After doing this, openblas was built without error. But, When i had to work with openblas, after board boot-up, I had to manually copy all the files from /opt/openblas to /usr/lib64/ and /usr/include/.

2) I couldn't find openblas in my sysroots-components folder in build/tmp/sysroots-components/aarch64/openblas .

3) Couldn't use openblas as dependency of any other recipe. since, it was installed in /opt and not in /usr. (no openblas in sysroots-components)

So, my question is, How do i solve these issues and install openblas in /usr/lib64 instead of /usr/lib or /opt ??


Solution

  • recipe for ARMV8

    DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
    SUMMARY = "OpenBLAS : An optimized BLAS library"
    AUTHOR = "Alexander Leiva <[email protected]>"
    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"