'NullSection' object has no attribute 'get_string' error when building snap


#1

Hi All,

Trying to build my first snap, and I’ve encountered an error that I can’t work out. When trying to build the snap I get an error ‘NullSection’ object has no attribute ‘get_string’:

~/g/anypointsnap> snapcraft --debug
Launching a VM.
Skipping pull packages (already ran)                                            
Skipping pull anypoint (already ran)
Skipping build packages (already ran)
Skipping build anypoint (already ran)
Skipping stage packages (already ran)
Skipping stage anypoint (already ran)
Skipping prime packages (already ran)
Priming anypoint 
'NullSection' object has no attribute 'get_string'

I’ve found a traceback in /tmp:

/tmp> cat  snapcraft_provider_traceback.14423
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 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_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 263, in _extract
    for tag in dynamic_section.iter_tags("DT_NEEDED"):
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/dynamic.py", line 135, in iter_tags
    yield DynamicTag(tag, self._get_stringtable())
  File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/dynamic.py", line 51, in __init__
    stringtable.get_string(self.entry.d_val))
AttributeError: 'NullSection' object has no attribute 'get_string'

I’m not sure what this error is talking about or which string I’m missing. Here’s my snapcraft.yaml for reference:

name: anypointstudio # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.1-7.3.5' # just for humans, typically '1.2+git' or '1.3.2'
summary: Trying to make AnyPointStudio work on 19.04 # 79 char long summary
description: |
  AnyPointStudio
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

apps:
  anypoint:
    command: app/AnypointStudio

parts:
  packages:
    plugin: nil
    stage-packages:
    - openjdk-8-jdk
    - libwebkitgtk-1.0-0
  anypoint:
    after: [ packages ]
    plugin: dump
    source: "AnypointStudio-for-linux-64bit-7.3.5-201909031749.tar.gz"
    organize:
      '*': app/
  #my-part:
    #See 'snapcraft plugins'
    #plugin: nil

It’s probably something simple, but I’m not sure where it’s going wrong. Does anyone see anything obvious?


#2

Does this only happen on a rerun?