yoctoqemuopenblasyocto-recipe

openblas.bb:do_compile failed with exit code '1"


I am trying to build the openblas.bb in a yocto project but it fails.
machine is "qemux86-64"

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/"
LICENSE = "BSD-3-Clause"

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

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

PV = "0.3.16"

SRC_URI = "git://github.com/xianyi/OpenBLAS.git;protocol=https;branch=release-0.3.0"
SRCREV = "fab746240cc7e95569fde23af8942f8bc97d6d40"

S = "${WORKDIR}/git"

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 'CORTEXA9'
        elif re.match('aarch64$', a): return 'ARMV8'
        elif re.match('arm$', a): return 'ARMV7'
        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
        elif re.match('arm$', a): return 32
        return 32

def map_extra_options(a, d):
        import re
        if re.match('arm$', a): return '-mfpu=neon-vfpv4 -mfloat-abi=hard'
        return ''

do_compile () {
        oe_runmake HOSTCC="${BUILD_CC}"                                         \
                                CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${@map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
                CF="${TARGET_PREFIX}gfortran ${TOOLCHAIN_OPTIONS} ${@map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
                                PREFIX=${exec_prefix} \
                                CROSS_SUFFIX=${HOST_PREFIX} \
                                BINARY='${@map_bits(d.getVar('TARGET_ARCH'), d)}' \
                                TARGET='${@map_arch(d.getVar('TARGET_ARCH'), d)}'
}

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

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

and here some from the log.do_compile file:

**
| OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat1
| /bin/sh: 1: ./sblat1: not found
| Makefile:28: recipe for target 'level1' failed
| make[1]: *** [level1] Error 127
| make[1]: *** Waiting for unfinished jobs....
| make[1]: Leaving directory '/path/yocto_project/update-desktop-bsp/build/tmp/work/core2-64-poky-linux/openblas/0.3.16-r0/git/test'
| Makefile:145: recipe for target 'tests' failed
| make: *** [tests] Error 2
| WARNING: exit code 1 from a shell command.
ERROR: Task (/path/yocto_project/update-desktop-bsp/layers/meta-ammsc2/recipes-math/openblas/openblas.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 516 tasks of which 509 didn't need to be rerun and 1 failed.
**

Solution

  • I changed to use the newest version of the openblas:

    PV = "0.3.18"
    

    also I set the CROSS argument to 1 in do_compile :

    do_compile () {
            oe_runmake HOSTCC="${BUILD_CC}"                                         \
                                    CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${@map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
                    CF="${TARGET_PREFIX}gfortran ${TOOLCHAIN_OPTIONS} ${@map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
                                    PREFIX=${exec_prefix} \
                                    CROSS_SUFFIX=${HOST_PREFIX} \
                                    CROSS=1 \
                                    BINARY='${@map_bits(d.getVar('TARGET_ARCH'), d)}' \
                                    TARGET='${@map_arch(d.getVar('TARGET_ARCH'), d)}'
    }