Проблема с рецептом Yocto с scons и ws281x на Raspberry Pi 3B + - PullRequest
0 голосов
/ 15 марта 2019

У меня проблема с созданием рецепта yocto (thud) для модуля python rpi_ws281x.Сама машина является raspberrypi3.

При создании рецепта я получаю следующую ошибку:

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.

Сам рецепт выглядит так:

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
}

Что ямне интересно, что scons создает некоторый двоичный код для linux-x86_64.Есть ли какая-либо возможность, что я могу рекомендовать scons использовать экспортированную среду Yocto?

Заранее спасибо,

homer836

Ответы [ 3 ]

0 голосов
/ 18 марта 2019

спасибо за ваш ответ.

На шаг дальше ... Но теперь я приветствую следующую ошибку:

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'

Есть ли возможность расширить std include путь scons?

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

Похоже, что компилятор не находит /recipe-sysroot/usr/include/stdint.h.

С уважением, homer836

0 голосов
/ 19 марта 2019

Теперь это работает.Я исправил SContruct, создал патч и использовал следующий рецепт.

SConstruct:

#
# 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');

Рецепт:

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/"
0 голосов
/ 15 марта 2019

Я пошел и посмотрел на репо, который вы пытаетесь построить.Похоже, эта SConstruct ожидает, что ей будет передана некоторая переменная TOOLCHAIN ​​:

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

Затем она использует для установки компилятора :

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

SCons по умолчанию пытается не зависеть от среды хоста.Среда SCons должна быть настроена в файлах SConstruct и SConscript.Этот конкретный SConstruct делает это, принимая в среде PATH хоста команду os.environ ['PATH'] и альтернативную опцию TOOLCHAIN ​​для установки имени компилятора и компоновщика для поиска в пути.Это означает, что SConstruct ожидает, что ваш кросс-компилятор будет в PATH.

Вы можете передать эту переменную в SCons из командной строки :

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