在Raspberry Pi 3B +上使用scons和ws281x的Yocto配方问题

问题描述 投票:0回答:3

我在为rpi_ws281x python模块创建一个yocto(thud)配方时遇到了问题。机器本身是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创建了一些二进制代码。我是否有可能设法使用出口的Yocto环境?

提前致谢,

homer836

raspberry-pi3 yocto scons meta-raspberrypi
3个回答
0
投票

我去看了你想要建造的回购。这个SConstruct看起来像是期待一些TOOLCHAIN variable to be passed to it

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

然后它使用to set the compiler

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

默认情况下,SCons尝试不依赖于主机环境。必须在SConstruct和SConscript文件中设置SCons环境。这个特殊的SConstruct通过使用os.environ ['PATH']和备用TOOLCHAIN选项接受主机PATH环境来设置要在路径中查找的编译器和链接器的名称。这意味着SConstruct期望您的交叉编译器在PATH中。

你可以通过这个Variable to SCons from the command line

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

0
投票

现在它有效。我修复了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/"

-1
投票

谢谢您的回复。

更进一步......但现在我遇到了以下错误:

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'

有没有可能扩展sds的std包含路径?

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。

最好的问候,本垒打836

© www.soinside.com 2019 - 2024. All rights reserved.