[Scons-users] TryRun() problem with python3 scons-3.0.1

Bill Deegan bill at baddogconsulting.com
Thu Mar 8 11:56:55 EST 2018


Dave,

Can you run with --debug=stacktrace and share the stacktrace?

-Bill

On Thu, Mar 8, 2018 at 5:59 AM, Dave Plater <dplater.list at gmail.com> wrote:

> Hi, I'm battling to find why these SConstruct sections fails with
> "TypeError : sequence item 0: expected str instance, bytes found"
>
> def CompilerCheck( context ):
>     context.Message( "Checking for a working C-compiler " )
>     ret = context.TryRun( """
> #include <stdio.h>
>
> int main() {
>     printf( "Hello World!" );
>     return 0;
> }""", '.c' ).decode('utf-8')[0]
>     context.Result( ret )
>
> or
>
>     if 'CFLAGS' in env:
>         oldcf = env['CFLAGS']
>     else:
>         oldcf = ""
>     env.Append(CFLAGS = '-std=c99')
>     if conf.CheckLibWithHeader( "m", "math.h", "c", "lrint(3.2);"
> ).decode('utf-8'):
>         HAVE_LRINT = 1
>     else:
>         HAVE_LRINT = 0
>     if conf.CheckLibWithHeader( "m", "math.h", "c", "lrintf(3.2);"
> ).decode('utf-8'):
>         HAVE_LRINTF = 1
>     else:
>         HAVE_LRINTF = 0
>     env['HAVE_LRINT'] = HAVE_LRINT;
>     env['HAVE_LRINTF'] = HAVE_LRINTF;
>     env.Replace(CFLAGS=oldcf)
>
> What am I doing wrong? I've tried suffixing .decode('utf-8') after the
> TryRun statement as well.
>
> Thanks
> Dave Plater
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180308/6a71e9b9/attachment.html>


More information about the Scons-users mailing list