1

I am new at Linux and I am facing a problem. I am trying to add the bin directory to the PATH in the Linux executing the command below:

$ export PATH="/opt/gcc-arm/bin:$PATH"

However, when I try to execute a command it returns me it was not found

Command 'arm-none-eabi-gcc' not found, but can be installed with:
sudo apt install gcc-arm-none-eabi

How could I add this directory to Linux PATH or there is a way to access the User variables from Windows using the Linux?

Edit1: I just run $PATH and I got this:

bash: /opt/gcc-arm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program:

The Path to the file that I created is there (/opt/gcc-arm/bin), but I do not understand why the system cannot recognize it.

Edit2: I executed the command suggested by @steeldriver

what is the result of file /opt/gcc-arm/bin/arm-none-eabi-gcc run

The result is: /opt/gcc-arm/bin/arm-none-eabi-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.24, BuildID[sha1]=7af6e16f1d030393cdf4a6e6007a0e554470f126, stripped. But I have no idea what it means.

Edit3: Now the things start to work, first I use the command sudo -s and then

$ export PATH="/opt/gcc-arm/bin:$PATH".

After doing that I was able to run the commands from that PATH, however, when I close the Linux env and open again, it can not recognize those commands, so I have to include the PATH again. Is there some solution to avoid entering the PATH every time when I reopen the Linux?

Edit4: I followed this tutorial from Youtube Linux: Permanently set environment variables, now my PATH is permanent.

I hope this can help someone else that face this same problem

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • Welcome to [ubuntu.se]! Have you executed the arm-none-eabi-gcc command in the same windows where you issued the export command? Is the file present in the path you added? – Melebius Nov 20 '19 at 12:42
  • @Melebius, yes the file is present in the file even in the Windows as in the Linux and I executed it on Windows, it ran without issue. – Geisterfahrer Nov 20 '19 at 13:06
  • @Melebius, first I worked with those commands on Windows, the path to them in Windows are C:\Users\arge10\Documents\stm32\opt\bin and worked perfectly.

    Today I migrated to Linux, I created the same file on Linux environment in /opt/gcc-arm/bin. I tried to add this to Linux PATH, but no success running tthat command. I just ran $PATH on Linux and I got: bash: /opt/gcc/arm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program:

    – Geisterfahrer Nov 20 '19 at 13:22
  • 1
    How exactly did you create the file(s) in /opt/gcc-arm/bin? what is the result of file /opt/gcc-arm/bin/arm-none-eabi-gcc ? – steeldriver Nov 20 '19 at 13:33
  • 1
    @steeldriver, So I downloaded it as .tar.bz2 file, then I moved it to the current file and extract it there using command tar xjf. This command you mentioned returned: /opt/gcc-arm/bin/arm-none-eabi-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.24, BuildID[sha1]=7af6e16f1d030393cdf4a6e6007a0e554470f126, stripped – Geisterfahrer Nov 20 '19 at 13:51
  • @GustavoDaSilvaGhedim Welcome to Ask Ubuntu! The best way to add additional information to your question is by editing it, with the [edit] button. It is better visible that way, and comments are mainly for secondary, temporary purposes. Comments are removed under a variety of circumstances. Anything important to your question should be in the question itself. – guntbert Nov 23 '19 at 21:57

1 Answers1

-1

As the output suggests, you should run the following in your terminal (if you have not already tried doing so):

sudo apt install gcc-arm-none-eabi
Eliah Kagan
  • 117,780
  • @ITGremlin this file is from a repository on Github, cannot be installed using (sudo apt install) – Geisterfahrer Nov 20 '19 at 13:30
  • @gustavo-da-silva-ghedim Does this help? – IT Gremlin Nov 20 '19 at 14:39
  • @ITGremlin, It does not help, however, when I enter sudo - s and then I export the PATH to the desired folder those commands I won't work perfectly, the problem now is when I close the Linux environment and reopen it, it does not recognize the PATH that I added, so I have to enter it again every time I open the Linux. – Geisterfahrer Nov 21 '19 at 05:32