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

Add cpp flag to cc #192

Merged
merged 2 commits into from
May 8, 2020
Merged

Add cpp flag to cc #192

merged 2 commits into from
May 8, 2020

Conversation

cchalmers
Copy link
Contributor

This means that clang++ will be called instead of clang.

This was causing me issueing when trying to use the nix version of clang, not sure why.

This means that clang++ will be called instead of clang.
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share the error message without this change?

@cchalmers
Copy link
Contributor Author

[nix-shell:~/Documents/rust/cxx]$ cargo build
   Compiling cc v1.0.52
   Compiling proc-macro2 v1.0.12
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.19
   Compiling link-cplusplus v1.0.1
   Compiling cxx v0.3.1 (/Users/chris/Documents/rust/cxx)
   Compiling quote v1.0.4
error: failed to run custom build command for `cxx v0.3.1 (/Users/chris/Documents/rust/cxx)`

Caused by:
  process didn't exit successfully: `/Users/chris/Documents/rust/cxx/target/debug/build/cxx-4c4a7f6743abc4bf/build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = Some("clang")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-Wall" "-Wextra" "-std=c++11" "-o" "/Users/chris/Documents/rust/cxx/target/debug/build/cxx-4acf56ca7a4f0206/out/src/cxx.o" "-c" "src/cxx.cc"
cargo:warning=In file included from src/cxx.cc:1:
cargo:warning=src/../include/cxx.h:2:10: fatal error: 'array' file not found
cargo:warning=#include <array>
cargo:warning=         ^~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr


error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-Wall" "-Wextra" "-std=c++11" "-o" "/Users/chris/Documents/rust/cxx/target/debug/build/cxx-4acf56ca7a4f0206/out/src/cxx.o" "-c" "src/cxx.cc" with args "clang" did not execute successfully (status code exit code: 1).



warning: build failed, waiting for other jobs to finish...
error: build failed

@dtolnay
Copy link
Owner

dtolnay commented May 8, 2020

Thanks -- I asked because cpp(true) has two effects as far as I could tell, it calls clang++ rather than clang, but it also adds some link flags determined based on the target. From your error message it looks like only the first effect is the relevant one, and we're clear to continue delegating the link flags to the link-cplusplus crate for configurability.

Would you be able to confirm that 110df7d still solves the error in your environment?

@cchalmers
Copy link
Contributor Author

Yep, still works for me with your change.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for checking and thanks for the PR!

@dtolnay dtolnay merged commit 887c8a2 into dtolnay:master May 8, 2020
@dtolnay
Copy link
Owner

dtolnay commented May 8, 2020

I published 0.3.2 with this fix.

@cchalmers cchalmers deleted the cpp-true branch May 8, 2020 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants