Skip to content

C++ compile flags end up being used for linking too #467

Closed Answered by attilaolah
attilaolah asked this question in Q&A
Discussion options

You must be logged in to vote

After some trial and error, I worked around this by modifying @rules_foreign_cc to include the following in the crosstool file:

add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-xc++>)

This works as long as I also remove the -x c++ from the compiler flags. That can be done either by patching @rules_nixpkgs_cc (but then any non-Cmake C++ targets would break), or by further patching @rules_foreign_cc to not set the flags that are also used for linking. That is probably the correct approach, so I'll be filing an issue with @rules_foreign_cc, just wanted to quickly note the workaround in this discussion.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by attilaolah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant