4

This is my very first question in this forum. Sorry for my bad english, please advise if it is not the right place to do it.

I've tried to install Swift for Ubuntu 19.04 on Termux App for Android following the answer of another question in this Forum: (How can I install Swift on Ubuntu 19.04?).

The reason is to continue compiling code offline while I'm in a plane or without internet connection. The steps followed are shown below (in short):

1- Since there is no way to install Swift for Ubuntu 19.04 I downloaded this file for version 18.04 as recommended (swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-30-a-ubuntu18.04.tar.gz).

2- Extracted the file and copied the folder to home directory in order to run locally.

3- Added the path to Swift with the following command which didn't work:

$ export PATH="/home/your-username/swift/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-30-a-ubuntu18.04/usr/bin:$PATH"  
$ source ~/.bashrc

4-Then I made amendments found in the web in order to write .bashrc:

$ echo "export PATH=/home/myusername/swift/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-30-a-ubuntu18.04/usr/bin:$PATH" >> ~/.bashrc
$ source ~/.bashrc

5-The output writed in the end of .bashrc file was this:

export PATH=/home/user-name/swift/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-30-a-ubuntu18.04/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

6- Then I tried to run Swift in terminal and I got this error message:

$ swift                       
bash: swift: command not found

For me it seems that the echo command appended the swift-4.2.../usr/bin path along with the others PATHs already set up in Ubuntu's Termux separate by collon, yet it doesn't allow me to call Swift REPL from Terminal.

Please help, thanks

Edit: my environment

  • Xiaomi Redmi Note 4x - processor 64-bit ARMv8-A
  • Termux App:

    $ uname -a Linux localhost 3.18.31-perf-g653a83a #1 SMP PREEMPT Mon Jan 28 10:05:53 WIB 2019 aarch64 Android

  • About PRoot package for Termux:

    Package: proot

    Description: Emulate chroot, bind mount and binfmt_misc for non-root users

    Homepages: https://proot-me.github.io

    https://github.com/proot-me/PRoot

    PRoot is a user-space implementation of chroot, mount --bind, and binfmt_misc. This means that users don't need any privileges or setup to do things like using an arbitrary directory as the new root filesystem.
    
    
    The benefits of enabling PRoot include running Linux operating systems in a Termux chroot on an Android smartphone and tablet, and Chromebook. 
    
  • Ubuntu distribution installed (source: https://wiki.termux.com/wiki/Ubuntu):

    root@localhost:~# uname -a Linux localhost 3.18.31-perf-g653a83a #1 SMP PREEMPT Mon Jan 28 10:05:53 WIB 2019 aarch64 aarch64 aarch64 GNU/Linux

    root@localhost:~# cat /etc/*-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=19.04 DISTRIB_CODENAME=disco DISTRIB_DESCRIPTION="Ubuntu 19.04" NAME="Ubuntu" VERSION="19.04 (Disco Dingo)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 19.04" VERSION_ID="19.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=disco UBUNTU_CODENAME=disco

Is there a way to emulate it with Qemu? If yes, can you guide me?

Thanks

didica
  • 51
  • 4
  • 1
    1. What happens when you run the binary directly from the extracted folder? 2. A binary compiled for 32 bit/64 bit processor will not work in the mobile phone. – Archisman Panigrahi Oct 13 '19 at 03:14
  • Although I can see the file if I issue $ ls in swift-4.2..../usr/bin, when I call it with $ swift it shows me "no such a file or directory". 2. I got it tks, besides is there a way to emulate it? – didica Oct 13 '19 at 12:27
  • `chmod u+x path/to/swift/executable` will make it executable, though it will still fail to work if it's not compatible with your system. – l3l_aze Jun 30 '20 at 20:43
  • @l3l_aze almost a year ago Archisman Panigrahi advise me about the difference of the processors since then I'm waiting for a fully-supported official version of Swift for ARM. I found in GitHub some Swift for ARM projects, but they lack some stuff. Thx anyway! – didica Jul 03 '20 at 00:14

1 Answers1

1

Thanks to @Archisman Panigrahi I realized that my system and the Swift binaries were from different architecture types. I found in GitHub some Swift for ARM projects, but they lack some stuff, so I'm waiting for a fully-supported official version of Swift for ARM.

didica
  • 51
  • 4