0

I'm a 1 week long linux user.

I've added

export PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin

to .bashrc for friendlyarm project and it works nice. The arm-linux-gcc -v command shows me details.

When I use make modules command in linux-2.6.38 source folder to compile, gives "permission denied" errors. So I use sudo make modules but it doesn't recognize arm-linux-gcc it says:

make: arm-linux-gcc: Command not found

So I have to use su and just use make modules as root, everything works.

Why doesn't it recognize the path that I've added to .bashrc when I use sudo? Is it normal?

muru
  • 193,181
  • 53
  • 473
  • 722
  • possible duplicate of [Environment variables when run with 'sudo'](http://askubuntu.com/questions/57915/environment-variables-when-run-with-sudo) – muru Apr 30 '15 at 08:49

1 Answers1

0

Use sudo -E instead of sudo to preserve your modified PATH. Otherwise PATH isn't preserved and thus arm-linux-gcc can't be found (see man sudo for details and possible permanent fixes).

If that doesn't work try sudo env PATH=/path/to/gcc:$PATH make target.

Kalle Richter
  • 5,935
  • 20
  • 69
  • 101
  • Still nothing.. same error "sudo -E make modules" results "make: arm-linux-gcc: Command not found" – Serhat Türkman Apr 30 '15 at 09:03
  • @SerhatTürkman Does `sudo PATH="$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin" make modules` also fail to find `arm-linux-gcc`? If so, I recommend adding this information to your question (by editing it), so it doesn't get wrongly closed as a duplicate of [that other question](http://askubuntu.com/questions/57915/environment-variables-when-run-with-sudo). – Eliah Kagan May 02 '15 at 18:53