"Unable to parse ELF file" during Snap priming stage

I’m currently trying to build a proof-of-concept Snap for DaVinci Resolve (I know, it relies on OpenCL/CUDA so won’t work confined until there are appropriate plugs provided, but I wanted to try anyway).

I’m hitting a blocking issue very early on in the testing phase as snapcraft is quitting out when trying to parse one of the ELF binaries inside the package.

Pulling davinci-resolve                                                         
Building davinci-resolve 
Staging davinci-resolve 
Priming davinci-resolve 
Unable to parse ELF file '/root/prime/opt/resolve/bin/deviceQuery': ('missing terminator', FieldError('expected 1, found 0',))

I can’t find much more info on this error, and searching “Unable to parse ELF file” brings up no results on this forum.

It seems like this might be down to the invalid-elf test worked introduced by @cjp256 into Snapcraft 3.8.

Is this something I can fix, or is it actually a corrupt/malformed ELF binary that would need to be fixed upstream before it’s worth me trying to move forward with the project?


(Incredibly alpha) Snapcraft.yaml file to reproduce
The .deb file I’m staging with here is produced by running the CentOS-targeted DaVinci .run file from Blackmagic Design through makeresolvedeb which builds a deb package.

name: davinci-resolve
version: 16.2.1-1
summary: Video editor
description: |
  More words go here.
confinement: devmode
base: core18

parts:
  davinci-resolve:
    plugin: dump
    source: davinci-resolve_$SNAPCRAFT_PROJECT_VERSION_amd64.deb
    override-pull: |
      snapcraftctl pull
      ln -sf ../libs/libBlackmagicRawAPI.so opt/resolve/bin/libBlackmagicRawAPI.so
      ln -sf ../../libs/libBlackmagicRawAPI.so opt/resolve/bin/BlackmagicRawAPI/libBlackmagicRawAPI.so

apps:
  davinci-resolve:
    command: resolve

p.s. I’m aware that the license for Resolve almost certainly means I can’t redistribute the Snap myself via the store, but the idea would be to get the Snapcraft.yaml file working and offer it to the upstream developers for them to work with.

Coincidentally, I PR’d a potential fix for this yesterday if you want to give it a spin:
sudo snap refresh snapcraft --channel edge/pr-3111

2 Likes

This solved it!

There’s still definitely a long way to go before I get this snap working, but this PR solves the issue I was having yesterday.

As an aside - wow, I really love how easy the channel model that Snaps use makes it to test out a PR or upstream release that might fix a particular issue. Nice.

2 Likes