-
Notifications
You must be signed in to change notification settings - Fork 80
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
cc: make CXX_FLAG configurable #298
Conversation
78a10d7
to
313bfc1
Compare
Sure, this looks like the correct way to do things. Plug and play into my project yields:
While build a regular cc dependency. Not a massive blocker, I reckon this can be solved with setting environmental variables. But as in #219, auto-detection seems to work well enough so setting LGMT, but would suggest discussing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this!
@dmadisetti does this solve the issue for you?
One issue I see with this approach is that it fixes the language for all targets built with that toolchain. Concretely, I'd expect the following type of thing to fail:
# WORKSPACE
nixpkgs_cc_configure(..., cc_lang = "cuda")
# BUILD
cc_binary(
name = "cxx-bin",
srcs = ["main.cc"], # this is C++ code - I'd expect this to fail
)
cc_binary(
name = "cude-bin",
srcs = ["main.cu"], # this is Cuda code
)
In that regard, bazelbuild/bazel#15499 seems like a much better solution.
That said, I'm not opposed to making the -x
flag configurable, if it solves the issue.
Yes setting |
@dmadisetti perhaps |
Nice!
@evertedsphere if that works, then that would be a good thing to recommend in the docs, instead of setting |
It's not needed from what I can see. |
@dmadisetti what about without |
313bfc1
to
b4a0003
Compare
@evertedsphere no, the conflicting flags fall back to the original |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
This offers an alternative to the solution proposed in #219 to the problem of
nixpkgs_cc_configure
providing a non-configurable-x c++
inCXX_OPTS
when calling a C compiler. We add a new optionalcc_lang
argument tonixpkgs_cc_configure
, and then pass-x <cc_lang>
instead.Fixes #218.