You're getting confused by a few things:
which
does not reflect aliases. So when you're trying to check if an alias was made, using which
won't help you. Run alias
without arguments instead; it'll show all the aliases in effect. Example:
anthony@Zia:~$ foo
bash: foo: command not found
anthony@Zia:~ [$?=127]$ alias foo='echo hi'
anthony@Zia:~$ foo
hi
anthony@Zia:~$ which foo
anthony@Zia:~ [$?=1]$
Aliases affect the shell, not other things. When make
, eclipse
, etc. attempt to run gcc
, shell aliases will not matter. You also can only export variables, not aliases. Here is an example (again with that foo alias) of perl trying to run it:
anthony@Zia:~$ perl -Mautodie=system -E 'system("foo")'
"foo" failed to start: "No such file or directory" at (eval 6) line 12.
at -e line 1
Most things that compile things run cc
, c++
, etc., not gcc
. So even if you had overridden gcc
, it probably wouldn't have worked.
So, how to accomplish this?
The best approach is to tell make
, etc. which compiler to use:
make CC=/path/to/myrtgcc target
You can also pass that in the environment when running /.configure
for programs that use autoconf.
The second approach is to create simple shell scripts called gcc
, cc
, etc. in (for example) ~/bin
and put that first in your path. The scripts would look something like this:
#!/bin/sh
exec /path/to/myrtgcc "$@"
and you'd put them first in PATH using something like this in your .bashrc
:
PATH="$HOME/bin:$PATH"
export PATH
.bash_profile
is ever being sourced automatically? If you are using, e.g.,lightdm
as your display manager, it does not happen: http://unix.stackexchange.com/questions/131320/profile-is-not-sourced-in-debian-wheezy-lxde/131326#131326 <- applies to.bash_profile
as well. – goldilocks Jun 13 '14 at 16:14export
an alias (FWIK);alias
es are local to the current shell. You can export environment variables only. – Rmano Jun 13 '14 at 16:51