Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError when checking Msvc tool #778

Closed
yihuajack opened this issue Dec 22, 2022 · 0 comments · Fixed by #779
Closed

UnicodeDecodeError when checking Msvc tool #778

yihuajack opened this issue Dec 22, 2022 · 0 comments · Fixed by #779

Comments

@yihuajack
Copy link
Contributor

When I run gvsbuild build gtk4 --msys-dir='E:/Program_Files/msys64', the build failed with error:

Checking Msvc tool
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
File "E:\Program_Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "E:\Program_Files\Python310\lib\threading.py", line 953, in run
self.target(self._args, **self._kwargs)
File "E:\Program_Files\Python310\lib\subprocess.py", line 1497, in _readerthread
buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 706: illegal multibyte sequence
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Yihua.local\pipx\venvs\gvsbuild\lib\site-packages\gvsbuild\build.py:404 in build │
│ │
│ 401 │ │ │ v = opts.dict[co] │
│ 402 │ │ │ pv = f"'{v}'" if type(v) is str else repr(v) │
│ 403 │ │ │ log.message_indent(f"'{co}': {pv}, ") │
│ ❱ 404 │ builder = Builder(opts) │
│ 405 │ builder.preprocess() │
│ 406 │ │
│ 407 │ to_build = __get_projects_to_build(opts) │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ archives_download_dir = WindowsPath('C:/gtk-build/src') │ │
│ │ build_dir = WindowsPath('C:/gtk-build') │ │
│ │ capture_out = False │ │
│ │ cargo_opts = None │ │
│ │ check_hash = False │ │
│ │ clean = False │ │
│ │ clean_built = False │ │
│ │ configuration = <Configuration.release: 'release'> │ │
│ │ debug = False │ │
│ │ deps = True │ │
│ │ enable_gi = False │ │
│ │ export_dir = None │ │
│ │ fast_build = False │ │
│ │ ffmpeg_enable_gpl = False │ │
│ │ from_scratch = False │ │
│ │ git_expand_dir = None │ │
│ │ keep_going = False │ │
│ │ keep_tools = False │ │
│ │ log_single = False │ │
│ │ log_size = 0 │ │
│ │ make_zip = False │ │
│ │ msbuild_opts = None │ │
│ │ msys_dir = WindowsPath('E:/Program_Files/msys64') │ │
│ │ net_target_framework = None │ │
│ │ net_target_framework_version = None │ │
│ │ ninja_opts = None │ │
│ │ opts = <gvsbuild.utils.base_project.Options object at │ │
│ │ 0x000001DAFAD449A0> │ │
│ │ p = 'gtk4' │ │
│ │ patches_root_dir = WindowsPath('C:/Users/Yihua/.local/pipx/venvs/gvsbuild/lib/s… │ │
│ │ platform = <Platform.x64: 'x64'> │ │
│ │ print_out = False │ │
│ │ projects = ['gtk4'] │ │
│ │ prop_file = WindowsPath('C:/Users/Yihua/.local/pipx/venvs/gvsbuild/lib/s… │ │
│ │ py_wheel = False │ │
│ │ skip = [] │ │
│ │ tools_root_dir = None │ │
│ │ use_env = False │ │
│ │ verbose = False │ │
│ │ vs_install_path = None │ │
│ │ vs_ver = <VsVer.vs2022: '17'> │ │
│ │ win_sdk_ver = None │ │
│ │ zip_continue = False │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\Yihua.local\pipx\venvs\gvsbuild\lib\site-packages\gvsbuild\utils\builder.py:127 in │
init
│ │
│ 124 │ │ │ os.makedirs(self.zip_dir, exist_ok=True) │
│ 125 │ │ │
│ 126 │ │ self.__check_tools(opts) │
│ ❱ 127 │ │ self.__check_vs(opts) │
│ 128 │ │
│ 129 │ def _create_msbuild_opts(self, python): │
│ 130 │ │ rt = [f"/nologo /p:Platform={self.opts.platform}"] │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ opts = <gvsbuild.utils.base_project.Options object at 0x000001DAFAD449A0> │ │
│ │ self = <gvsbuild.utils.builder.Builder object at 0x000001DAFAA8D690> │ │
│ │ vs_part = 'vs2022' │ │
│ │ vs_zip_parts = { │ │
│ │ │ '12': 'vs2013', │ │
│ │ │ '14': 'vs2015', │ │
│ │ │ '15': 'vs2017', │ │
│ │ │ '16': 'vs2019', │ │
│ │ │ '17': 'vs2022' │ │
│ │ } │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\Yihua.local\pipx\venvs\gvsbuild\lib\site-packages\gvsbuild\utils\builder.py:405 in │
│ __check_vs │
│ │
│ 402 │ │ │
│ 403 │ │ if not opts.vs_install_path: │
│ 404 │ │ │ opts.vs_install_path = self.__find_vs_path_with_vs_version( │
│ ❱ 405 │ │ │ │ self.__dump_vs_loc() │
│ 406 │ │ │ ) │
│ 407 │ │ log.message(f"Using Visual Studio at {opts.vs_install_path}") │
│ 408 │ │ output = self.__check_good_vs_install(opts, opts.vs_install_path, True) │
│ │
│ ╭───────────────────────────────── locals ──────────────────────────────────╮ │
│ │ opts = <gvsbuild.utils.base_project.Options object at 0x000001DAFAD449A0> │ │
│ │ self = <gvsbuild.utils.builder.Builder object at 0x000001DAFAA8D690> │ │
│ ╰───────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\Yihua.local\pipx\venvs\gvsbuild\lib\site-packages\gvsbuild\utils\builder.py:327 in │
│ __dump_vs_loc │
│ │
│ 324 │ │ ) │
│ 325 │ │ try: │
│ 326 │ │ │ completed_process.check_returncode() │
│ ❱ 327 │ │ │ vs_installs = json.loads(completed_process.stdout) │
│ 328 │ │ │ return self.__extract_paths(vs_installs) │
│ 329 │ │ except subprocess.CalledProcessError as e: │
│ 330 │ │ │ log.log(f"Unable to call vswhere.exe to find Visual Studio with error {e}") │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ completed_process = CompletedProcess(args=['C:\Program Files (x86)\Microsoft Visual │ │
│ │ Studio\Installer\vswhere.exe', '-all', '-products', '
', '-format', │ │
│ │ 'json', '-utf8'], returncode=0, stderr='') │ │
│ │ self = <gvsbuild.utils.builder.Builder object at 0x000001DAFAA8D690> │ │
│ │ vswhere = 'C:\Program Files (x86)\Microsoft Visual │ │
│ │ Studio\Installer\vswhere.exe' │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ E:\Program_Files\Python310\lib\json_init
.py:339 in loads │
│ │
│ 336 │ │ │ │ │ │ │ │ s, 0) │
│ 337 │ else: │
│ 338 │ │ if not isinstance(s, (bytes, bytearray)): │
│ ❱ 339 │ │ │ raise TypeError(f'the JSON object must be str, bytes or bytearray, ' │
│ 340 │ │ │ │ │ │ │ f'not {s.class.name}') │
│ 341 │ │ s = s.decode(detect_encoding(s), 'surrogatepass') │
│ 342 │
│ │
│ ╭───────── locals ─────────╮ │
│ │ cls = None │ │
│ │ kw = {} │ │
│ │ object_hook = None │ │
│ │ object_pairs_hook = None │ │
│ │ parse_constant = None │ │
│ │ parse_float = None │ │
│ │ parse_int = None │ │
│ │ s = None │ │
│ ╰──────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

However, the output of the command vswhere -all -products * -format json -utf8 is normal:

[
{
"instanceId": "4fd71066",
"installDate": "2022-03-29T16:13:19Z",
"installationName": "VisualStudio/17.4.1+33110.190",
"installationPath": "E:\Program Files\Microsoft Visual Studio\2022\Enterprise",
"installationVersion": "17.4.33110.190",
"productId": "Microsoft.VisualStudio.Product.Enterprise",
"productPath": "E:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": false,
"isRebootRequired": false,
"displayName": "Visual Studio Enterprise 2022",
"description": "面向任何规模团队提供的可缩放、端到端解决方案",
"channelId": "VisualStudio.17.Release",
"channelUri": "https://aka.ms/vs/17/release/channel",
"enginePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service",
"installedChannelId": "VisualStudio.17.Release",
"installedChannelUri": "https://aka.ms/vs/17/release/channel",
"releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.4#17.4.1",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
"updateDate": "2022-11-16T12:47:38.0091272Z",
"catalog": {
"buildBranch": "d17.4",
"buildVersion": "17.4.33110.190",
"id": "VisualStudio/17.4.1+33110.190",
"localBuild": "build-lab",
"manifestName": "VisualStudio",
"manifestType": "installer",
"productDisplayVersion": "17.4.1",
"productLine": "Dev17",
"productLineVersion": "2022",
"productMilestone": "RTW",
"productMilestoneIsPreRelease": "False",
"productName": "Visual Studio",
"productPatchVersion": "1",
"productPreReleaseMilestoneSuffix": "1.0",
"productSemanticVersion": "17.4.1+33110.190",
"requiredEngineVersion": "3.4.2244.14676"
},
"properties": {
"campaignId": "2030",
"channelManifestId": "VisualStudio.17.Release/17.4.1+33110.190",
"nickname": "",
"setupEngineFilePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe"
}
}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant