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

gcc: error: unrecognized command line option '-Wl' #320

Closed
sagitter opened this issue Feb 9, 2016 · 4 comments
Closed

gcc: error: unrecognized command line option '-Wl' #320

sagitter opened this issue Feb 9, 2016 · 4 comments

Comments

@sagitter
Copy link

sagitter commented Feb 9, 2016

Hi again,

another issue that I do not know how to manage: gcc compiler does not recognize all -Wloptions.

-Wp, for example, is an option that I use often with gcc/g++ compilers, -Wl,-z,relro or -Wl,-z,now with the linker; why are they not permitted on Cantera?

Thanks.

@speth
Copy link
Member

speth commented Feb 9, 2016

The problem is that the Cantera SConstruct file thinks that commas are delimiters between different options, e.g. if you write scons build cxx_flags=-g,-O2 it would understand to call gcc with the -g and -O2 options. But of course this doesn't work well with the use of commas for the exact same purpose within the -Wl option.

As a workaround, you can specify this option in cantera.conf as a list explicitly, i.e.

cxx_flags = ['-g', '-Wl,-z,relro', '-Wl,-z,now']

And of course the same applies for the other options for setting compiler/linker options.

@sagitter
Copy link
Author

sagitter commented Feb 9, 2016

Thank you for reply.

Do options set in cantera.conf overwrite those ones set with scons command?

@speth
Copy link
Member

speth commented Feb 9, 2016

It works the other way around: if you do not specify a value in the scons build command line, it will use one from cantera.conf. If you do specify a value to scons build, then that will be used to populate cantera.conf.

@sagitter sagitter closed this as completed Feb 9, 2016
@speth
Copy link
Member

speth commented Feb 10, 2016

Although there is a workaround, I think it might be preferable to modify the parsing of these compiler options (currently handled by the listify function in buildutils.py) so that flags like this can be passed in from the command line. Options for changing this are:

  • Only allow spaces to be delimiters, which means that multiple values will need to be passed as quoted strings, e.g. scons build cxx_flags="-g -O2"
  • Allow commas to be escaped in options like those above, e.g. scons build cxx_flags=-O2,-Wl\\,-z\\,relro.
    The second option has the advantage of not invalidating the currently-supported syntax, but double escaping required for the backslashes is kind of annoying.

@speth speth reopened this Feb 10, 2016
@speth speth closed this as completed in 2e56f6d Mar 28, 2016
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