PDA

View Full Version : Changing default gcc?


Usenet User
21-03-2007, 07:24 AM
Platform: Ubuntu 6.10 (intel)
gcc: 4.1

Need to compile a large package (cross-compiler for arm) using an
older version of gcc (2.95, preferably). How do I switch to that
version?

I installed gcc-2.95 via Synaptic Package Manager, but what now?

Tried to use /usr/sbin/update-alternatives, but it does not allow for
that.

Any suggestions?

TIA!

Martin Vuille
21-03-2007, 07:54 AM
Usenet User <***@***.**> wrote in
news:il900356dpcb48cclckq08n6cl19aqh2eb@4ax.com:

> Platform: Ubuntu 6.10 (intel)
> gcc: 4.1
>
> Need to compile a large package (cross-compiler for arm) using
> an older version of gcc (2.95, preferably). How do I switch to
> that version?
>

Might depend on the specifics of the package that you want to
compile, but you can usually set environment variables to point the
Makefile to the right compiler: CC for the path to the C compiler,
CXX for the path to the C++ compiler, LDFLAGS for ld options, etc.

You may have to be careful about ensuring that the right set
of libraries are used in linking. That might mean disabling the
linking to the default libraries and explicitly enumerating the
libraries that correspond to the compiler version.

MV

--
I do not want replies; please follow-up to the group.

Usenet User
21-03-2007, 07:59 AM
On 20 Mar 2007 18:54:00 GMT, Martin Vuille <jpmv27@yahoo.com> wrote:

>Usenet User <***@***.**> wrote in
>news:il900356dpcb48cclckq08n6cl19aqh2eb@4ax.com:
>
>> Platform: Ubuntu 6.10 (intel)
>> gcc: 4.1
>>
>> Need to compile a large package (cross-compiler for arm) using
>> an older version of gcc (2.95, preferably). How do I switch to
>> that version?
>>
>
>Might depend on the specifics of the package that you want to
>compile, but you can usually set environment variables to point the
>Makefile to the right compiler: CC for the path to the C compiler,
>CXX for the path to the C++ compiler, LDFLAGS for ld options, etc.
>
>You may have to be careful about ensuring that the right set
>of libraries are used in linking. That might mean disabling the
>linking to the default libraries and explicitly enumerating the
>libraries that correspond to the compiler version.
>
>MV

I've heard of that, but the package is huge. Changing every Makefile
is a long story. Any way to do just a global switch?

Thanks!

Martin Vuille
21-03-2007, 08:25 AM
Usenet User <***@***.**> wrote in
news:fkb003l3h4qolb4ag8b4embcva9nmpp68l@4ax.com:

>
> I've heard of that, but the package is huge. Changing every
> Makefile is a long story. Any way to do just a global switch?
>

If the package supports the variables I mentioned earlier (or similar
ones) then you wouldn't have to change the Makefiles. You would
simply set their value in the environment or pass them as options to
the make or configure command.

Does the package include a README, INSTALL or similar file? Does it
say anything about this?

Does the package require you to run a script called "configure" as
the first step to building it? If so, then you may be able to do the
following:

./configure CC=whatever LDFLAGS=whatever (and so forth)

MV

--
I do not want replies; please follow-up to the group.

Usenet User
21-03-2007, 09:49 AM
On 20 Mar 2007 19:25:37 GMT, Martin Vuille <jpmv27@yahoo.com> wrote:

>If the package supports the variables I mentioned earlier (or similar
>ones) then you wouldn't have to change the Makefiles. You would
>simply set their value in the environment or pass them as options to
>the make or configure command.
>
>Does the package include a README, INSTALL or similar file? Does it
>say anything about this?
>
>Does the package require you to run a script called "configure" as
>the first step to building it? If so, then you may be able to do the
>following:
>
> ./configure CC=whatever LDFLAGS=whatever (and so forth)
>
>MV

That could help. Yet may take a while. I am quite new to all this, and
there a lot of settings to consider.

Martin Vuille
21-03-2007, 12:08 PM
Usenet User <***@***.**> wrote in
news:6ih003529rk9qok30765net846hs3jounu@4ax.com:

>
> That could help. Yet may take a while. I am quite new to all
> this, and there a lot of settings to consider.
>

Perhaps there is a mailing list or a help forum
where users of this package can get help?

MV

--
I do not want replies; please follow-up to the group.

Usenet User
22-03-2007, 07:59 AM
On 20 Mar 2007 23:08:01 GMT, Martin Vuille <jpmv27@yahoo.com> wrote:

>Usenet User <***@***.**> wrote in
>news:6ih003529rk9qok30765net846hs3jounu@4ax.com:
>
>>
>> That could help. Yet may take a while. I am quite new to all
>> this, and there a lot of settings to consider.
>>
>
>Perhaps there is a mailing list or a help forum
>where users of this package can get help?
>
>MV

Yep, I figured this out. CC=<compiler to use> does the trick.
Thanks again!