Closed Bug 423261 Opened 12 years ago Closed 12 years ago

Build failure when gcc was compiled with some option that contains "version"

Categories

(Firefox Build System :: General, defect)

x86
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kairo, Assigned: kairo)

References

Details

Attachments

(1 file)

I updated to a new openSUSE gcc yesterday and ran into a build failure today that made autoconf.mk end up being empty. Digging deeper into logs, I saw a sed failure in conftest.s1 and when I commented out the removal of conftest.s* in configure, I saw the culprit:

s%@GCC_VERSION@%../configure
4.3.0%g

This of course is an invalid s command for sed and breaks us, but it's also a quite strange gcc version.
We're retrieving the gcc version with this line:

GCC_VERSION=`$CC -v 2>&1 | awk '/version / { print $3 }'`

in http://mxr.mozilla.org/mozilla/source/configure.in#1748 which causes that problem as the |gcc -v| on my system now is the following:

--------------------------------------------
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.3 --enable-version-specific-runtime-libs --enable-linux-futex --without-system-libunwind --with-cpu=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.3.0 (SUSE Linux)
--------------------------------------------
(From "Configured with:" to "--build=i586-suse-linux" is one wrapped shell line)

Now, the awk command tells us to use the third word of of every line that contains the string "version" and due to the "--enable-version-specific-runtime-libs" configure option, we end up with "../configure" as such a third word in addition to "4.3.0" and that makes us break.

There are a few possible solutions: The easiest one, which I used locally to get builds running, is to check for "version " instead of "version", but something that only uses the last line, either of the |gcc -v| or of the result, seems to be more future-proof to me.
Requesting blocker status as this will break compilation at least on openSUSE 11.0 (to be released in June or so, I'm using a development version of it), possibly also other distributions that ship with that gcc option enabled.
Flags: blocking1.9?
We could probably change that awk line to awk '/gcc version/ { print $3 }'. Can you try that and see if that works?
Ted, this works, but I think it's probably best if we even go for matching the start of the line as well, like in this patch - unless we know of problems we run into in this case.
This works fine here at least.
Assignee: nobody → kairo
Status: NEW → ASSIGNED
Attachment #309770 - Flags: review?(ted.mielczarek)
Blocks: 409803
Comment on attachment 309770 [details] [diff] [review]
patch: stricter matching for gcc version

Sounds good to me!
Attachment #309770 - Flags: review?(ted.mielczarek) → review+
Attachment #309770 - Flags: approval1.9?
Comment on attachment 309770 [details] [diff] [review]
patch: stricter matching for gcc version

a1.9=beltzner
Attachment #309770 - Flags: approval1.9? → approval1.9+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Flags: blocking1.9?
gcc -v 2>&1 | awk '/^gcc version/ { print $3 }'
is not good for non-C locale users.

We should use
gcc -dumpversion
for this purpose.
nice - didn't know about that. care to file a followup bug and patch? thanks!
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.