Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 705286 - media-libs/gegl-0.4.18: Compilation error due to non-ascii characters in opencl/gblur-1d.cl.h
Summary: media-libs/gegl-0.4.18: Compilation error due to non-ascii characters in open...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Sergey Torokhov
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-01-12 14:08 UTC by Johannes Niess
Modified: 2020-01-20 18:16 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,40.45 KB, text/x-log)
2020-01-12 14:13 UTC, Johannes Niess
Details
cltostring.py (patched) (cltostring.py,1.86 KB, text/x-python)
2020-01-13 10:28 UTC, Sergey Torokhov
Details
gegl-0.4.18-cltostring_force_utf8.patch (gegl-0.4.18-cltostring_force_utf8.patch,913 bytes, patch)
2020-01-14 08:06 UTC, Sergey Torokhov
Details | Diff
gegl-0.4.18-r1.ebuild (gegl-0.4.18-r1.ebuild,4.77 KB, text/plain)
2020-01-14 08:08 UTC, Sergey Torokhov
Details
environment from tmp directory (environment,111.24 KB, text/plain)
2020-01-14 19:36 UTC, Johannes Niess
Details
locale.gen (locale.gen,889 bytes, text/plain)
2020-01-14 19:40 UTC, Johannes Niess
Details
/etc/env.d/02locale (02locale,34 bytes, text/plain)
2020-01-14 19:42 UTC, Johannes Niess
Details
locale -a (locale-a.txt,222 bytes, text/plain)
2020-01-14 19:45 UTC, Johannes Niess
Details
grep for UTFin kernel .config (utf_in_kernel_config.txt,219 bytes, text/plain)
2020-01-14 19:48 UTC, Johannes Niess
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Niess 2020-01-12 14:08:12 UTC
It looks like something has changed in the way the gegl-0.4.18 ebuild and its python toolchain treat non-ascii characters.

Emerging media-libs/gegl-0.4.16 in the same environment (and probably the same opencl/gblur-1d.cl.h file) works as intended. 

opencl/gblur-1d.cl.h is mostly ASCII (at least in opencl gitweb), but has this in line 18:
" * Copyright 2013 T\303\251o Mazars      <teomazars@gmail.com>               \n"



Reproducible: Always

Steps to Reproduce:
1.emerge media-libs/gegl-0.4.18

Actual Results:  
[52/733] /usr/bin/python3.6 ../gegl-0.4.18/opencl/cltostring.py ../gegl-0.4.18/opencl/gblur-1d.cl opencl/gblur-1d.cl.h
FAILED: opencl/gblur-1d.cl.h 
/usr/bin/python3.6 ../gegl-0.4.18/opencl/cltostring.py ../gegl-0.4.18/opencl/gblur-1d.cl opencl/gblur-1d.cl.h
Traceback (most recent call last):
  File "../gegl-0.4.18/opencl/cltostring.py", line 49, in <module>
    cl_source = infile.read()
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128)


Expected Results:  
Successfully emerging media-libs/gegl-0.4.18
Comment 1 Johannes Niess 2020-01-12 14:09:31 UTC
sawfish ~ # emerge --info '=media-libs/gegl-0.4.18::gentoo'
Portage 2.3.79 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-9.2.0, glibc-2.29-r7, 5.3.7-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.3.7-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.6
KiB Mem:    12211908 total,   4266220 free
KiB Swap:   18496504 total,  18495480 free
Timestamp of repository gentoo: Sun, 12 Jan 2020 12:30:01 +0000
Head commit of repository gentoo: c4a79237470e07d1570b67c24642c5e64dc26db6
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx-i  -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core-avx-i -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j 9"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildsyspkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C"
LC_ALL="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de"
MAKEOPTS="-j 9 -l 9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif flac fortran gdbm gif gpm gtk iconv icu imagemagick ipv6 jpeg kde kipi kwallet lcms ldap libnotify libtirpc lm-sensors lvm mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg openexr opengl openmp pam pango pcre pdf phonon pic plasma png policykit ppds python qml qt5 readline scanner sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb v4l vaapi vdpau vorbis vulkan widgets wxwidgets x264 xattr xcb xcomposite xml xv xvid zlib" ABI_X86="32 64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86 AMDGPU BPF" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi r600 radeon intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Johannes Niess 2020-01-12 14:10:12 UTC
sawfish ~ # ACCEPT_KEYWORDS=~amd64 emerge -pqv '=media-libs/gegl-0.4.18::gentoo'                                             
[ebuild     U ] media-libs/gegl-0.4.18 [0.4.16] USE="cairo lcms lensfun openexr pdf raw sdl svg tiff v4l -debug -ffmpeg -introspection -libav -test -umfpack -vala -webp (-zlib%*)" CPU_FLAGS_X86="(-mmx%*) (-sse%*)"
Comment 3 Johannes Niess 2020-01-12 14:13:20 UTC
Created attachment 603096 [details]
build.log
Comment 4 Sergey Torokhov 2020-01-12 21:36:36 UTC
I re-emerged (ebuild media-libs/gegl-0.4.18.ebuild clean compile) and it compile without any problems. I also try to run separately 'cltostring.py gblur-1d.cl gblur-1d.cl.h' for local file copies of gegl-0.4.18.

The 0.4.18 now uses 'cltostring.py' now to convert '.cl' files to '.cl.h' while 0.4.16 tarball already have the ready headers and in your ENV build successfully.

Maybe this problem is related to recent update of 'app-text/iso-codes-4.4' for 3.76.

What is your `locale` output?
Comment 5 Sergey Torokhov 2020-01-12 22:02:24 UTC
> What is your `locale` output?

I see you have 'LC_ALL="C"'. Is it fist time you try to emerge gegl-0.4.18?

Does the compile result change in case of changing the LC_CTYPE to de_DE.UTF-8 or C.UTF-8 ?
Comment 6 Sergey Torokhov 2020-01-12 22:18:45 UTC
(In reply to Sergey Torokhov from comment #5)
> > What is your `locale` output?
> 
> I see you have 'LC_ALL="C"'. Is it fist time you try to emerge gegl-0.4.18?
> 
> Does the compile result change in case of changing the LC_CTYPE to
> de_DE.UTF-8 or C.UTF-8 ?

I ran

> $ LC_CTYPE=C python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h

and got

> Traceback (most recent call last):
>   File "cltostring.py", line 49, in <module>
>     cl_source = infile.read()
>   File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
>     return codecs.ascii_decode(input, self.errors)[0]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128)

While command (or for my LC_CTYPE=ru_RU.UTF-8)

> LC_CTYPE=C.UTF-8 python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h
works successfully.
Comment 7 Sergey Torokhov 2020-01-13 10:28:17 UTC
Created attachment 603140 [details]
cltostring.py (patched)

My knowledge of python is superficial so I tried to fix cltostring.py to force using utf8 and to be compatible both python 2.7 and python 3 this way (see attached file).

Could you check in your environment where gegl was failed (with LC_ALL=C) to compile the running of attached python script cltostring.py for gblur-1d.cl from gegl-0.4.18 tarball:

python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h

and

python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h

?
Comment 8 Johannes Niess 2020-01-13 18:36:54 UTC
@Comment #4

sawfish ~ # locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE=C
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
sawfish ~ # 


I tried before and after updating app-text/iso-codes with the same reported results.

niess@sawfish ~ $ LANG=C eix -v app-text/iso-codes
* app-text/iso-codes
     Available versions:  3.76^bs 4.4^bs
     Installed versions:  Version:   4.4^bs
                          Date:      19:42:00 01/11/20
                          BDEPEND:   || ( dev-lang/python:3.7 dev-lang/python:3.6 ) sys-devel/gettext
                          SRC_URI:   
                          EAPI:      7
     Best versions/slot:  4.4^bs
Comment 9 Johannes Niess 2020-01-13 18:38:15 UTC
(In reply to Sergey Torokhov from comment #4)
> I re-emerged (ebuild media-libs/gegl-0.4.18.ebuild clean compile) and it
> compile without any problems. I also try to run separately 'cltostring.py
> gblur-1d.cl gblur-1d.cl.h' for local file copies of gegl-0.4.18.
> 
> The 0.4.18 now uses 'cltostring.py' now to convert '.cl' files to '.cl.h'
> while 0.4.16 tarball already have the ready headers and in your ENV build
> successfully.
> 
> Maybe this problem is related to recent update of 'app-text/iso-codes-4.4'
> for 3.76.
> 
> What is your `locale` output?

sawfish ~ # locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE=C
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
sawfish ~ # 


I tried before and after updating app-text/iso-codes with the same reported results.

niess@sawfish ~ $ LANG=C eix -v app-text/iso-codes
* app-text/iso-codes
     Available versions:  3.76^bs 4.4^bs
     Installed versions:  Version:   4.4^bs
                          Date:      19:42:00 01/11/20
                          BDEPEND:   || ( dev-lang/python:3.7 dev-lang/python:3.6 ) sys-devel/gettext
                          SRC_URI:   
                          EAPI:      7
     Best versions/slot:  4.4^bs
Comment 10 Johannes Niess 2020-01-13 18:49:41 UTC
(In reply to Sergey Torokhov from comment #5)
> > What is your `locale` output?
> 
> I see you have 'LC_ALL="C"'. Is it fist time you try to emerge gegl-0.4.18?
> 
> Does the compile result change in case of changing the LC_CTYPE to
> de_DE.UTF-8 or C.UTF-8 ?

I tried daily eix-updates and recompiling over several weeks (I am after the new gimp version requiring gegl-0.4.18). No fix magically appeared. After looking at some similar bugs in python based packages I started messing around with locales as environment variables.

This failes as described (as well as the C.UTF-8 variant):
sawfish ~ # LC_CTYPE=de_DE.UTF-8 emerge -avu1 gegl  

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ~] media-libs/gegl-0.4.18:0.4::gentoo [0.4.16:0.4::gentoo] USE="cairo lcms lensfun openexr pdf raw sdl svg tiff v4l -debug -ffmpeg -introspection -libav -test -umfpack -vala -webp (-zlib%*)" CPU_FLAGS_X86="(-mmx%*) (-sse%*)" 0 KiB
Comment 11 Johannes Niess 2020-01-13 19:19:14 UTC
(In reply to Sergey Torokhov from comment #7)
> Created attachment 603140 [details]
> cltostring.py (patched)
> 
> My knowledge of python is superficial so I tried to fix cltostring.py to
> force using utf8 and to be compatible both python 2.7 and python 3 this way
> (see attached file).
> 
> Could you check in your environment where gegl was failed (with LC_ALL=C) to
> compile the running of attached python script cltostring.py for gblur-1d.cl
> from gegl-0.4.18 tarball:
> 
> python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h
> 
> and
> 
> python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h
> 
> ?

The python2.7 and the python3.6 commands run successfully when no LC_CTYPE is set on the command line, as well as LC_CTYPE=C.UTF-8 and LC_CTYPE=de_DE.UTF-8.

LC_CTYPE=C python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h fails the same way we both experienced, while 
LC_CTYPE=C python3.6
works.

sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # LC_CTYPE=C python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # LC_CTYPE=C python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h
Traceback (most recent call last):
  File "cltostring.py", line 49, in <module>
    cl_source = infile.read()
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128)



sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h

sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # ls -lht gblur*
-rw-r--r-- 1 root    root    6,0K 13. Jan 20:01 gblur-1d.cl.h
-rw-r--r-- 1 portage portage 2,5K 27. Okt 01:01 gblur-1d.cl
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl #
Comment 12 Johannes Niess 2020-01-13 19:23:31 UTC
(In reply to Johannes Niess from comment #11)
> (In reply to Sergey Torokhov from comment #7)
> > Created attachment 603140 [details]
> > cltostring.py (patched)
> > 
> > My knowledge of python is superficial so I tried to fix cltostring.py to
> > force using utf8 and to be compatible both python 2.7 and python 3 this way
> > (see attached file).
> > 
> > Could you check in your environment where gegl was failed (with LC_ALL=C) to
> > compile the running of attached python script cltostring.py for gblur-1d.cl
> > from gegl-0.4.18 tarball:
> > 
> > python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h
> > 
> > and
> > 
> > python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h
> > 
> > ?
> 
> The python2.7 and the python3.6 commands run successfully when no LC_CTYPE
> is set on the command line, as well as LC_CTYPE=C.UTF-8 and
> LC_CTYPE=de_DE.UTF-8.
> 
> LC_CTYPE=C python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h fails the same
> way we both experienced, while 
> LC_CTYPE=C python3.6
> works.
> 
> sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl #
> LC_CTYPE=C python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h
> sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl #
> LC_CTYPE=C python3.6 cltostring.py gblur-1d.cl gblur-1d.cl.h
> Traceback (most recent call last):
>   File "cltostring.py", line 49, in <module>
>     cl_source = infile.read()
>   File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
>     return codecs.ascii_decode(input, self.errors)[0]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783:
> ordinal not in range(128)
> 
> 
> 
> sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl #
> python2.7 cltostring.py gblur-1d.cl gblur-1d.cl.h
> 
> sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # ls
> -lht gblur*
> -rw-r--r-- 1 root    root    6,0K 13. Jan 20:01 gblur-1d.cl.h
> -rw-r--r-- 1 portage portage 2,5K 27. Okt 01:01 gblur-1d.cl
> sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl #

The naive workaround of using eselect to switch python version preference did NOT work out:

sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # eselect python show
python3.6
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python2.7 (fallback)
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # eselect python set 2
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # eselect python list 
Available Python interpreters, in order of preference:
  [1]   python2.7
  [2]   python3.6
sawfish /var/tmp/portage/media-libs/gegl-0.4.18/work/gegl-0.4.18/opencl # cd /tmp/
sawfish /tmp #  emerge -avu1 gegl     
-> Fails as reported
Comment 13 Sergey Torokhov 2020-01-14 07:48:27 UTC
> I tried daily eix-updates and recompiling over several weeks (I am after the
> new gimp version requiring gegl-0.4.18). No fix magically appeared. After
> looking at some similar bugs in python based packages I started messing
> around with locales as environment variables.

Yes it looks like locale issue. Maybe patched cltostring.py will solve the issue if replace with it before compiling. I still can't reproduce the issue trying to setting LC_CTYPE=C : this is always setuped to C.UTF-8 inside sandbox env for me

I was confused by LANG="C" LC_ALL="C" in emerge info.

Could you provide 

1. /var/tmp/portage/media-libs/gegl-0.4.18/environment
2. /etc/locale.gen (locale.conf if available)
3. /etc/env.d/02locale
4. the output of "locale -a" command
5. the output of "grep -i utf /usr/src/linux/.config

?

Do you use openrc or systemd?
Comment 14 Sergey Torokhov 2020-01-14 08:06:03 UTC
Created attachment 603254 [details, diff]
gegl-0.4.18-cltostring_force_utf8.patch
Comment 15 Sergey Torokhov 2020-01-14 08:08:55 UTC
Created attachment 603256 [details]
gegl-0.4.18-r1.ebuild

Sorry, I forgot to add patched ebuild.

Could you try to emerge it?
Please also download "gegl-0.4.18-cltostring_force_utf8.patch" that is applied by "gegl-0.4.18-r1.ebuild".
Comment 16 Johannes Niess 2020-01-14 19:36:34 UTC
Created attachment 603302 [details]
environment from tmp directory
Comment 17 Johannes Niess 2020-01-14 19:40:32 UTC
Created attachment 603304 [details]
locale.gen

Just English and German
Comment 18 Johannes Niess 2020-01-14 19:42:40 UTC
Created attachment 603306 [details]
/etc/env.d/02locale
Comment 19 Johannes Niess 2020-01-14 19:45:17 UTC
Created attachment 603308 [details]
locale -a
Comment 20 Johannes Niess 2020-01-14 19:48:16 UTC
Created attachment 603310 [details]
grep for UTFin kernel .config
Comment 21 Johannes Niess 2020-01-14 19:59:22 UTC
(In reply to Sergey Torokhov from comment #13)
> > I tried daily eix-updates and recompiling over several weeks (I am after the
> > new gimp version requiring gegl-0.4.18). No fix magically appeared. After
> > looking at some similar bugs in python based packages I started messing
> > around with locales as environment variables.
> 
> Yes it looks like locale issue. Maybe patched cltostring.py will solve the
> issue if replace with it before compiling. I still can't reproduce the issue
> trying to setting LC_CTYPE=C : this is always setuped to C.UTF-8 inside
> sandbox env for me
> 
> I was confused by LANG="C" LC_ALL="C" in emerge info.
> 
> Could you provide
Please see attachments for raw data. I've added a short summary below.
 
> 
> 1. /var/tmp/portage/media-libs/gegl-0.4.18/environment
has everything related to LANG at = "C"

> 2. /etc/locale.gen (locale.conf if available)
en_US and de_DE in ISO-8859-1 and UTF-8


> 3. /etc/env.d/02locale
LANG="de_DE.UTF-8"
LC_COLLATE="C"


> 4. the output of "locale -a" command
C, C-UTF8, German and English in ISO-8859-1 and UFT-8

> 5. the output of "grep -i utf /usr/src/linux/.config
CONFIG_NLS_DEFAULT="utf8" might be what you are looking for in the running kernel

> 
> ?
> 
> Do you use openrc or systemd?
I am using openrc. The way I start emerge is from KDE konsole via "su -" into a root shell.
Comment 22 Johannes Niess 2020-01-14 20:28:17 UTC
(In reply to Sergey Torokhov from comment #15)
> Created attachment 603256 [details]
> gegl-0.4.18-r1.ebuild
> 
> Sorry, I forgot to add patched ebuild.
> 
> Could you try to emerge it?
> Please also download "gegl-0.4.18-cltostring_force_utf8.patch" that is
> applied by "gegl-0.4.18-r1.ebuild".

I'll try this bottom-up approach on the weekend. Setting up local overlay etc. takes too much time for now. 

Maybe the top-down approach of checking my environment against the Gentoo handbook expectations and fixing/forcing my environment away from the only broken combination of python 3.6 and "C" is faster. This weekend I'll play around with removing python 3.6 from the ebuild and/or your utf8 patch.
Comment 23 Johannes Niess 2020-01-18 17:03:35 UTC
After removing the offending character manually,

ebuild /usr/portage/media-libs/gegl/gegl-0.4.18.ebuild compile

finishes successfully in the working directory of an failed emerge. All remaining ebuild steps also finish successfully for me.

This is seems to be the only non-ascii char in the opencl headers. We could see this as a violation of coding style and patch it away as the least invasive approach.
Comment 24 Johannes Niess 2020-01-18 17:32:13 UTC
Inserting your patched cltostring.py also works for me.

("ebuild clean" and then "ebuild compile" in the same directory as above). Do you still need a test of gegl-0.4.18-r1.ebuild?
Comment 25 Sergey Torokhov 2020-01-19 06:58:39 UTC
(In reply to Johannes Niess from comment #24)
> Inserting your patched cltostring.py also works for me.
> 
> ("ebuild clean" and then "ebuild compile" in the same directory as above).
> Do you still need a test of gegl-0.4.18-r1.ebuild?

If patched cltostring.py fixes problem then I'm going to create pull request to add it in portage tree. Thank you for testing in your environment. While I still don't understand why "system" codepage in sandbox isn't utf8.
Comment 26 Larry the Git Cow gentoo-dev 2020-01-20 13:03:22 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5106d923c2d796469a4da6e0e8d5524cf958126

commit e5106d923c2d796469a4da6e0e8d5524cf958126
Author:     band-a-prend <torokhov-s-a@yandex.ru>
AuthorDate: 2020-01-19 07:02:27 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2020-01-20 13:03:10 +0000

    media-libs/gegl: Fix compilation error due to non-ascii symbols
    
    This patch force using utf8 while reading files on converting .cl files
    to .h files in env where for some reasons sandbox system codepage isn't utf8.
    
    The patch provides compatibility both with python2.7 and python3.x.
    When python2.7 support will be dropped the addition of
    from __future__ import unicode_literals
    import io
    and "io."
    could be removed as not neccessary for python3.x.
    
    Closes: https://bugs.gentoo.org/705286
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
    Closes: https://github.com/gentoo/gentoo/pull/14387
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 .../files/gegl-0.4.18-cltostring_force_utf8.patch  | 30 ++++++++++++++++++++++
 media-libs/gegl/gegl-0.4.18.ebuild                 |  5 ++--
 2 files changed, 33 insertions(+), 2 deletions(-)
Comment 27 Sergey Torokhov 2020-01-20 13:24:18 UTC
(In reply to Johannes Niess from comment #24)
> Inserting your patched cltostring.py also works for me.
> 
> ("ebuild clean" and then "ebuild compile" in the same directory as above).
> Do you still need a test of gegl-0.4.18-r1.ebuild?

Changed gegl-0.4.18.ebuild (there is no -r1) with patch were merged to portage tree. Depends on your sync method (e.g. git or rsync) it should be provided to users in several hours or tomorrow.

The gegl-0.4.18-cltostring_force_utf8.patch should then appear in /usr/portage/media-libs/gegl/files/ directory after portage tree sync.
Comment 28 Johannes Niess 2020-01-20 18:10:12 UTC
(In reply to Sergey Torokhov from comment #27)
> (In reply to Johannes Niess from comment #24)
> > Inserting your patched cltostring.py also works for me.
> > 
> > ("ebuild clean" and then "ebuild compile" in the same directory as above).
> > Do you still need a test of gegl-0.4.18-r1.ebuild?
> 
> Changed gegl-0.4.18.ebuild (there is no -r1) with patch were merged to
> portage tree. Depends on your sync method (e.g. git or rsync) it should be
> provided to users in several hours or tomorrow.
> 
> The gegl-0.4.18-cltostring_force_utf8.patch should then appear in
> /usr/portage/media-libs/gegl/files/ directory after portage tree sync.

Thanks for updating the ebuild. Emerging now has no problems for me.

sawfish ~ # ls /usr/portage/media-libs/gegl/files/
gegl-0.2.0-cve-2012-4433-1e92e523.patch  gegl-0.2.0-ffmpeg-4-0-compat.patch      gegl-0.2.0-g_log_domain.patch           gegl-0.2.0-underlinking.patch         gegl-0.4.0-ffmpeg-4-0-compat-2.patch     gegl-0.4.18-meson_cpu_detection.patch
gegl-0.2.0-cve-2012-4433-4757cdf7.patch  gegl-0.2.0-ffmpeg-av_frame_alloc.patch  gegl-0.2.0-introspection-version.patch  gegl-0.3.12-failing-tests.patch       gegl-0.4.18-cltostring_force_utf8.patch  gegl-0.4.18-program-suffix.patch
gegl-0.2.0-ffmpeg-0.11.diff              gegl-0.2.0-fix-without-exiv2.patch      gegl-0.2.0-libopenraw-0.1.patch         gegl-0.4.0-ffmpeg-4-0-compat-1.patch  gegl-0.4.18-drop-failing-tests.patch
sawfish ~ # emerge -av1 gegl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ~] media-libs/gegl-0.4.18:0.4::gentoo  USE="cairo lcms lensfun openexr pdf raw sdl svg tiff v4l -debug -ffmpeg -introspection -libav -test -umfpack -vala -webp" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] 
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) media-libs/gegl-0.4.18::gentoo
>>> Installing (1 of 1) media-libs/gegl-0.4.18::gentoo
>>> Recording media-libs/gegl in "world" favorites file...
>>> Jobs: 1 of 1 complete                           Load avg: 4.05, 1.37, 0.52
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.
sawfish ~ #
Comment 29 Sergey Torokhov 2020-01-20 18:16:47 UTC
Thank you for feedback. 

This patch also will be at recently released gegl 0.4.20 that now is required to build development version of gimp (gimp-9999 now is broken for this reason).