构建 Petalinux 项目时出现语言环境错误

构建 Petalinux 项目时出现语言环境错误

我正在尝试构建 petalinux 项目,但遇到了这个错误

    shaden@shaden-Swift:~/Documents/PetalinuxProjects/1/xilinx-zcu102-2018.2$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    You system needs to support the en_US.UTF-8 locale.

Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build project

区域设置输出

shaden@shaden-Swift:~/Documents/PetalinuxProjects/1/xilinx-zcu102-2018.2$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

我尝试过(导出 LANGUAGE="en_US.UTF-8")但没有解决错误。

我的操作系统是 Ubuntu 18.04.6 LTS

Petalinux 版本 2018.2

有人知道如何解决吗?

谢谢

答案1

该问题是由于 Ubuntu 18.04 LTS(可能是一些更新的库)与 Yocto / PetaLinux 中包含的 Python 3.5 不兼容引起的。

解决方法是编辑“.../usr/lib/python3.5/locale.py”文件并使 setlocale() 函数悄悄失败:

def setlocale(category, locale=None):
 
    """ Set the locale for the given category.  The locale can be
        a string, an iterable of two strings (language code and encoding),
        or None.
 
        Iterables are converted to strings using the locale aliasing
        engine.  Locale strings are passed directly to the C lib.
 
        category may be given as one of the LC_* values.
 
    """
    if locale and not isinstance(locale, _builtin_str):
        # convert to string
        locale = normalize(_build_localename(locale))
    try:
        return _setlocale(category, locale)
    except:
        pass

https://support.xilinx.com/s/question/0D52E00006hpjH7/petalinux-build-fails-with-locale-errors-how-to-disable-locale-checks?language=en_US

相关内容