Cannot execute binary file: Exec format error

Hello everyone. A quick question regarding a snap app that I make. So far everything worked correctly. I have a few stable versions, but the last one that I published to the store is giving me an error and I cannot find what’s wrong

/snap/phockup/34/phockup.sh: line 9: /snap/phockup/34/usr/bin/python3: cannot execute binary file: Exec format error
/snap/phockup/34/phockup.sh: line 9: /snap/phockup/34/usr/bin/python3: Success

And this is the phockup.sh file (#9 is the last line):

The Exec format error rings a bell of wrong architecture. Can you check the architecture of $SNAP/usr/bin/python3?

You also might want to switch to UTF-8 when using python3, for that set LC_ALL to C.UTF-8 which you can do from an environment entry in your apps entry so that it looks like

apps:
  phockup:
    command: phockup.sh
    environment:
        - LC_ALL=C.UTF-8
    plugs: [home]

I cannot run the python3 binary in the installed snap directory.
/snap/phockup/36/usr/bin ➜ ./python3 bash: ./python3: cannot execute binary file: Exec format error

what is the output of:

file /snap/phockup/36/usr/bin/python3

it should tell which architecture it is built for …
(if it reports “symbolic link”, follow the link and call the file command on that file)

/snap/phockup/34/usr/bin/python3.5: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=66fcf0aec37edd2cdbc511f5901a81ae5b1f19b3, stripped

That’ is weird. Why it isn’t amd64?
PS: The latest snap that I published is working fine now when I changed the snapcraft.yaml to this:

apps:
  phockup:
    command: env LC_ALL=C.UTF-8 LANG=C.UTF-8 $SNAP/phockup.sh
    plugs: [home]

Well no. I just released a stable version, installed it locally and the same error occurs.

are you using build.snapcraft.io ? it actually builds fo amd64 and armhf (there is a bug making it ignore the “architectures” field), you might have released the wrong thing by accident …

Yes, I am using build.snapcraft.io and I release the versions from dashboard.snapcraft.io
I think this is the problem too, because when I install the locally built snap with --dangerous it works perfectly.

Where I can specify the version amd64/armhf in dashboard.snapcraft.io to release as stable?

I actually don’t remember the commands to publish & release the snap from cli.

the uploads summary (as well as the overview on the front page of dashboard.s.i) should list the arches … just unpublish the armhf ones and publish the amd64 versions … (though it is still weird, you shuld not be able to install an armhf binary on an amd64 machine)

I am seeing only amd64 builds

wow, that smells like a snapcraft bug … though looking at https://github.com/ivandokov/phockup/blob/master/snapcraft.yaml i dont really see how it could ever pull in armhf binaries unless the build machine is armhf. perhaps @sergiusens has an idea ?

I am using elementaryOS based on Ubuntu 16.04 and it is 64 bit for sure.

It is because of the architectures: [amd64] entry here https://github.com/ivandokov/phockup/blob/master/snapcraft.yaml#L10

I guess the architectures directive says which one the snap supports. Isn’t it correct like it is now?
Should I remove it entirely?
How come specifying amd64 only makes armhf build too and that affects the installation of the snap.

Remove that entry, that entry means, no matter what is built, make it amd64.

Removing it solved the issue. Thanks!
Although I don’t see a case when one will actually need it.

It is useful for when one is using prebuilt binaries.