Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from May 29, 2018

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented May 29, 2018

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
Copy link
Member Author

asajeffrey commented May 29, 2018

r? @jdm

@jdm
Copy link
Member

jdm commented May 29, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 29, 2018

📌 Commit 827007f has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented May 29, 2018

Testing commit 827007f with merge c0331a4...

bors-servo added a commit that referenced this pull request May 29, 2018
Set the cpp flag on the cc builder in build.rs

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.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-mozjs/427)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 29, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: jdm
Pushing c0331a4 to master...

@bors-servo bors-servo merged commit 827007f into servo:master May 29, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.