Re: Troubleshooting with gcc 4.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/09/2011 07:50 PM, Ian Lance Taylor wrote:
> santi <salcubo@xxxxxxxxx> writes:
> 
>> I recently updated my Ubuntu 10.10 to 11.10 and since then I have been
>> having problems with my compiler. I have seen that this new Ubuntu
>> distribution uses gcc 4.6 whilest my old 10.10 used gcc 4.4.5 or
>> 4.4.6.
>>
>> The main problem I have nowadays is with the math.h library when I
>> need to use functions as sqrt() or pow() that I used to use without
>> any problem in the old distribution (well, I had to write the -lm
>> option when I tried to compile my source files but it did run
>> perfectly). Today I'm getting and unresolve refernce to 'sqrt' when I
>> comile my files even though I'm using the -lm option.

this is caused by passing --as-needed by default to the linker. Make sure to
pass libraries on the command line behind objects (you need the symbol
referenced before the definition is found). You'll likely find this issue on
OpenSuse releases (it may be enabled for package builds only).

> This question is not appropriate for the mailing list gcc@xxxxxxxxxxx.
> It would be appropriate for gcc-help@xxxxxxxxxxx.  Please take any
> followups to gcc-help.  Thanks.
> 
> When asking a question of this sort, it helps a lot if you show us
> precisely what you did and precisely what happened.  Without seeing
> that, I am going to guess that you are running into multiarch libraries.
> Debian, and therefore Ubuntu, decided to move the system libraries from
> the locations where all GNU/Linux distros have put them for many years.
> They have updated their own versions of gcc, but the mainstream gcc
> releases have not been updated.
> 
> This is going to be an ongoing problem for many years for people who use
> Debian or Ubuntu.  I do not know how to resolve it.

This is not a multiarch issue. Passing --as-needed by default to the linker was
enabled in the Ubuntu 11.10 release, which is one month old [1].

Even multiarch is only seven month old (first appeared in Ubuntu 11.04), so I
honestly can't see any justification for your "many years" statement.

Yes, I do need to re-submit the updated multiarch patch.

  Matthias

[1]
https://wiki.ubuntu.com/OneiricOcelot/ReleaseNotes?action=show&redirect=OneiricOcelot%2FTechnicalOverview#GCC_4.6_Toolchain


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux