1
votes

Problème de recette Yocto avec scons et ws281x sur Raspberry Pi 3B +

J'ai un problème lors de la création d'une recette yocto (thud) pour le module python rpi_ws281x. La machine elle-même est un raspberrypi3.

Lors de la construction de la recette, j'obtiens l'erreur suivante:

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9dcf340793a1d73c5211edc8238767dc"

SRC_URI = "git://github.com/jgarff/rpi_ws281x.git;protocol=https"
SRC_URI[md5sum] = "b903b8342864ae8422039d4a7479ba4c"

SRCREV = "ba3b5bdad55dc7754567a68c4364b1e772735f47"

#DEPENDS += "python-setuptools-native swig-native python-scons-native"
DEPENDS += "swig-native python-scons"
RDEPENDS_${PN} = "python"

S = "${WORKDIR}/git"

inherit scons setuptools 

do_compile_prepend() {
    cd ${S}/
    scons
    cd ${S}/python/
    ${PYTHON} setup.py install
}

La recette elle-même ressemble à ceci:

NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: python-rpi-ws281x-1.0-r0 do_compile: Function failed: do_compile (log file is located at /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.48175)
ERROR: Logfile of failure stored in: /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.48175
Log data follows:
| DEBUG: Executing shell function do_compile
| scons: Reading SConscript files ...
| scons: done reading SConscript files.
| scons: Building targets ...
| Version version.h
| CC      main.o
| CC      mailbox.o
| CC      ws2811.o
| CC      pwm.o
| CC      pcm.o
| CC      dma.o
| CC      rpihw.o
| AR      libws2811.a
| RANLIB  libws2811.a
| LINK    test
| scons: done building targets.
| running install
| running bdist_egg
| running egg_info
| creating rpi_ws281x.egg-info
| writing rpi_ws281x.egg-info/PKG-INFO
| writing top-level names to rpi_ws281x.egg-info/top_level.txt
| writing dependency_links to rpi_ws281x.egg-info/dependency_links.txt
| writing manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
| reading manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
| writing manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
| installing library code to build/bdist.linux-x86_64/egg
| running install_lib
| running build_py
| creating build
| creating build/lib.linux-x86_64-2.7
| copying neopixel.py -> build/lib.linux-x86_64-2.7
| running build_ext
| building '_rpi_ws281x' extension
| swigging rpi_ws281x.i to rpi_ws281x_wrap.c
| swig -python -o rpi_ws281x_wrap.c rpi_ws281x.i
| creating build/temp.linux-x86_64-2.7
| arm-ab-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0=/usr/src/debug/python-rpi-ws281x/1.0-r0 -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot-native= -fPIC -I/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot/usr/include/python2.7 -c rpi_ws281x_wrap.c -o build/temp.linux-x86_64-2.7/rpi_ws281x_wrap.o
| arm-ab-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot -shared -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0=/usr/src/debug/python-rpi-ws281x/1.0-r0 -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot-native= build/temp.linux-x86_64-2.7/rpi_ws281x_wrap.o -L../. -lws2811 -lrt -o build/lib.linux-x86_64-2.7/_rpi_ws281x.so
| /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot-native/usr/bin/arm-ab-linux-gnueabi/../../libexec/arm-ab-linux-gnueabi/gcc/arm-ab-linux-gnueabi/8.2.0/ld: .././libws2811.a: error adding symbols: file format not recognized
| collect2: error: ld returned 1 exit status
| error: command 'arm-ab-linux-gnueabi-gcc' failed with exit status 1
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.48175)
ERROR: Task (/home/user/git/poky-ab/meta-3rdparty/recipes-ws281x/python-rpi-ws281x.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1125 tasks of which 1118 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory

Summary: 1 task failed:
  /home/user/git/poky-ab/meta-3rdparty/recipes-ws281x/python-rpi-ws281x.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Ce que je me demande, c'est que scons crée du code binaire pour linux-x86_64. Est-il possible que je puisse convaincre scons d'utiliser l'environnement exporté de Yocto?

Merci d'avance,

homer836


2 commentaires

êtes-vous sûr que libws2811.a est pour la bonne arche?


Le ws2811 est juste le contrôleur de la puce de la bande led


3 Réponses :


0
votes

Je suis allé voir le dépôt que vous essayez de créer. Ce SConstruct semble s'attendre à ce qu'une variable TOOLCHAIN ​​lui soit transmise a>:

do_compile_prepend() {
    cd ${S}/
    scons TOOLCHAIN=arm-ab-linux-gnueabi
    cd ${S}/python/
    ${PYTHON} setup.py install
}

Ensuite, il l'utilisera plus tard pour définir le compilateur :

if env['TOOLCHAIN'] != '':
    env['CC'] = env['TOOLCHAIN'] + '-gcc'
    env['AR'] = env['TOOLCHAIN'] + '-ar'

SCons par défaut essaie de ne pas dépendre de l'environnement hôte. L'environnement SCons doit être configuré dans les fichiers SConstruct et SConscript. Ce SConstruct particulier fait cela en prenant dans l'environnement hôte PATH avec os.environ ['PATH'] et une autre option TOOLCHAIN ​​pour configurer le nom du compilateur et de l'éditeur de liens à trouver dans le chemin. Cela signifie que SConstruct s'attend à ce que votre compilateur croisé soit dans le PATH.

Vous pouvez transmettre ceci Variable de SCons à partir de la ligne de commande :

opts.Add('TOOLCHAIN',  
         'Set toolchain for cross compilation (e.g. arm-linux-gnueabihf)',  
         '')


0 commentaires

-1
votes

Merci pour votre réponse.

Un pas de plus ... Mais maintenant je rencontre l'erreur suivante:

user@smartbakery:~/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0$ find -name *.h|grep stdint
./recipe-sysroot-native/usr/lib/arm-ab-linux-gnueabi/gcc/arm-ab-linux-gnueabi/8.2.0/include/stdint-gcc.h
./recipe-sysroot-native/usr/lib/arm-ab-linux-gnueabi/gcc/arm-ab-linux-gnueabi/8.2.0/include/stdint.h
./recipe-sysroot-native/usr/lib/arm-ab-linux-gnueabi/gcc/arm-ab-linux-gnueabi/8.2.0/plugin/include/config/glibc-stdint.h
./recipe-sysroot/usr/include/c++/8.2.0/tr1/stdint.h
./recipe-sysroot/usr/include/stdint.h
./recipe-sysroot/usr/include/bits/stdint-uintn.h
./recipe-sysroot/usr/include/bits/stdint-intn.h

Est-il possible d'étendre le chemin d'inclusion std de scons?

ERROR: python-rpi-ws281x-1.0-r0 do_compile: Function failed: do_compile (log file is located at /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.3988)
ERROR: Logfile of failure stored in: /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.3988
Log data follows:
| DEBUG: Executing shell function do_compile
| scons: Reading SConscript files ...
| scons: done reading SConscript files.
| scons: Building targets ...
| CC      main.o
| In file included from main.c:33:
| /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/recipe-sysroot-native/usr/lib/arm-ab-linux-gnueabi/gcc/arm-ab-linux-gnueabi/8.2.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
|  # include_next <stdint.h>
|                 ^~~~~~~~~~
| compilation terminated.
| scons: *** [main.o] Error 1
| scons: building terminated because of errors.
| WARNING: exit code 2 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/user/git/poky-ab/build/tmp/work/cortexa7t2hf-neon-vfpv4-ab-linux-gnueabi/python-rpi-ws281x/1.0-r0/temp/log.do_compile.3988)
ERROR: Task (/home/user/git/poky-ab/meta-3rdparty/recipes-ws281x/python-rpi-ws281x.bb:do_compile) failed with exit code '1'

Il semble que le compilateur ne trouve pas /recipe-sysroot/usr/include/stdint.h.

Cordialement, homer836


2 commentaires

Poser une nouvelle question dans une réponse que vous donnez est quelque peu contre-productif. La plupart des gens verront que la question (originale) a déjà reçu une réponse et ne prendront pas la peine d'enquêter plus avant. Vous souhaitez probablement ouvrir une nouvelle question distincte explicitement ...


Le SConsctuct en question ne fournit pas un moyen de le faire. Je m'attendrais à ce qu'une sorte d'option sysroot ou similaire soit transmise sur la ligne de commande si ce SConstruct était destiné à être utilisé dans la compilation croisée. En regardant le fichier Readme de ce dépôt, il semble que cela était destiné à être construit sur la cible.



1
votes

Maintenant ça marche. J'ai corrigé le SContruct, créé un patch et utilisé la recette suivante.

SConstruct:

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9dcf340793a1d73c5211edc8238767dc"

SRC_URI = "git://github.com/jgarff/rpi_ws281x.git;protocol=https \
           file://0001-Patch-for-Yocto.patch"

SRC_URI[md5sum] = "b903b8342864ae8422039d4a7479ba4c"

SRCREV = "ba3b5bdad55dc7754567a68c4364b1e772735f47"

DEPENDS += "swig-native python-scons"
RDEPENDS_${PN} = "python"

S = "${WORKDIR}/git"

inherit scons setuptools 

EXTRA_OESCONS += " CONFIG_ENVIRONMENT_IMPORT=True -mfl"

do_compile_prepend() {

export

    cd ${S}/
    scons
    cd ${S}/python/
    ${PYTHON} setup.py build
    ${PYTHON} setup.py install
}

do_install() {
    install -d ${D}${libdir}/python2.7
    cp ${S}/python/build/lib.linux-x86_64-2.7/* ${D}${libdir}/python2.7/
}

FILES_${PN} += "${libdir}/python2.7/"

Recette:

#
# SConstruct
#
# Copyright (c) 2014 Jeremy Garff <jer @ jers.net>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
#     1.  Redistributions of source code must retain the above copyright notice, this list of
#         conditions and the following disclaimer.
#     2.  Redistributions in binary form must reproduce the above copyright notice, this list
#         of conditions and the following disclaimer in the documentation and/or other materials
#         provided with the distribution.
#     3.  Neither the name of the owner nor the names of its contributors may be used to endorse
#         or promote products derived from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#


import os


opts = Variables()
opts.Add(BoolVariable('V',
                      'Verbose build',
                      True))

opts.Add('TOOLCHAIN',
         'Set toolchain for cross compilation (e.g. arm-linux-gnueabihf)',
         '')

platforms = [ 
    [
        'userspace',            # Target Name
        [ 'linux', 'version' ], # Scons tool (linux, avr, etc.)
        {                       # Special environment setup
            'LINKFLAGS' : [
                "-lrt",
            ],
        },
    ], 
]

cc_environment = os.environ['CC']
split_cc_environment_variable = cc_environment.split()
cc_bin = split_cc_environment_variable[0]
cc_parameters = split_cc_environment_variable[1:]

ld_env = os.environ['LD']
split_ld_env_variable = ld_env.split()
ld_bin = split_ld_env_variable[0]
ld_params = split_ld_env_variable[1:]

clean_envs = {}
for platform, tool, flags in platforms:
    env = Environment(
           options = opts,
           tools = tool,
           toolpath = ['.'],
           ENV = {'PATH' : os.environ['PATH']},
       CC = cc_bin,
           LD = ld_bin,
           AR = os.environ['AR'],
           RANLIB = os.environ['RANLIB'],
           CCFLAGS = cc_parameters,
           LINKFLAGS = ld_params,
        LIBS = [],
    )

    env.MergeFlags(flags)
    clean_envs[platform] = env

Help(opts.GenerateHelpText(clean_envs))


Export(['clean_envs'])
SConscript('SConscript');

p>


0 commentaires