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

Too many default CXXFLAGS #96

Closed
minrk opened this issue Oct 24, 2018 · 3 comments
Closed

Too many default CXXFLAGS #96

minrk opened this issue Oct 24, 2018 · 3 comments

Comments

@minrk
Copy link

minrk commented Oct 24, 2018

Since ctng-compilers inherit @CXXFLAGS apparently from build-time of the recipe, activating these compilers sets a lot of flags by default:

-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona
-mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2
-pipe -I${PREFIX}/include
-fdebug-prefix-map=\${SRC_DIR}=/usr/local/src/conda/\${PKG_NAME}-\${PKG_VERSION}
-fdebug-prefix-map=\${PREFIX}=/usr/local/src/conda-prefix

In particular, setting the -std flag seems like an unexpected default behavior for a compiler, to me. Are all of these flags set on purpose, and is there a negative consequence to setting any of these by default? I'm debugging a build issue on nodejs right now, and my first hunch is that it may have to do with the fact that it has two flags for -std: -std=c++17 -std=gnu++1y.

@mingwandroid
Copy link
Contributor

In particular, setting the -std flag seems like an unexpected default behavior for a compiler, to me

Why do you say that? The language is largely backwards compatible and always has been.

Yes I have set them on purpose so that software without complex build systems will take advantage of it without any effort on their part beyond:

#if __cplusplus >= 201703L
.. use some C++17
#else
.. use some C++98
#endif

.. if c++17 causes an issue then mask that flag out in your build.sh. I intend, unless someone can come up with a good reason not to, to keep this flag updated to the latest available C++ standard that the compiler fully supports, until such a time as the C++ grammar is changed in an incompatible way.

@minrk
Copy link
Author

minrk commented Oct 24, 2018

if c++17 causes an issue then mask that flag out in your build.sh

I did mask it out, and it was indeed the cause of the build failures.

Why do you say that?

It seems odd to me to switch an opt-in feature to an opt-out feature when there's apparently little to no benefit in doing so, and opting out involves sed while opting in is simple.

until such a time as the C++ grammar is changed in an incompatible way.

I guess C++17 is one such event, then.

@mingwandroid
Copy link
Contributor

The issue is that the benefits are silently lost if you require opting in and I don't want to lose those.

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