How do I install g++ 4.5 on ubuntu 10.10?

K. Frank kfrank29.c at gmail.com
Fri Nov 19 02:55:51 UTC 2010


Hi Mark -

On Thu, Nov 18, 2010 at 9:06 PM, Mark <mhullrich at gmail.com> wrote:
> On Thu, Nov 18, 2010 at 5:59 PM, K. Frank <kfrank29.c at gmail.com> wrote:
>>
>> That (mostly) did the trick.
>>
>> My first question:
>>
>> What is the difference between:
>>
>>   sudo apt-get install g++-4.5  (which seems to work)
>>
>> and
>>
>>   sudo apt-get install g++  (which installed 4.4)
>>
>> It never occurred to me to specify g++-4.5.  Is there some
>> sort of hierarchical naming convention going on?
>>
> Let's see now, suppose we rephrase the question as:
>
> A. What is the difference between package and package-newer?

Sorry, I should have stated my question more clearly.

Why does the plain "apt-get install g++" install 4.4?

I am sure that the package name "g++" is not a context-independent
synonym for the package g++-4.4.  Two years ago (or two years
hence) I seriously doubt that running "apt-get install g++" on a
freshly-installed, current-release ubuntu would have installed
g++ 4.4.  Hence my restated question.

>> Second question:
>>
>> How can I get g++ to resolve to version 4.5?
>>
>> The command g++ is not known (although g++-4.5 is), e.g.,
>>
>>   $ g++ --version
>>   The program 'g++' can be found in the following packages:
>>    * g++
>>    * pentium-builder
>>   Try: sudo apt-get install <selected package>
>>
>> while
>>
>>   $ g++-4.5 --version
>>   g++-4.5 (Ubuntu/Linaro 4.5.1-7ubuntu2) 4.5.1 ...
>>
>
> As above, suppose the question were this:
>
> B. How can I get package to resolve to package-newer?

You misunderstood the question.  To clarify:  How can I
get the command g++ (e.g., as typed in a terminal window,
as in the examples I gave above) to resolve to the executable
program g++-4.5?  Well, I know several ways to do this.
My point is, what is the right way to do this, in the context of
package management, and why didn't "apt-get install g++-4.5"
do it for me?

>
>> Third question:
>>
>> Not that I care, but suppose I had wanted to install
>> 4.5.1-10ubuntu1 (as I tried to do with dpkg)?  Why
>> did "apt-get install g++-4.5" resolve to 4.5.1-7?  Is
>> 4.5.1-10 not compatible with ubuntu 10.10?
>>
> I suspect that this question is basically irrelevant, but it lies
> along the same lines.

Well, suppose the question were relevant -- let's say there
were some bug fix, or something.

> ...
> The answer to your last question is that g++-4.5 is packaged up in the
> general gcc 4.5.1-7 package, not 4.5.1-10; i.e., they are not the same
> package.

This doesn't really make sense.  If you use dpkg-deb to look
inside gcc-4.5_4.5.1-7ubuntu2_i386.deb and
gcc-4.5_4.5.1-10ubuntu1_i386.deb, you will find that neither
contains g++-4.5 (they both contain gcc-4.5, but not g++).
However, g++-4.5_4.5.1-10ubuntu1_i386.deb does contain
g++, and, in particular, g++-4.5.

So, how would I install the g++-4.5_4.5.1-10ubuntu1_i386.deb
version of g++ if I wanted to?

>
> Hope that helps.

Yes it does.  I do think we're circling closer to some answers
here.


K. Frank




More information about the ubuntu-users mailing list