Last Comment Bug 664340 - Build with --enable-stdcxx-compat fails when CXX env var is not set
: Build with --enable-stdcxx-compat fails when CXX env var is not set
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: unspecified
: x86_64 Linux
: -- normal (vote)
: mozilla7
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 669866
Blocks: 657653
  Show dependency treegraph
 
Reported: 2011-06-14 17:10 PDT by Benoit Jacob [:bjacob] (mostly away)
Modified: 2011-07-07 06:20 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Fallback to c++ when CXX is not set (1.66 KB, patch)
2011-06-14 17:19 PDT, Mike Hommey [:glandium]
khuey: review+
Details | Diff | Review

Description Benoit Jacob [:bjacob] (mostly away) 2011-06-14 17:10:02 PDT
Steps to reproduce:
1. clobber
2. configure with --enable-stdcxx-compat on a system where the CXX env var is not set. For example here on debian testing 64bit.
3. make

Result:

compilation fails with this output:

/home/bjacob/mozilla-central/build/stdc++compat.cpp:58:27: error: operator '>=' has no left operand
/home/bjacob/mozilla-central/build/stdc++compat.cpp:67:27: error: operator '>=' has no left operand
/home/bjacob/mozilla-central/build/stdc++compat.cpp:86:27: error: operator '>=' has no left operand
/home/bjacob/mozilla-central/build/stdc++compat.cpp:152:27: error: operator '>=' has no left operand
 
In the directory  /home/bjacob/build/firefox/dom/plugins/test/testplugin
The following command failed to execute properly:
c++ -o stdc++compat.o -c -I../../../../dist/system_wrappers -include /home/bjacob/mozilla-central/config/gcc_hidden.h -DOSTYPE="Linux2.6" -DOSARCH=Linux -I/home/bjacob/mozilla-central/dom/plugins/test/testplugin -I. -I../../../../dist/include -I../../../../dist/include/nsprpub -I/home/bjacob/build/firefox/dist/include/nspr -I/home/bjacob/build/firefox/dist/include/nss -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -std=gnu++0x -pthread -pipe -DDEBUG -D_DEBUG -DTRACING -g -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gtk-unix-print-2.0 -DMOZ_LIBSTDCXX_VERSION= -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/stdc++compat.pp /home/bjacob/mozilla-central/build/stdc++compat.cpp
make[5]: *** [stdc++compat.o] Error 1



Relevant bit of ./configure output:

Traceback (most recent call last):
  File "/home/bjacob/mozilla-central/build/autoconf/libstdcxx.py", line 70, in <module>
    cxx_env = os.environ['CXX']
  File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'CXX'
Comment 1 Mike Hommey [:glandium] 2011-06-14 17:15:04 PDT
Replying to comment 22 from bug 657653:
>@@ +43,5 @@
>> +                for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
>> +    last_version = sorted(versions, cmp = cmp_ver)[-1]
>> +    return encode_ver(last_version)
>> +
>> +cxx_env = os.environ.get('CXX', 'c++')
>
> I think you should just error if $CXX isn't set. It should always be set in the
> context you're running it in.

Actually, CXX is only set if it is set in mozconfig or in the environment, which in most cases, it isn't. It just happens that our tinderboxes do have it set in mozconfig, so we don't hit any problem there.
Comment 2 Mike Hommey [:glandium] 2011-06-14 17:19:38 PDT
Created attachment 539377 [details] [diff] [review]
Fallback to c++ when CXX is not set

When CXX is not set, GNU make does default to 'c++', so that's why it works when we don't set CXX. So, we need to default to c++ as well when CXX is not set.

At the same time, I'm changing the libstdcxx.py invocation to explicitely use $PYTHON instead of relying on /usr/bin/python being the version we configure with.
Comment 3 Ted Mielczarek [:ted.mielczarek] 2011-06-14 17:32:17 PDT
It gets set by configure as a shell var somewhere, right? We just need to export it to the Python script.
Comment 4 Benoit Jacob [:bjacob] (mostly away) 2011-06-14 17:33:32 PDT
The patch fixes the build here.
Comment 5 Mike Hommey [:glandium] 2011-06-14 17:51:12 PDT
(In reply to comment #3)
> It gets set by configure as a shell var somewhere, right?

Nope, not in most cases.
Comment 6 Mike Hommey [:glandium] 2011-06-16 17:23:15 PDT
It also turns out I was right to add $PYTHON in the patch. This is what Felipe Gomes got on try:
/builds/slave/try-lnx/build/configure: line 21610: /builds/slave/try-lnx/build/build/autoconf/libstdcxx.py: Permission denied
Comment 8 Matt Brubeck (:mbrubeck) 2011-06-22 10:19:48 PDT
http://hg.mozilla.org/mozilla-central/rev/c461448acd96

Note You need to log in before you can comment on or make changes to this bug.