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

configure.py/bootstrap.py uses CXX with CFLAGS #673

Closed
geoff-nixon opened this issue Oct 19, 2013 · 3 comments
Closed

configure.py/bootstrap.py uses CXX with CFLAGS #673

geoff-nixon opened this issue Oct 19, 2013 · 3 comments

Comments

@geoff-nixon
Copy link

...rather than CXXFLAGS.
Thus,
CC=clang CXX=clang++ CFLAGS=-std=c11 CXXFLAGS=-std=c++11 configure.py; ninja
or the like raises
error: invalid argument '-std=c11' not allowed with 'C++/ObjC++'.

@nico
Copy link
Collaborator

nico commented Oct 19, 2013

ninja has no .c files. Is this really a problem?

@geoff-nixon
Copy link
Author

Well, yes (IMHO). It doesn't particularly matter whether the project has .c or .cxx or .cpp or .cc files; it's that (by convention, I think? I actually can't seem to find any real citations or standards for this) typically flags for the C compiler are put in CFLAGS and flags for the C++ compiler are put in CXXFLAGS. The example I use above is a simplified one for demonstration; by default, the values I typically have exported are
-flto -fpic -fslp-vectorize-aggressive -march=native -Ofast -std=c11 in CFLAGS and
-flto -fpic -fno-asynchronous-unwind-tables -fslp-vectorize-aggressive -march=native -Ofast -std=c++11 -stdlib=libc++
in CXXFLAGS. Note that the error I report above only occurs because I have -std=c11 in my CFLAGS, which is probably rather rare; but a much more common occurrence, I think, is that the build will just ignore what one has set in CXXFLAGS and continue. This isn't ideal, however, since it will ignore pertinent settings like what type of exception handling info to generate and which C++ standard library against which I'd like to link. And as others have mentioned, building as C++11 often improves performance.

Now, of course, I'm sometimes a quick fellow, picked up on what was happening and set my CFLAGS to my CXXFLAGS for this project, but (again, only my opinion) one shouldn't have to do that, I don't think.

@geoff-nixon
Copy link
Author

I'm closing the issue as I've opened #676 to address this.

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

No branches or pull requests

2 participants