swift-arm64 icon indicating copy to clipboard operation
swift-arm64 copied to clipboard

can not execute binary file

Open DharmeshRathod712 opened this issue 3 years ago • 9 comments

I have successfully installed swift and vapor using sudo apt install swiftlang vapor on UBUNTU (raspberry pi). But the problem is when I check swift version using swift --version it shows following line in terminal -bash: /usr/share/swift/usr/bin/swift: cannot execute binary file: Exec format error I don't know what is the problem.

DharmeshRathod712 avatar Oct 21 '20 05:10 DharmeshRathod712

@DharmeshRathod712 can you tell me which Ubuntu OS version you have installed and which Raspberry Pi model. Thanks.

futurejones avatar Oct 21 '20 05:10 futurejones

@DharmeshRathod712 can you tell me which Ubuntu OS version you have installed and which Raspberry Pi model. Thanks.

I am using Raspberry Pi 3B+ and the details of UBUNTU version I have installed are as follows

Distributor ID: Ubuntu (64 bit) Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

DharmeshRathod712 avatar Oct 21 '20 05:10 DharmeshRathod712

@DharmeshRathod712 I have just done a fresh install and test on both the Raspberry Pi 3 and 3+ 64bit Ubuntu Focal from here - https://ubuntu.com/download/raspberry-pi

I did not find any problems or issues.

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.4.0-1015-raspi #15-Ubuntu SMP Fri Jul 10 05:34:24 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@ubuntu:~$ swift --version
Swift version 5.3 (swift-5.3-RELEASE)
Target: aarch64-unknown-linux-gnu
ubuntu@ubuntu:~$ vapor --help
Usage: vapor <command>

Vapor Toolbox (Server-side Swift web framework)

Commands:
       build Builds an app in the console.
       clean Cleans temporary files.
      heroku Commands for working with Heroku
         new Generates a new app.
         run Runs an app from the console.
  supervisor Commands for working with Supervisord
       xcode Opens an app in Xcode.

Use `vapor <command> [--help,-h]` for more information on a command.
ubuntu@ubuntu:~$ 

Can you post your output from uname -a ?

futurejones avatar Oct 21 '20 08:10 futurejones

Just checking, you added this repository - https://packagecloud.io/swift-arm/release Before running sudo apt install swiftlang vapor ?

futurejones avatar Oct 21 '20 08:10 futurejones

I have already added the mentioned repo before running sudo apt install swiftlang vapor. Also the output of uname -a is as follows.

Linux ubuntu 5.4.0-1022-raspi #25-Ubuntu SMP PREEMPT Thu Oct 15 13:31:49 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

The weird thing I noticed about swift --version command was that I had to prefix it with sudo. In that case it prints the swift version properly on the terminal. But I think it should not be the case if I am not wrong.

DharmeshRathod712 avatar Oct 21 '20 09:10 DharmeshRathod712

That is really strange, you shouldn't need sudo. But this does indicate that swift was installed successfully. Are you still using the user ubuntu? or have you created a new user? I would suggest trying a fresh install Ubuntu and see if that fixes the problem.

futurejones avatar Oct 21 '20 09:10 futurejones

I am using ubuntu user only. No new user is created. I have already installed the UBUNTU twice or thrice 😅. First time I was facing this issue so I installed it again 😬. Could it be related to setting a PATH (environment) variable for swift 🤔?

DharmeshRathod712 avatar Oct 21 '20 10:10 DharmeshRathod712

I have never had this problem so I am not sure why it could be happening. Can you tell me bit more info on how you are setting up your Pi? What are you using to install Ubuntu onto the micro SD card? Software, Mac, Windows, etc. Are you accessing the Pi directly via keyboard or remotely via ssh? What is the output of ls -l /usr/bin/swift?

Also try installing swift 5.2.5 and see if that works - sudo apt-get install swiftlang=5.2.5-1-ubuntu-focal

futurejones avatar Oct 21 '20 13:10 futurejones

To Flash a SDCard I am using Raspberry Pi Imager from which I am using 64bit version of UBUNTU. I am using it from Mac machine. Also I am accessing Pi using ssh . Below is the output of command ls -l /usr/bin/swift

-rwxr-xr-x 1 root root 133822672 Sep 17 03:34 /usr/bin/swift

Even after downgrading the swift version from 5.3-1-ubuntu-focal to 5.2.5-1-ubuntu-focal, problem still persist.

DharmeshRathod712 avatar Oct 24 '20 07:10 DharmeshRathod712