[Scons-users] SWIG

William Blevins wblevins001 at gmail.com
Wed Mar 11 01:53:37 EDT 2015


Honestly, that may be a bug with the SWIG emitter/builder and variant
directories.  Seems that the emitter is taking into account the variant
directory, but the builder isn't, so their is a mismatch between expected
and actual output.

Try passing the outdir like "#out/lib" which may override the variant
directory expectation.  If that doesn't work then try specifying outdir as
absolute path, and let us know.

V/R,
William

On Wed, Mar 11, 2015 at 1:48 AM, William Roberts <bill.c.roberts at gmail.com>
wrote:

> I think its pass 2. The file itself exists in out/lib/miniat.py where I
> expect it. That is what I set SWIGOUTDIR in my local branch too. public is
> a little behind me now.
>
>
> On Tue, Mar 10, 2015 at 10:45 PM, William Blevins <wblevins001 at gmail.com>
> wrote:
>
>> Is that pass-1 or pass-2?  And what is the expected behavior (IE. where
>> do you expect the file)?
>>
>> V/R,
>> William
>>
>> On Wed, Mar 11, 2015 at 1:42 AM, William Roberts <
>> bill.c.roberts at gmail.com> wrote:
>>
>>> absolutely, sorry about that. It appears that it concatenates variant
>>> directory with output directory which causes the
>>> file not to be found.
>>>
>>> scons: Building targets ...
>>> scons: building `out/vm/out/lib/miniat.py' because it doesn't exist
>>> swig -o out/vm/src/miniat_wrap.c -outdir "out/lib" -python
>>> out/vm/src/miniat.i
>>> scons: done building targets.
>>>
>>>
>>> On Tue, Mar 10, 2015 at 10:39 PM, William Blevins <wblevins001 at gmail.com
>>> > wrote:
>>>
>>>> Can you use debug=explain please?  We need finite state descriptions to
>>>> accompany issues or we cannot help ;)
>>>>
>>>> V/R,
>>>> William
>>>>
>>>> On Wed, Mar 11, 2015 at 1:37 AM, William Roberts <
>>>> bill.c.roberts at gmail.com> wrote:
>>>>
>>>>> I used the filtered glob from here to correct the pickup of the
>>>>> generated wrap.c file:
>>>>>
>>>>> http://stackoverflow.com/questions/12518715/how-do-i-filter-an-scons-glob-result
>>>>>
>>>>> However, it appears that the builder doesn't handle detecting changes
>>>>> properly, and
>>>>> always builds the wrapper file...
>>>>>
>>>>> Executing script:
>>>>> /home/bill/workspace/miniat/out/peripherals/simple_term
>>>>> scons: done reading SConscript files.
>>>>> scons: Building targets ...
>>>>> SWIG out/vm/src/miniat_wrap.c
>>>>> scons: done building targets.
>>>>>
>>>>>
>>>>> On Tue, Mar 10, 2015 at 10:30 PM, William Roberts <
>>>>> bill.c.roberts at gmail.com> wrote:
>>>>>
>>>>>> looks like the Glob(src/*.c) is picking up the miniat_wrap.c file
>>>>>> that was generated by swig in the working directory.
>>>>>>
>>>>>> On Tue, Mar 10, 2015 at 10:09 PM, William Blevins <
>>>>>> wblevins001 at gmail.com> wrote:
>>>>>>
>>>>>>> Nevermind there was a link included.  I am used to gettings
>>>>>>> attachments.
>>>>>>>
>>>>>>> Sorry,
>>>>>>> William
>>>>>>>
>>>>>>> On Wed, Mar 11, 2015 at 1:04 AM, William Blevins <
>>>>>>> wblevins001 at gmail.com> wrote:
>>>>>>>
>>>>>>>> You haven't supplied enough context.  This is most likely specific
>>>>>>>> to your SConscript calls.  Can you please include your script?
>>>>>>>>
>>>>>>>> V/R,
>>>>>>>> William
>>>>>>>>
>>>>>>>> On Wed, Mar 11, 2015 at 12:57 AM, William Roberts <
>>>>>>>> bill.c.roberts at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> FYI my work is here:
>>>>>>>>> https://bitbucket.org/miniat/0x1-miniat/branch/swig-python
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Mar 10, 2015 at 8:56 PM, Bill Deegan <
>>>>>>>>> bill at baddogconsulting.com> wrote:
>>>>>>>>>
>>>>>>>>>> William,
>>>>>>>>>>
>>>>>>>>>> If you want more control, you might break out.
>>>>>>>>>>
>>>>>>>>>> xyz=
>>>>>>>>>> env.SharedObject('targetdir/file','sourcefile.i',SWIGFLAGS=['-python',
>>>>>>>>>> '-outdir', 'out/lib'])
>>>>>>>>>> And then use all or part of xyz
>>>>>>>>>>
>>>>>>>>>> Also note that all builders should be treated as if they return a
>>>>>>>>>> list of Node objects.
>>>>>>>>>> So your:
>>>>>>>>>> return [l, x]
>>>>>>>>>>
>>>>>>>>>> Should likely be:
>>>>>>>>>> return l+x
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> doesn't scons internally flatten nested lists? Although,
>>>>>>>>> concatenating is probably the better way, as you suggest.
>>>>>>>>>
>>>>>>>>> I seem to get some weird issues when I run scons without any
>>>>>>>>> modfications to any files, it reruns swig and I see the following issues:
>>>>>>>>>
>>>>>>>>> scons: warning: Two different environments were specified for
>>>>>>>>> target src/miniat_wrap.os,
>>>>>>>>> but they appear to have the same action: $SHCC -o $TARGET -c
>>>>>>>>> $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES
>>>>>>>>> File "/home/bill/workspace/miniat/SConstruct", line 96, in
>>>>>>>>> buildSharedLibrary
>>>>>>>>> Executing script: /home/bill/workspace/miniat/out/vm/test
>>>>>>>>> Executing script: /home/bill/workspace/miniat/out/tools/mash
>>>>>>>>> Executing script:
>>>>>>>>> /home/bill/workspace/miniat/out/peripherals/debugger
>>>>>>>>> Executing script:
>>>>>>>>> /home/bill/workspace/miniat/out/peripherals/simple_kb
>>>>>>>>> Executing script:
>>>>>>>>> /home/bill/workspace/miniat/out/peripherals/simple_term
>>>>>>>>> scons: done reading SConscript files.
>>>>>>>>> scons: Building targets ...
>>>>>>>>> swig -o out/vm/src/miniat_wrap.c -python -outdir out/lib
>>>>>>>>> out/vm/src/miniat.i
>>>>>>>>> LD out/vm/libminiat.so
>>>>>>>>> CP out/lib/libminiat.so
>>>>>>>>> LD out/system/console/miniat_console
>>>>>>>>>
>>>>>>>>> It also somehow ends up modifying the libminiat.so library to
>>>>>>>>> include swig python stuff that it didn't include in that so on the first
>>>>>>>>> build.
>>>>>>>>> If you use nm to dump the symbols
>>>>>>>>>
>>>>>>>>> First Run, builds and links fine:
>>>>>>>>> $ nm out/lib/libminiat.so | grep swig
>>>>>>>>> <no output>
>>>>>>>>>
>>>>>>>>> run scons again, see the issues noted above, and the check the
>>>>>>>>> library:
>>>>>>>>> $ nm out/lib/libminiat.so | grep swig
>>>>>>>>> 0000000000213740 d _swigc__p_char
>>>>>>>>> 0000000000213780 d _swigc__p_miniat
>>>>>>>>>
>>>>>>>>> It seems to be getting confused.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -Bill
>>>>>>>>>>
>>>>>>>>>> On Tue, Mar 10, 2015 at 6:07 PM, William Roberts <
>>>>>>>>>> bill.c.roberts at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Mar 10, 2015 at 6:03 PM, William Roberts <
>>>>>>>>>>> bill.c.roberts at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> So I have a heiarchical biuld going on, my SConstruct defines
>>>>>>>>>>>> this method that is exported to my SConscripts
>>>>>>>>>>>>
>>>>>>>>>>>> def buildSharedLibrary(*args, **kwargs):
>>>>>>>>>>>>         l = env.SharedLibrary(*args, **kwargs)
>>>>>>>>>>>>         x = env.Install(libdir, l)
>>>>>>>>>>>>         return [l, x]
>>>>>>>>>>>>
>>>>>>>>>>>> So all my shared libraries end up in out/lib
>>>>>>>>>>>>
>>>>>>>>>>>> I am currently trying to make a swig wrapper, and my SConstruct
>>>>>>>>>>>> defines:
>>>>>>>>>>>>
>>>>>>>>>>>> buildSharedLibrary('_miniat.so', 'src/miniat.i',
>>>>>>>>>>>> LIBS=['miniat'], CPPPATH=[ INC, distutils.sysconfig.get_python_inc() ],
>>>>>>>>>>>> SHLIBPREFIX="", SWIGFLAGS=['-python'])
>>>>>>>>>>>>
>>>>>>>>>>>> Which builds the wrapper into a shared object just fine.
>>>>>>>>>>>> However, swig outputs a generated python file at:
>>>>>>>>>>>> ./out/vm/src/miniat.py
>>>>>>>>>>>>
>>>>>>>>>>>> What I am trying to do, is get SCons to install this into the
>>>>>>>>>>>> SharedLibrary directory, but it doesn't seem to be ommited here:
>>>>>>>>>>>> l = env.SharedLibrary(*args, **kwargs)
>>>>>>>>>>>>
>>>>>>>>>>>> How can I get that generated file output where I want it?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> As usual, just after I sent I found what I was looking for:
>>>>>>>>>>>
>>>>>>>>>>> buildSharedLibrary('_miniat.so', 'src/miniat.i',
>>>>>>>>>>> LIBS=['miniat'], CPPPATH=[ INC, distutils.sysconfig.get_python_inc() ],
>>>>>>>>>>> SHLIBPREFIX="", SWIGFLAGS=['-python', '-outdir', 'out/lib'])
>>>>>>>>>>>
>>>>>>>>>>> But is this the best way?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Respectfully,
>>>>>>>>>>>>
>>>>>>>>>>>> William C Roberts
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Respectfully,
>>>>>>>>>>>
>>>>>>>>>>> William C Roberts
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Scons-users mailing list
>>>>>>>>>>> Scons-users at scons.org
>>>>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Scons-users mailing list
>>>>>>>>>> Scons-users at scons.org
>>>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Respectfully,
>>>>>>>>>
>>>>>>>>> William C Roberts
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Scons-users mailing list
>>>>>>>>> Scons-users at scons.org
>>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Scons-users mailing list
>>>>>>> Scons-users at scons.org
>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Respectfully,
>>>>>>
>>>>>> William C Roberts
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Respectfully,
>>>>>
>>>>> William C Roberts
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-users at scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Respectfully,
>>>
>>> William C Roberts
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
>
> --
> Respectfully,
>
> William C Roberts
>
>
> _______________________________________________
> 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/20150311/591e5097/attachment-0001.html>


More information about the Scons-users mailing list