Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] GCC version detection in toolchain/gcc/Makefile.in
@ 2007-03-29 14:36 Zachary P. Landau
  2007-03-30 18:34 ` Bernhard Fischer
  0 siblings, 1 reply; 5+ messages in thread
From: Zachary P. Landau @ 2007-03-29 14:36 UTC (permalink / raw)
  To: buildroot

Hello,

I think there may be a problem in the GCC version detection code
inside of toolchain/gcc/Makefile.in, but I wanted to verify it with
people before filing a bug.  I am looking at the latest checkin of
Makefile.in (revision 17836).

Inside of that file, it uses the line: "ifeq ($(findstring
3.4.,$(GCC_VERSION)),3.4.)" to detect gcc version 3.4.X.  But then a
few lines down, in a separate ifeq, it uses the line: "ifeq
($(findstring 4.,$(GCC_VERSION)),4.)".  I believe this is supposed to
detect version "4.X.X" of GCC.  But it also seems to match 3.4.X
(because that also has '4.' in it.

This caused an issue for me when trying to compile openssl with gcc
3.4.6.  The incorrect TARGET_SOFT_FLOAT option was being used because
the "4." detection was overwriting the correct value detected a few
lines above.

Am I right that this is an issue, or am I missing something?

-- 
Zachary P. Landau <kapheine@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] GCC version detection in toolchain/gcc/Makefile.in
  2007-03-29 14:36 [Buildroot] GCC version detection in toolchain/gcc/Makefile.in Zachary P. Landau
@ 2007-03-30 18:34 ` Bernhard Fischer
  2007-03-30 20:16   ` Zachary P. Landau
  0 siblings, 1 reply; 5+ messages in thread
From: Bernhard Fischer @ 2007-03-30 18:34 UTC (permalink / raw)
  To: buildroot

On Thu, Mar 29, 2007 at 10:36:27AM -0400, Zachary P. Landau wrote:
>Hello,
>
>I think there may be a problem in the GCC version detection code
>inside of toolchain/gcc/Makefile.in, but I wanted to verify it with
>people before filing a bug.  I am looking at the latest checkin of
>Makefile.in (revision 17836).
>
>Inside of that file, it uses the line: "ifeq ($(findstring
>3.4.,$(GCC_VERSION)),3.4.)" to detect gcc version 3.4.X.  But then a
>few lines down, in a separate ifeq, it uses the line: "ifeq
>($(findstring 4.,$(GCC_VERSION)),4.)".  I believe this is supposed to
>detect version "4.X.X" of GCC.  But it also seems to match 3.4.X
>(because that also has '4.' in it.
>
>This caused an issue for me when trying to compile openssl with gcc
>3.4.6.  The incorrect TARGET_SOFT_FLOAT option was being used because
>the "4." detection was overwriting the correct value detected a few
>lines above.
>
>Am I right that this is an issue, or am I missing something?

That sounds plausible, yes.
What do you suggest to distinguish between gcc version 4.4.9 and 3.4.6?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] GCC version detection in toolchain/gcc/Makefile.in
  2007-03-30 18:34 ` Bernhard Fischer
@ 2007-03-30 20:16   ` Zachary P. Landau
  0 siblings, 0 replies; 5+ messages in thread
From: Zachary P. Landau @ 2007-03-30 20:16 UTC (permalink / raw)
  To: buildroot

> >Inside of that file, it uses the line: "ifeq ($(findstring
> >3.4.,$(GCC_VERSION)),3.4.)" to detect gcc version 3.4.X.  But then a
> >few lines down, in a separate ifeq, it uses the line: "ifeq
> >($(findstring 4.,$(GCC_VERSION)),4.)".  I believe this is supposed to
> >detect version "4.X.X" of GCC.  But it also seems to match 3.4.X
> >(because that also has '4.' in it.
> >
> >Am I right that this is an issue, or am I missing something?
>
> That sounds plausible, yes.
> What do you suggest to distinguish between gcc version 4.4.9 and 3.4.6?

I don't particularly love this solution, we could parse the version
into its individual parts, and then match against those.  Something
like this:

  GCC_MAJOR:=$(shell echo $(GCC_VERSION) | cut -d'.' -f1)
  GCC_MINOR:=$(shell echo $(GCC_VERSION) | cut -d'.' -f2)
  GCC_SUB:=$(shell echo $(GCC_VERSION) | cut -d'.' -f3)

Then we could do the tests like this:

  ifeq ($(GCC_MAJOR).$(GCC_MINOR),3.4)
  SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
  else
  SOFT_FLOAT_CONFIG_OPTION:=--without-float
  endif

and so on, for the other GCC version tests.  That way we can make sure
we are testing the right part.  If you think this solution is okay, I
could make a patch for Makefile.in to use this scheme.

-- 
Zachary P. Landau <kapheine@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot]  GCC version detection in toolchain/gcc/Makefile.in
@ 2007-03-30 23:25 don
  2007-04-02 13:50 ` Zachary P. Landau
  0 siblings, 1 reply; 5+ messages in thread
From: don @ 2007-03-30 23:25 UTC (permalink / raw)
  To: buildroot

>> Inside of that file, it uses the line: "ifeq ($(findstring
> >3.4.,$(GCC_VERSION)),3.4.)" to detect gcc version 3.4.X.  But then a
> >few lines down, in a separate ifeq, it uses the line: "ifeq
> >($(findstring 4.,$(GCC_VERSION)),4.)".  I believe this is supposed to
> >detect version "4.X.X" of GCC.  But it also seems to match 3.4.X
> >(because that also has '4.' in it.
> >
> >Am I right that this is an issue, or am I missing something?
>
> That sounds plausible, yes.
> What do you suggest to distinguish between gcc version 4.4.9 and
> 3.4.6?

Does make accept the '^' character for start of string/line?

With grep you can do this:

 $ echo 3.4.1 | grep "4.1"
 3.4.1
 $ 
 $ echo 3.4.1 | grep "^4.1"

-- 
Don

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] GCC version detection in toolchain/gcc/Makefile.in
  2007-03-30 23:25 don
@ 2007-04-02 13:50 ` Zachary P. Landau
  0 siblings, 0 replies; 5+ messages in thread
From: Zachary P. Landau @ 2007-04-02 13:50 UTC (permalink / raw)
  To: buildroot

> > That sounds plausible, yes.
> > What do you suggest to distinguish between gcc version 4.4.9 and
> > 3.4.6?
>
> Does make accept the '^' character for start of string/line?
>
> With grep you can do this:
>
>  $ echo 3.4.1 | grep "4.1"
>  3.4.1
>  $
>  $ echo 3.4.1 | grep "^4.1"

I tried that initially, but it doesn't seem to work.  And looking at
the documentation for findstring, it doesn't mention any sort of
regular expression support.

-- 
Zachary P. Landau <kapheine@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-02 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-29 14:36 [Buildroot] GCC version detection in toolchain/gcc/Makefile.in Zachary P. Landau
2007-03-30 18:34 ` Bernhard Fischer
2007-03-30 20:16   ` Zachary P. Landau
  -- strict thread matches above, loose matches on Subject: below --
2007-03-30 23:25 don
2007-04-02 13:50 ` Zachary P. Landau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox