cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bluetiger9
Adventurer
Adventurer
9,247 Views
Registered: ‎09-02-2018

PetaLinux build fails with locale errors. How to disable locale checks?

Jump to solution

 

Hi,

 

I'm unable to build PetaLinux, because of some (probably harmless) locale errors in the petalinux-user-image log:

 

bluetiger@Attila-Laptop:xilinx-ultra96-reva-2018.2$ source /media/bluetiger/Data/Xilinx/PetaLinux/settings.sh
PetaLinux environment set to '/media/bluetiger/Data/Xilinx/PetaLinux'
WARNING: /bin/sh is not bash! 
bash is PetaLinux recommended shell. Please set your default shell to bash.
INFO: Checking free disk space
INFO: Checking installed tools
environment: line 281: ((: 10#15~1 > 10#3: syntax error in expression (error token is "~1 > 10#3")
environment: line 285: ((: 10#15~1 < 10#3: syntax error in expression (error token is "~1 < 10#3")
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution
bluetiger@Attila-Laptop:xilinx-ultra96-reva-2018.2$ echo $PETALINUX
/media/bluetiger/Data/Xilinx/PetaLinux
bluetiger@Attila-Laptop:xilinx-ultra96-reva-2018.2$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
WARNING: Host distribution "ubuntu-18.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |##################################################################################################################| Time: 0:00:00
Loaded 3437 entries from dependency cache.
Parsing recipes: 100% |################################################################################################################| Time: 0:00:05
Parsing of 2552 .bb files complete (2513 cached, 39 parsed). 3441 targets, 135 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#############################################################################################################| Time: 0:00:40
Checking sstate mirror object availability: 100% |#####################################################################################| Time: 0:00:22
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: petalinux-user-image-1.0-r0 do_rootfs: [log_check] petalinux-user-image: found 1 warning message in the logfile:
[log_check] warning: %post(sysvinit-inittab-2.88dsf-r10.ultra96_zynqmp) scriptlet failed, exit status 1

ERROR: petalinux-user-image-1.0-r0 do_rootfs: [log_check] petalinux-user-image: found 4 error messages in the logfile:
[log_check] Failed to set locale, defaulting to C
[log_check] Failed to set locale, defaulting to C
[log_check] Failed to set locale, defaulting to C
[log_check] Failed to set locale, defaulting to C

ERROR: petalinux-user-image-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /media/bluetiger/Data/PetaLinux-Ultra96/xilinx-ultra96-reva-2018.2/build/tmp/work/ultra96_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/temp/log.do_rootfs.5592
ERROR: Task (/media/bluetiger/Data/PetaLinux-Ultra96/xilinx-ultra96-reva-2018.2/project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 10052 tasks of which 10051 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /media/bluetiger/Data/PetaLinux-Ultra96/xilinx-ultra96-reva-2018.2/project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb:do_rootfs
Summary: There were 2 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: Failed to build project

 

The locales seems to be just fine:

 

bluetiger@Attila-Laptop:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
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 all the possible solutions I found on the net, but nothing help.

Yesterday, I had a similar problem with bitbake's sanity checks, but I solved this by commenting out some code in sanity_check_locale() from sanity.bbclass.

 

Does anyone know what causes the problem?

Does anyone know how to fix / bypass this problem?

 

Can I edit the source of petalinux-user-image do disable the check?

 

Can I disable log_check for petalinux-user-image?

 

I would really appreciate any help on this. This error starts getting really frustrating...


Note: I'm experiencing this on Ubuntu 18.04 LTS.

Thanks,

Attila

 

1 Solution

Accepted Solutions
bluetiger9
Adventurer
Adventurer
9,142 Views
Registered: ‎09-02-2018

I found a (pretty ugly) workaround for the problem today...

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

The files appears in multiple locations. I edited all of them, but probably no all are needed:

  • PetaLinux install directory:
    ./components/yocto/source/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/locale.py
    ./components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/locale.py
  • build directory
    ./build/tmp/sysroots-components/x86_64/python3-native/usr/lib/python3.5/locale.py
    ./build/tmp/sysroots-components/aarch64/python3/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/pmu-firmware/2018.2+gitAUTOINC+6e82c0183b-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/linux-xlnx/4.14-xilinx-v2018.2+gitAUTOINC+ad4cd988ba-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/fsbl/2018.2+gitAUTOINC+6e82c0183b-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/usr/lib/python3.5/locale.py

Cheers,

Attila

View solution in original post

0 Kudos
8 Replies
sandeepg
Moderator
Moderator
9,212 Views
Registered: ‎04-24-2017

Refer this AR https://www.xilinx.com/support/answers/71448.html 

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
quypham
Observer
Observer
9,188 Views
Registered: ‎07-26-2018

I have the same error. Did you find a  working solution yet? 

The above link does not work. Please provide another.

 

Thanks

0 Kudos
bluetiger9
Adventurer
Adventurer
9,180 Views
Registered: ‎09-02-2018

The linked AR (remove the %C2%A0 from the link) just states that Ubuntu 18.04.x LTS is not officially supported.


I didn't have a solution yet. I posted a message on the Yocto mailing list, so hope we get more details about what the problem is.

0 Kudos
quypham
Observer
Observer
9,159 Views
Registered: ‎07-26-2018
Thanks.
I didn't find a solution for the error but I have successfully build the image and generate BOOT.BIN with Ubuntu 16.04.1.
You should switch to this older version bluetiger9
0 Kudos
bluetiger9
Adventurer
Adventurer
9,143 Views
Registered: ‎09-02-2018

I found a (pretty ugly) workaround for the problem today...

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

The files appears in multiple locations. I edited all of them, but probably no all are needed:

  • PetaLinux install directory:
    ./components/yocto/source/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/locale.py
    ./components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/locale.py
  • build directory
    ./build/tmp/sysroots-components/x86_64/python3-native/usr/lib/python3.5/locale.py
    ./build/tmp/sysroots-components/aarch64/python3/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/pmu-firmware/2018.2+gitAUTOINC+6e82c0183b-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/linux-xlnx/4.14-xilinx-v2018.2+gitAUTOINC+ad4cd988ba-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/fsbl/2018.2+gitAUTOINC+6e82c0183b-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/locale.py
    ./build/tmp/work/ultra96_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/usr/lib/python3.5/locale.py

Cheers,

Attila

View solution in original post

0 Kudos
zc102test
Visitor
Visitor
8,682 Views
Registered: ‎11-19-2018

Hi Attila,

 

I really appreciate you for the solution, after change those files, it does work on my Ubuntu18.10 64bit server release.

 

Thank you very much!!

Best Regards,

Jianhua Xie

0 Kudos
petearris
Visitor
Visitor
5,713 Views
Registered: ‎12-03-2018

I am getting the same error when building u-boot and I am using Ubuntu 16.04.

petalinux-build -c u-boot
[INFO] building u-boot
[INFO] sourcing bitbake
INFO: bitbake virtual/bootloader
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:

Please set a valid MACHINE in your local.conf or environment

0 Kudos
eengie
Contributor
Contributor
4,128 Views
Registered: ‎06-30-2014

Besides the sanity.bbclass change, the only other file I had to change was:

./build/tmp/sysroots-components/x86_64/dnf-native/usr/lib/python3.5/site-packages/dnf/i18n.py

The issue is the "print" statement in there that says, Failed to set locale, defaulting to C.  The log sanity checker sees "Failed" in plain text and assumes it was a failure.

In my case, I was generating a root file system (do_rootfs task).

0 Kudos