Closed Bug 664340 Opened 13 years ago Closed 13 years ago

Build with --enable-stdcxx-compat fails when CXX env var is not set

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla7

People

(Reporter: bjacob, Unassigned)

References

Details

Attachments

(1 file)

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'
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.
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.
It gets set by configure as a shell var somewhere, right? We just need to export it to the Python script.
The patch fixes the build here.
(In reply to comment #3)
> It gets set by configure as a shell var somewhere, right?

Nope, not in most cases.
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
Attachment #539377 - Flags: review?(ted.mielczarek)
Attachment #539377 - Flags: review?(ted.mielczarek) → review+
Blocks: 657653
http://hg.mozilla.org/mozilla-central/rev/c461448acd96
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla7
Depends on: 669866
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: