Unix Programming - How to override compiler

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2006 > How to override compiler





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to override compiler
seema

2006-01-20, 2:50 am

Hi all,

I am new to Unix programming. I am working in HP-UX B.11.23 ia 64 box.
I have
aCC 5.55 compiler installed in "/opt/aCC/bin/". But I want to use aCC
6.05, so
I installed aCC 6.05 in "/home/acc6/opt/aCC/bin". Now I want to use
6.05 for my
builds(make) but I dont know how to use 6.05 because if i type,

$which aCC
/opt/aCC/bin/aCC -> it gives 5.55

And also if i build some thing it takes aCC 5.5 by default.
Is it possible to use 6.05 for the builds by setting some environment
variable?
Because it always common that you have two versions of compiler
installed on
your OS and you want to use them based on your requirement. Can some
body
explain how to do it.

Thanks in advance,
Seema Rao

Logan Shaw

2006-01-20, 2:50 am

seema wrote:

> I am new to Unix programming. I am working in HP-UX B.11.23 ia 64 box.
> I have
> aCC 5.55 compiler installed in "/opt/aCC/bin/". But I want to use aCC
> 6.05, so
> I installed aCC 6.05 in "/home/acc6/opt/aCC/bin". Now I want to use
> 6.05 for my
> builds(make) but I dont know how to use 6.05 because if i type,
>
> $which aCC
> /opt/aCC/bin/aCC -> it gives 5.55
>
> And also if i build some thing it takes aCC 5.5 by default.
> Is it possible to use 6.05 for the builds by setting some environment
> variable?


That's what the PATH environment variable is for.

By the way, avoid using "which". It will give wrong answers in certain
cases. Try using "type" instead. (If you are using csh, then which
might be useful.)

Try this:

type aCC
PATH="/home/acc6/opt/aCC/bin:$PATH"
export PATH
type aCC

Alternatively, you can just run the executable directly with its
full path. Just type "/home/acc6/opt/aCC/bin/aCC" instead of "aCC".

- Logan
Fletcher Glenn

2006-01-20, 6:03 pm

Logan Shaw wrote:
> seema wrote:
>
>
>
> That's what the PATH environment variable is for.
>
> By the way, avoid using "which". It will give wrong answers in certain
> cases. Try using "type" instead. (If you are using csh, then which
> might be useful.)
>
> Try this:
>
> type aCC
> PATH="/home/acc6/opt/aCC/bin:$PATH"
> export PATH
> type aCC
>
> Alternatively, you can just run the executable directly with its
> full path. Just type "/home/acc6/opt/aCC/bin/aCC" instead of "aCC".
>
> - Logan


Alternatively, you can specify in your makefile:

CCC=/home/acc6/opt/aCC/bin

Yes I did type CCC above. This tells make to use
the indicated compiler. See the file:
/usr/share/lib/make/make.rules which is loaded into
make before your makefile.

--

Fletcher Glenn

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com