Hi,

Got some more details on this...

Apparently, the errors are generated because of the use of Python 3.5.3 
included in Yocto / PetaLinux.

The "Failed to set locale, defaulting to C" message seems to be logged from 
dnf, i18n.py/setup_locale():

def setup_locale():
    try:
        dnf.pycomp.setlocale(locale.LC_ALL, '')
    except locale.Error as e:
        # default to C locale if we get a failure.
        print('Failed to set locale, defaulting to C', file=sys.stderr)
        os.environ['LC_ALL'] = 'C'
        dnf.pycomp.setlocale(locale.LC_ALL, 'C')
(https://github.com/rpm-software-management/dnf/blob/master/dnf/i18n.py#L80)

The call that fails is dnf.pycomp.locale.setlocale(locale.LC_ALL, ''), which 
calls locale.setlocale(locale.LC_ALL, '') under the hood.

During petalinux-build, I observed a couple of bitbake processes running with a 
Python 3.5.3 included in Yocto. Ex:

21093 
/media/bluetiger/Data/Xilinx/PetaLinux/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/python3.5
 
/media/bluetiger/Data/Xilinx/PetaLinux/components/yocto/source/aarch64/layers/core/bitbake/bin/bitbake-worker
 decafbad

A quick tests shows that with the Python 3.5.3 included in the Yocto/PetaLinux 
package the locale.setlocale(locale.LC_ALL, '') call fails, while the Python 
3.6.6 installed on Ubuntu 18.04.1 LTS works as expected.

Python 3.5.3 included in Yocto (PetaLinux):

bluetiger@Attila-Laptop:x86_64-petalinux-linux$ pwd
/media/bluetiger/Data/Xilinx/PetaLinux/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux
bluetiger@Attila-Laptop:x86_64-petalinux-linux$ ./usr/bin/python3.5
Python 3.5.3 (default, Jun  7 2018, 20:28:47) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File 
"/media/bluetiger/Data/Xilinx/PetaLinux/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/locale.py",
 line 594, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> 

Python 3.6.6 installed on Ubuntu 18.04.1 LTS:

bluetiger@Attila-Laptop:~$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'en_US.UTF-8'
>>> 

My initial idea was to comment out the print() command from the 
i18n.py/setup_locale(), but I not sure where the file is located. Any idea 
where the file is located?

An another solution would be to somehow force bitbake to use the Python 3.6.6 
installed on the system.

Or do you have other suggestions on how to fix this?

Thanks,
Attila


On Wednesday, September 26, 2018, 10:45:20 AM GMT+3, Tőkés Attila 
<tokes_a...@yahoo.com> wrote:
>Hi Yocto Team,
>
>First of all sorry for spamming your mailing list, but I'm kind of out ideas 
>with this...
>
>I'm trying to build PetaLinux on Ubuntu 18.04 LTS, but the build is failing 
>because of some (probably harmless) locale related errors the do_rootfs 
>subtask logs:
>
>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.
>...
>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.
>The locales seems to be just fine on the machine:
>
>bluetiger@Attila-Laptop:~$ localeLANG=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
>
>
>Does anyone know what causes the problem? Is there a way to fix / workaround 
>it?
>Yesterday, I had a similar problem with bitbake's sanity checks, but I solved 
>that by commenting out some code in sanity_check_locale() from sanity.bbclass.
>
>Is this something Ubuntu 18.04 related? If I understood correctly Ubuntu 18.04 
>is not officially supported. But maybe it would worth checking what causes 
>this error.
>
>I would really appreciate any help on this...
>
>Thanks,
>Attila
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to