Closed Bug 981411 Opened 10 years ago Closed 10 years ago

CppEclipse needs to set the cross compiler and CPP flags

Categories

(Firefox Build System :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla30

People

(Reporter: BenWa, Assigned: BenWa)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #981353 +++

This change sets the indexer to properly use the NDK system headers and configuration with b2g.
Attached patch patchSplinter Review
Assignee: nobody → bgirard
Status: NEW → ASSIGNED
Attachment #8388199 - Flags: review?(botond)
Blocks: 981427
Comment on attachment 8388199 [details] [diff] [review]
patch

Review of attachment 8388199 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ +33,5 @@
>          self._appname = self.environment.substs['MOZ_APP_NAME']
>          self._bin_suffix = self.environment.substs['BIN_SUFFIX']
> +        self._cxx = self.environment.substs['CXX']
> +        # Note: We need the C Pre Processor (CPP) flags, not the CXX flags
> +        self._cppflags = self.environment.substs['CPPFLAGS']

Out of curiosity, what is an example of something in CPPFLAGS that we need in the command line for getting built-in compiler settings?

@@ +300,5 @@
>                                                          <flag value="LOCAL"/>
>                                                  </entry>
> +                                                <entry kind="includePath" name="@NSPR_INCLUDE_PATH@">
> +                                                        <flag value="LOCAL"/>
> +                                                </entry>

This is a duplicate of the entry immediately above.
This is the value I get for Fennec:
/Users/bgirard/mozilla/android-ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -idirafter /Users/bgirard/mozilla/android-ndk/android-ndk-r8e/platforms/android-9/arch-arm/usr/include  -E -P -v -dD "${INPUTS}" -std=c++11

where
_cxx = /Users/bgirard/mozilla/android-ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++
_cppflags = -idirafter /Users/bgirard/mozilla/android-ndk/android-ndk-r8e/platforms/android-9/arch-arm/usr/include

and the suffix: -E -P -v -dD "${INPUTS}" -std=c++11

Note here that CPPFLAGS is needed to identify the sdk version. For B2G its needed for the isystem definition:
/usr/bin/ccache /home/vagrant/mozilla/b2g-hamachi/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-g++ -DANDROID -isystem /home/vagrant/mozilla/b2g-hamachi/bionic/libc/arch-arm/include -isystem /home/vagrant/mozilla/b2g-hamachi/bionic/libc/include/ -isystem /home/vagrant/mozilla/b2g-hamachi/bionic/libc/kernel/common -isystem /home/vagrant/mozilla/b2g-hamachi/bionic/libc/kernel/arch-arm -isystem /home/vagrant/mozilla/b2g-hamachi/bionic/libm/include -I/home/vagrant/mozilla/b2g-hamachi/system -I/home/vagrant/mozilla/b2g-hamachi/system/core/include -isystem /home/vagrant/mozilla/b2g-hamachi/bionic -I/home/vagrant/mozilla/b2g-hamachi/hardware/libhardware/include -I/home/vagrant/mozilla/b2g-hamachi/external/valgrind/fxos-include -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/opengl/include -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/native/include -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/include -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/services/camera -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/include/media/stagefright -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/include/media/stagefright/openmax -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/media/libstagefright/rtsp -I/home/vagrant/mozilla/b2g-hamachi/frameworks/base/media/libstagefright/include -I/home/vagrant/mozilla/b2g-hamachi/external/dbus -I/home/vagrant/mozilla/b2g-hamachi/external/bluetooth/bluez/lib -I/home/vagrant/mozilla/b2g-hamachi/dalvik/libnativehelper/include/nativehelper  -E -P -v -dD "${INPUTS}" -std=c++11
Comment on attachment 8388199 [details] [diff] [review]
patch

Review of attachment 8388199 [details] [diff] [review]:
-----------------------------------------------------------------

Talked to BenWa about this. Having CPPFLAGS in the command to get the built-in compiler specs is a convenient way to tell Eclipse about the system include paths in CPPFLAGS (since running the command to get the built-in compiler specs will not return these paths as built-in include paths). 

I don't think the built-in compiler specs were meant to  be used this way, and I think a more proper way to do this would be to parse the CPPFLAGS ourselves and add entries for them to CDT User Settings entries, but this is fine for now.
Attachment #8388199 - Flags: review?(botond) → review+
https://hg.mozilla.org/mozilla-central/rev/5fbf1c06ca9b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
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: