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

Andrew C. Morrow andrew.c.morrow at gmail.com
Thu Mar 8 10:26:48 EST 2018


I ran into this too in a TryCompile while trying to get a project building
with python3 and SCons master, and spent a long time trying to figure out
where I was injecting a bytes type object without success. Interestingly,
it seemed to go away when I disabled CacheDir.

On Thu, Mar 8, 2018 at 8: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/c730c786/attachment.html>


More information about the Scons-users mailing list