[Scons-users] Pass multiple build flags on the command line

William Blevins wblevins001 at gmail.com
Sat Aug 9 13:55:27 EDT 2014


I've never passed in the arguments like that before.  Based on the error
output, it appears that the string "-g -O2" is being interpreted as
positional arguments which is why the "O2" ends up losing the hyphen.

What happens if you do: scons CXXFLAGS='-g' CXXFLAGS='-O2'

Do the values get appended to CXXFLAGS or overwritten?

V/R,
William


On Sat, Aug 9, 2014 at 1:39 PM, Bertrand Marc <beberking at gmail.com> wrote:

> Hi,
>
> Thanks for your answer. Could you please explain why the list of flags
> is the preferred choice ?
>
> Unfortunately, I am trying to build the pingus package for Debian,
> that's why flags must be passed at build/configure time. I can't write
> the flags in the Sconstruct file, I must pass them to scons somehow and
> I am looking for the best way to do it.
>
> Thanks,
> Bertrand
>
> Le 09/08/2014 18:13, William Blevins a écrit :
> > You really should use *env.Append( [ '-g', '-O2'] )* instead.  You may
> > want to reconsider who your commandline arguments are being handled.
> >
> > -William
> >
> >
> > On Sat, Aug 9, 2014 at 10:00 AM, Bertrand Marc <beberking at gmail.com
> > <mailto:beberking at gmail.com>> wrote:
> >
> >     Dear Scons users,
> >
> >     I am trying to build pingus with custom build flags. I'd like to pass
> >     two flags to g++ (-g -O2), so I launch the following:
> >     scons CXXFLAGS='-g -O2'
> >
> >     Unfortunately it fails because the Sconstruct file appends
> >     ["-std=c++0x"] after CXXFLAGS and env.Append doesn't mix well lists
> and
> >     strings. I get the following error:
> >     g++ -o .sconf_temp/conftest_1.o -c "-g O2" -std=c++0x
> >     -isystem/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
> >     .sconf_temp/conftest_1.cpp
> >     cc1plus: error: unrecognised debug output level " O2"
> >     scons: Configure: failed
> >
> >     You can see the issue: my build flags are between "".
> >
> >     Of course I can change the Sconstruct file to make CXXFLAGS a string
> >     instead of a list, but is it the right solution ? Are there any
> downside
> >     to using strings instead of lists for buildflags ? Is there a way to
> >     pass a list of flags to the command line ?
> >
> >     You'll find a minimal Sconstruct file based on the pingus' one. You
> can
> >     test it with the -c target easily.
> >
> >     Thanks for your answer,
> >     Bertrand
> >
> >     _______________________________________________
> >     Scons-users mailing list
> >     Scons-users at scons.org <mailto:Scons-users at scons.org>
> >     http://four.pairlist.net/mailman/listinfo/scons-users
> >
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-users at scons.org
> > http://four.pairlist.net/mailman/listinfo/scons-users
> >
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140809/9d7f77cc/attachment.html>


More information about the Scons-users mailing list