servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 117 forks source link

Set the cpp flag on the cc builder in build.rs #427

Closed asajeffrey closed 6 years ago

asajeffrey commented 6 years ago

Fixes a build error when cross-compiling from linux to android:

CC_armv7-linux-androideabi = None
CC_armv7_linux_androideabi = None
HOST_CC = None
CC = None
CFLAGS_armv7-linux-androideabi = None
CFLAGS_armv7_linux_androideabi = None
HOST_CFLAGS = None
CFLAGS = Some("--sysroot /home/servo/android/ndk/r12b/android-ndk-r12b/platforms/android-18/arch-arm -I/home/servo/android/ndk/r12b/android-ndk-r12b/sources/android/support/include")
running: "arm-linux-androideabi-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--sysroot" "/home/servo/android/ndk/r12b/android-ndk-r12b/platforms/android-18/arch-arm" "-I/home/servo/android/ndk/r12b/android-ndk-r12b/sources/android/support/include" "-g" "-march=armv7-a" "-march=armv7-a" "-mthumb" "-mfpu=vfpv3-d16" "-mfloat-abi=softfp" "-I" "/home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include" "-Wall" "-Wextra" "-fPIC" "-fno-rtti" "-std=c++11" "-include" "/home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/js/src/js-confdefs.h" "-Wno-c++0x-extensions" "-Wno-return-type-c-linkage" "-Wno-unused-parameter" "-DJS_NO_JSVAL_JSID_STRUCT_TYPES=" "-o" "/home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs-3864977b9602d849/out/src/jsglue.o" "-c" "src/jsglue.cpp"
cargo:warning=In file included from /home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include/mozilla/Attributes.h:12:0,
cargo:warning=                 from /home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include/mozilla/Assertions.h:16,
cargo:warning=                 from /home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include/mozilla/AlreadyAddRefed.h:12,
cargo:warning=                 from /home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include/jsapi.h:12,
cargo:warning=                 from src/jsglue.cpp:15:
cargo:warning=/home/servo/servo/target/armv7-linux-androideabi/debug/build/mozjs_sys-6ea9cc1d03743689/out/dist/include/mozilla/Compiler.h:49:21: fatal error: cstddef: No such file or directory
cargo:warning= #  include <cstddef>
cargo:warning=                     ^
cargo:warning=compilation terminated.
exit code: 1

The error shows that the C compiler chain rather than the C++ compiler chain is being used, even though it's compiling a .cpp file.


This change is Reviewable

asajeffrey commented 6 years ago

r? @jdm

jdm commented 6 years ago

@bors-servo r+

bors-servo commented 6 years ago

:pushpin: Commit 827007f has been approved by jdm

bors-servo commented 6 years ago

:hourglass: Testing commit 827007fa70c1b1313ee9d51aedd2ff71b7fb5537 with merge c0331a4a5967d5cc2a98007cea68ef7f539e8c51...

bors-servo commented 6 years ago

:sunny: Test successful - status-appveyor, status-travis Approved by: jdm Pushing c0331a4a5967d5cc2a98007cea68ef7f539e8c51 to master...