gvsbuild icon indicating copy to clipboard operation
gvsbuild copied to clipboard

It's not working on localized VS

Open calendulish opened this issue 8 years ago • 2 comments

A thread from mesonlib.py throw an UnicodeDecodeError when build with a localized VS. Same for meson 0.44.0 ~ 0.45.0, python 3.6 ~ 3.7.

I really don't know if "cp1252" is a valid encoding here or whether some script in gvsbuild is setting it incorrectly.

Building project ninja
Building project meson
Building project pkg-config
HEAD is now at a50bf72 Fix incorrect comment (#178)
C:\gtk-build\tools\meson-0.45.0\mesonbuild\mesonlib.py:938: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class OrderedSet(collections.MutableSet):
The Meson build system
Version: 0.45.0
Source dir: C:\gtk-build\build\x64\release\pkg-config
Build dir: C:\gtk-build\build\x64\release\pkg-config-meson
Build type: native build
Project name: pkgconf
Exception in thread Thread-1:
Traceback (most recent call last):
  File "c:\Python37-x64\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "c:\Python37-x64\lib\threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Python37-x64\lib\subprocess.py", line 1215, in _readerthread
    buffer.append(fh.read())
  File "c:\Python37-x64\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 4669: character maps to <undefined>

Traceback (most recent call last):
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\mesonmain.py", line 361, in run
    app.generate()
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\mesonmain.py", line 150, in generate
    self._generate(env)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\mesonmain.py", line 189, in _generate
    intr = interpreter.Interpreter(b, g)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreter.py", line 1444, in __init__
    self.parse_project()
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 159, in parse_project
    self.evaluate_codeblock(self.ast, end=1)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 195, in evaluate_codeblock
    raise e
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 189, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 200, in evaluate_statement
    return self.function_call(cur)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 456, in function_call
    return self.funcs[func_name](node, self.flatten(posargs), kwargs)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 55, in wrapped
    return f(self, node, args, kwargs)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreterbase.py", line 79, in wrapped
    return f(s, node_or_state, args, kwargs)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreter.py", line 1947, in func_project
    self.add_languages(proj_langs, True)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreter.py", line 2078, in add_languages
    (comp, cross_comp) = self.detect_compilers(lang, need_cross_compiler)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\interpreter.py", line 2001, in detect_compilers
    comp = self.environment.detect_c_compiler(False)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\environment.py", line 543, in detect_c_compiler
    return self._detect_c_or_cpp_compiler('c', 'CC', want_cross)
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\environment.py", line 497, in _detect_c_or_cpp_compiler
    p, out, err = Popen_safe(compiler + [arg])
  File "C:\gtk-build\tools\meson-0.45.0\mesonbuild\mesonlib.py", line 723, in Popen_safe
    o, e = p.communicate(write)
  File "c:\Python37-x64\lib\subprocess.py", line 920, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "c:\Python37-x64\lib\subprocess.py", line 1265, in _communicate
    stdout = stdout[0]
IndexError: list index out of range
c:\Python37-x64\lib\subprocess.py:839: ResourceWarning: subprocess 916 is still running
  ResourceWarning, source=self)
Traceback (most recent call last):
  File "C:\gvsbuild\gvsbuild\utils\builder.py", line 325, in build
    self.__build_one(p)
  File "C:\gvsbuild\gvsbuild\utils\builder.py", line 404, in __build_one
    proj.build()
  File "C:\gvsbuild\gvsbuild\projects.py", line 1264, in build
    Meson.build(self, meson_params='-Dtests=false')
  File "C:\gvsbuild\gvsbuild\utils\base_builders.py", line 52, in build
    self.exec_vs(cmd)
  File "C:\gvsbuild\gvsbuild\utils\base_project.py", line 71, in exec_vs
    self.builder.exec_vs(cmd, working_dir=self._get_working_dir(), add_path=add_path)
  File "C:\gvsbuild\gvsbuild\utils\builder.py", line 614, in exec_vs
    self.__execute(self.__sub_vars(cmd), working_dir=working_dir, add_path=add_path, env=self.vs_env)
  File "C:\gvsbuild\gvsbuild\utils\builder.py", line 646, in __execute
    subprocess.check_call(args, cwd=working_dir, env=env, encoding='utf-8', shell=True)
  File "C:\Python37-x64\lib\subprocess.py", line 328, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'c:/Python37-x64\python.exe C:\gtk-build\tools\meson-0.45.0\meson.py C:\gtk-build\build\x64\release\pkg-config C:\gtk-build\build\x64\release\pkg-config-meson --prefix C:\gtk-build\gtk\x64\release --buildtype release -Dtests=false' returned non-zero exit status 2.
Error: pkg-config build failed

Process finished with exit code 1

calendulish avatar Mar 09 '18 14:03 calendulish

I guess gvsbuild should ensure no encoding is set

nacho avatar Mar 12 '18 08:03 nacho

set(ENV{PYTHONIOENCODING} UTF-8) ${CMAKE_COMMAND} -E env PYTHONUTF8=1


set PYTHONUTF8=1
set PYTHONIOENCODING=UTF-8

MVoz avatar May 25 '19 01:05 MVoz