簡體   English   中英

snapcraft 給出“ascii”編解碼器無法解碼位置 0 中的字節 0xd0:序號不在范圍內(128)

[英]snapcraft gives 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

我嘗試在 snap 包中編譯 Qt 5.13,但在啟動時出現以下錯誤:

'NoneType' object has no attribute 'decode'

我認為這與底層python代碼中的一些國際化問題有關,因此嘗試更改構建順序,做了很多其他事情,但每次都返回上述錯誤。

以下是 snapcraft 文件:

name: vcs
version: '2.0'
summary: VCS GUI
description: |
  Maritime Robotics Vehicle Control System GUI
confinement: devmode
base: core18
layout:
   /usr/lib/vcs-gui/plugins:
      bind: $SNAP/usr/lib/vcs-gui/plugins

parts:

  desktop-qt5:
    source: https://download.qt.io/archive/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz
    plugin: dump
    override-build: |
      snapcraftctl build
      ./configure -opensource -confirm-license -debug -nomake examples  -nomake tests
      make
      make install
    override-prime: |
      locale-gen "en_US.UTF-8"
      update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
      snapcraftctl prime
    build-packages:
      - python
      - locales

  protobuf:
    source: https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protobuf-all-3.8.0.tar.gz
    plugin: autotools

  cmake:
    source: https://github.com/Kitware/CMake/releases/download/v3.15.0-rc1/cmake-3.15.0-rc1.tar.gz
    plugin: autotools

  libproj:
    source: http://download.osgeo.org/proj/proj-6.0.0.tar.gz
    plugin: autotools
    build-packages: 
      - libsqlite3-dev
      - sqlite3
      - libgl1-mesa-dev
      - libglu1-mesa-dev

  gdal:
    source: https://github.com/OSGeo/gdal/releases/download/v3.0.0/gdal-3.0.0.tar.gz
    plugin: autotools
    after: [libproj]

  ecc:
    source: https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.12.5-Source.tar.gz
    plugin: cmake
    configflags: [-DENABLE_FORTRAN=OFF]

  vcs:
    plugin: cmake
    configflags: [-DQt5Core_DIR=/usr/local/Qt-5.13.2/lib/cmake/Qt5Core,-DQt5_DIR=/usr/local/Qt-5.13.2/lib/cmake/Qt5,-DQT_QMAKE_EXECUTABLE=/usr/local/Qt-5.13.2/bin/qmake]
    source: https://github.com/fritzone/Qt-CMake-HelloWorld.git
    after: [protobuf,cmake,libproj,gdal,ecc,desktop-qt5]
    build-packages:
      - git
      - g++
      - make
      - libkml-dev
      - libarmadillo-dev
      - libgeographic-dev
      - libssl-dev
      - libconfig++-dev
      - libxml2-dev
      - libmodbus-dev
      - libev-dev
      - libudev-dev
      - libexiv2-dev
      - libv4l-dev
      - doxygen
      - graphviz
      - libgeotiff-dev
      - libgeos-dev 
      - libpng-dev
      - libbotan-2-dev
    stage-packages:
      - libbotan-2-4
      - libtspi1
      - libkmlconvenience1
      - libkmlbase1
      - libkmlengine1
      - libkmldom1
      - libssl1.0.0
      - libconfig++9v5
      - libxml2
      - libmodbus5
      - libev4
      - libaec0
      - libhdf4-0-alt
      - libsz2
      - libexiv2-14
      - libv4l-0
      - libgeotiff2
      - libsdl2-2.0-0
      - libxcb-xinerama0
      - libarmadillo8
      - libarpack2
      - libsuperlu5
      - libgeos-3.6.2
      - libgeos-c1v5

apps:
  vcs:
    command: bin/desktop-launch bin/vcs
    adapter: full
    command-chain: 
      - bin/desktop-launch
      - bin/vcs
    common-id: vcs-gui.desktop
    desktop: usr/share/applications/vcs-gui.desktop
    environment:
      "DISABLE_WAYLAND": "0"
    plugs: [x11, wayland, desktop, desktop-legacy, opengl, network, home]

這是我運行時從中得到的輸出:

SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G snapcraft --debug

(是的,由於編譯器在構建 Qt 時崩潰,它需要大約 8GB 的​​內存)

.
. // everything is fine till this point
.
Priming desktop-qt5 
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
'NoneType' object has no attribute 'decode'
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.

這是嘗試構建包的python腳本的堆棧跟蹤:

'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: View
Traceback (most recent call last):
  File "/snap/snapcraft/3440/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==3.8', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/_runner.py", line 103, in run
    snap_command.invoke(ctx)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/_command.py", line 87, in invoke
    return super().invoke(ctx)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 261, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 66, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 94, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 148, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 162, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 237, in _run_prime
    self._run_step(step=steps.PRIME, part=part, progress="Priming")
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 281, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 795, in prime
    self._do_runner_step(steps.PRIME)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 242, in _do_runner_step
    return getattr(self._runner, "{}".format(step.name))()
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 91, in prime
    "override-prime", self._override_prime_scriptlet, self._primedir
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 137, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 193, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 807, in _do_prime
    dependency_paths = self._handle_elf(snap_files)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 814, in _handle_elf
    elf_files = elf.get_elf_files(self.primedir, snap_files)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 576, in get_elf_files
    elf_file = ElfFile(path=path)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 219, in __init__
    elf_data = self._extract(path)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 252, in _extract
    interp_section = elf.get_section_by_name(_INTERP)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 94, in get_section_by_name
    for i, sec in enumerate(self.iter_sections()):
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 103, in iter_sections
    yield self.get_section(i)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 83, in get_section
    return self._make_section(section_header)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 288, in _make_section
    name = self._get_section_name(section_header)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 283, in _get_section_name
    return self._file_stringtable_section.get_string(name_offset)
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/sections.py", line 70, in get_string
    return s.decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
We would appreciate it if you anonymously reported this issue.

有沒有人對如何使其工作有任何想法? 請注意,由於 5.13 中修復了一些錯誤,使用默認基礎core18 (5.9) 附帶的 Qt 對我們的應用程序core18 ,因此我們至少需要 5.13。

它試圖構建的應用程序只是一個 helloworld 應用程序,它與我們得到的錯誤無關,但 snapcraft 需要它才能到達錯誤階段。

(如果您嘗試針對此文件運行 snapcraft,請小心,Qt 在我的計算機上需要 4 - 5 個小時來編譯)

在回溯中, get_string函數正在引發 UnicodeDecodeError,因為它無法從 ASCII 解碼某些文本。

在 elftools 的當前源代碼中,這一行已被替換為

return s.decode('UTF-8') is else ''

所以你可以嘗試升級與 snap 捆綁的 pyelftools 版本

<the python interpreter bundled with snap> -m pip install --upgrade pyelftools 

(確保您可以回滾,以防此升級實際上使事情變得更糟)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM