Just tried to compile a scripting build of KiCad BZR5348 after a recent upgrade of SWIG from 3.0.2 to 3.0.3. This fails on the scripting interface with the following errors:
[ 64%] Swig source
/home/blair/sources/kicad/product/pcbnew/../scripting/dlist.i:48: Error: Unknown SWIG preprocessor directive: first
/home/blair/sources/kicad/product/pcbnew/../scripting/dlist.i:56: Error: Unknown SWIG preprocessor directive: when
/home/blair/sources/kicad/product/pcbnew/../scripting/kicad.i:141: Error: Unknown SWIG preprocessor directive: Get
/home/blair/sources/kicad/product/pcbnew/../scripting/kicad.i:145: Error: Unknown SWIG preprocessor directive: Convert
/home/blair/sources/kicad/product/pcbnew/../scripting/kicad.i:146: Error: Unknown SWIG preprocessor directive: Same
/home/blair/sources/kicad/product/pcbnew/scripting/board.i:44: Error: Unknown SWIG preprocessor directive: add
/home/blair/sources/kicad/product/pcbnew/scripting/board.i:45: Error: Unknown SWIG preprocessor directive: the
/home/blair/sources/kicad/product/pcbnew/scripting/module.i:36: Error: Unknown SWIG preprocessor directive: def
/home/blair/sources/kicad/product/pcbnew/scripting/module.i:37: Error: Unknown SWIG preprocessor directive: return
/home/blair/sources/kicad/product/pcbnew/scripting/module.i:40: Error: Unknown SWIG preprocessor directive: add
/home/blair/sources/kicad/product/pcbnew/scripting/module.i:41: Error: Unknown SWIG preprocessor directive: the
pcbnew/CMakeFiles/_pcbnew.dir/build.make:53: recipe for target 'pcbnew/pcbnewPYTHON_wrap.cxx' failed
This appears to be due to a change in SWIG (https://github.com/swig/swig/issues/217) whereby invalid preprocessor commands are now treated as errors rather than being silently ignored as before. The lines reporting errors are all Python-style comments (i.e., start with #) which SWIG treats as directives. According to https://github.com/swig/swig/issues/217#issuecomment-61752587:
> Change the lines which start with # but which aren't preprocessor
> statements to not start with # - SWIG allows C++-style comments,
> so you can use // instead on those lines.
I have changed these lines as suggested and am currently rebuilding to see if that fixes it.
I just ran into this as well. If your fix works, please post the patch
and I will commit it. Thanks.
On 1/2/2015 4:57 PM, Blair Bonnett wrote: sources/ kicad/product/ pcbnew/ ../scripting/ dlist.i: 48: Error: Unknown SWIG preprocessor directive: first sources/ kicad/product/ pcbnew/ ../scripting/ dlist.i: 56: Error: Unknown SWIG preprocessor directive: when sources/ kicad/product/ pcbnew/ ../scripting/ kicad.i: 141: Error: Unknown SWIG preprocessor directive: Get sources/ kicad/product/ pcbnew/ ../scripting/ kicad.i: 145: Error: Unknown SWIG preprocessor directive: Convert sources/ kicad/product/ pcbnew/ ../scripting/ kicad.i: 146: Error: Unknown SWIG preprocessor directive: Same sources/ kicad/product/ pcbnew/ scripting/ board.i: 44: Error: Unknown SWIG preprocessor directive: add sources/ kicad/product/ pcbnew/ scripting/ board.i: 45: Error: Unknown SWIG preprocessor directive: the sources/ kicad/product/ pcbnew/ scripting/ module. i:36: Error: Unknown SWIG preprocessor directive: def sources/ kicad/product/ pcbnew/ scripting/ module. i:37: Error: Unknown SWIG preprocessor directive: return sources/ kicad/product/ pcbnew/ scripting/ module. i:40: Error: Unknown SWIG preprocessor directive: add sources/ kicad/product/ pcbnew/ scripting/ module. i:41: Error: Unknown SWIG preprocessor directive: the CMakeFiles/ _pcbnew. dir/build. make:53: recipe for target 'pcbnew/ pcbnewPYTHON_ wrap.cxx' failed /github. com/swig/ swig/issues/ 217) whereby invalid preprocessor /github. com/swig/ swig/issues/ 217#issuecommen t-61752587: sources/ kicad/product/ pcbnew/ ../scripting/ dlist.i: 48: Error: Unknown SWIG preprocessor directive: first sources/ kicad/product/ pcbnew/ ../scripting/ dlist.i: 56: Error: Unknown SWIG preprocessor directive: when sources/ kicad/product/ pcbnew/ ../scripting/ kicad.i: 141: Error: Unknown SWIG preprocessor directive: Get
> Public bug reported:
>
> Just tried to compile a scripting build of KiCad BZR5348 after a recent
> upgrade of SWIG from 3.0.2 to 3.0.3. This fails on the scripting
> interface with the following errors:
>
> [ 64%] Swig source
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/
> pcbnew/
>
> This appears to be due to a change in SWIG
> (https:/
> commands are now treated as errors rather than being silently ignored as
> before. The lines reporting errors are all Python-style comments (i.e.,
> start with #) which SWIG treats as directives. According to
> https:/
>
> > Change the lines which start with # but which aren't preprocessor
> > statements to not start with # - SWIG allows C++-style comments,
> > so you can use // instead on those lines.
>
> I have changed these lines as suggested and am currently rebuilding to
> see if that fixes it.
>
> ** Affects: kicad
> Importance: High
> Assignee: Blair Bonnett (blair-bonnett)
> Status: In Progress
>
> ** Description changed:
>
> Just tried to compile a scripting build of KiCad BZR5348 after a recent
> upgrade of SWIG from 3.0.2 to 3.0.3. This fails on the scripting
> interface with the following errors:
>
> [ 64%] Swig source
> /home/blair/
> /home/blair/
> /home/blair/
> /home/blair/sou...