Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 157990 - invalid comparison in glibc-2.3.2 (glibc_setup) to determine 'old' gcc version
Summary: invalid comparison in glibc-2.3.2 (glibc_setup) to determine 'old' gcc version
Status: VERIFIED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-13 00:45 UTC by Christopher Friedt
Modified: 2008-01-18 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Friedt 2006-12-13 00:45:14 UTC
when compiling glibc-2.3.2-r12 (i need this for cross compiling), the build dies complainging that the version of gcc being used is too old when using GCC-4.1.1. This is because the comparison statement is logically not correct. 

The file causing the problem is 

/var/tmp/cross/arm-9tdmi-linux-gnu/portage/glibc-2.3.2-r12/temp/environment

An excerpt looks like:

glibc_setup () 
{ 
    if [ "`gcc-major-version`" -ne "3" -o "`gcc-minor-version`" -lt "2" ]; then
        echo;
        eerror "As of glibc-2.3, gcc-3.2 or later is needed";
        eerror "for the build to succeed.";
        diefunc "$FUNCNAME" "$LINENO" "$?" "GCC too old";
    fi;
...

The correct comparison should be:

glibc_setup () 
{ 
    if [ "`gcc-major-version`" -lt "3" -o 
         "`gcc-major-version`" -eq "3" -a "`gcc-minor-version`" -lt "2" ]; then
        echo;
        eerror "As of glibc-2.3, gcc-3.2 or later is needed";
        eerror "for the build to succeed.";
        diefunc "$FUNCNAME" "$LINENO" "$?" "GCC too old";
    fi;
...

I'd fix the file / ebuild itself, but I have no idea to which file it belongs in /usr/portage/distfiles. ... also, it's probably a good idea to put braces around the sencond conditional term (they aren't _really_ needed) but I don't know the proper bash syntax for that.

Note, if gcc-3.4.6 for example is installed, the user can simply gcc-config [x] to 3.4.6 and then build with that compiler. I had to completely emerge 3.4.6 to do that though, so this simple fix (in some mystery ebuild) probably could have saved me some time.

Thanks for looking after things
Comment 1 Christopher Friedt 2006-12-13 00:53:29 UTC
hmm... i suppose instead of 

[ x -lt y -o x -eq y -a z -lt w ] 

it could be done with

[ x -le y -a z -lt w ]

but [ x -ne y ] is definitely incorrect
Comment 2 SpanKY gentoo-dev 2006-12-13 09:57:24 UTC
you cant use glibc-2.3.2 for cross-compiling ... in fact, trying to do so will destroy your system
Comment 3 Christopher Friedt 2006-12-13 10:15:13 UTC
really? why then is my binary arm toolchain built with glibc-2.3.2 ? 

http://www.seiner.com/ts7000/index.php/CrossCompileTools

The glibc version that is being used on the workstation is glibc-2.4, the glibc on the board is version 2.3.2, with a 2.4.26 kernel and gcc-3.4.4 . Maybe that wasn't clear before.

In any event, I've fixed the problem myself. If you'd like to apply the change, feel free.
Comment 4 SpanKY gentoo-dev 2006-12-13 11:33:37 UTC
our ebuilds do not support cross-compiling in those old versions and they probably wont ever
Comment 5 Christopher Friedt 2007-11-16 14:00:21 UTC
Correct Comparison:

glibc_setup () 
{ 
    if [ "`gcc-major-version`" -lt "3" -o 
         "`gcc-major-version`" -eq "3" -a "`gcc-minor-version`" -le "2" ]; then
        echo;
        eerror "As of glibc-2.3, gcc-3.2 or later is needed";
        eerror "for the build to succeed.";
        diefunc "$FUNCNAME" "$LINENO" "$?" "GCC too old";
    fi;

Even though the ebuilds will not build with this verion, it still isn't good practice to sacrifice correctness.

(In reply to comment #0)
> when compiling glibc-2.3.2-r12 (i need this for cross compiling), the build
> dies complainging that the version of gcc being used is too old when using
> GCC-4.1.1. This is because the comparison statement is logically not correct. 
> 
> The file causing the problem is 
> 
> /var/tmp/cross/arm-9tdmi-linux-gnu/portage/glibc-2.3.2-r12/temp/environment
> 
> An excerpt looks like:
> 
> glibc_setup () 
> { 
>     if [ "`gcc-major-version`" -ne "3" -o "`gcc-minor-version`" -lt "2" ]; then
>         echo;
>         eerror "As of glibc-2.3, gcc-3.2 or later is needed";
>         eerror "for the build to succeed.";
>         diefunc "$FUNCNAME" "$LINENO" "$?" "GCC too old";
>     fi;
> ...
> 
> The correct comparison should be:
> 
> glibc_setup () 
> { 
>     if [ "`gcc-major-version`" -lt "3" -o 
>          "`gcc-major-version`" -eq "3" -a "`gcc-minor-version`" -lt "2" ]; then
>         echo;
>         eerror "As of glibc-2.3, gcc-3.2 or later is needed";
>         eerror "for the build to succeed.";
>         diefunc "$FUNCNAME" "$LINENO" "$?" "GCC too old";
>     fi;
> ...
> 
> I'd fix the file / ebuild itself, but I have no idea to which file it belongs
> in /usr/portage/distfiles. ... also, it's probably a good idea to put braces
> around the sencond conditional term (they aren't _really_ needed) but I don't
> know the proper bash syntax for that.
> 
> Note, if gcc-3.4.6 for example is installed, the user can simply gcc-config [x]
> to 3.4.6 and then build with that compiler. I had to completely emerge 3.4.6 to
> do that though, so this simple fix (in some mystery ebuild) probably could have
> saved me some time.
> 
> Thanks for looking after things
> 

Comment 6 SpanKY gentoo-dev 2007-11-17 05:43:28 UTC
it's dead code ... it's going to get punted ... no point in wasting time on it

if you need old glibc versions, the crosstool package should work for you