Score:0

Locale error when building Petalinux project

np flag

I am trying to build petalinux project but I faced this error

    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

locale output

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

I tried (export LANGUAGE="en_US.UTF-8") but not solve the error.

my OS is Ubuntu 18.04.6 LTS

Petalinux version 2018.2

Any one know how to solve it?

Thanks

David avatar
cn flag
Yes you are running this on a Ubuntu machine but I do not see anything Ubuntu related in this question.
ChanganAuto avatar
us flag
@David It's a set of tools for Linux products development. It's no different than any other software running in Ubuntu and on-topic.
Gunnar Hjalmarsson avatar
uz flag
I would stop setting `LC_ALL`. That variable does not need to be set persistently. Ever. `LANG` is sufficient.,
Shaden avatar
np flag
@GunnarHjalmarsson thank you for your answer I do it but still the same error I did it by ( export LC_ALL="")
Score:0
np flag

The problem is caused by an incompatibility between Ubuntu 18.04 LTS (probably some updated library) and the Python 3.5 included in Yocto / PetaLinux.

The workaround is to edit the ".../usr/lib/python3.5/locale.py" file(s) and make the setlocale() function fail quietly:

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.