Compilation failed : "the swig import helper was not fixed [...] pcbnew.py [...] fix this script: fix_swig_imports.py"

Bug #1816286 reported by Jérémy Hervé
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Medium
Unassigned

Bug Description

Compilation fail with :

Error: the swig import helper was not fixed, check /home/jeremy/kicad/kicad/build/pcbnew/pcbnew.py
       and fix this script: fix_swig_imports.py
make[2]: *** [pcbnew/pcbnew_wrap.cxx] Error 2
make[1]: *** [pcbnew/CMakeFiles/pcbnew_kiface_objects.dir/all] Error 2
make: *** [all] Error 2

Tags: python
Revision history for this message
Nick Østergaard (nickoe) wrote :

I see no problem on my builds. Please add more information.

What platform?

Please provide complete build log.

Please try a clean build.

What swig version are you using?

Changed in kicad:
status: New → Incomplete
Revision history for this message
Jérémy Hervé (jeremy.herve) wrote :
Download full text (3.4 KiB)

I sent this report just after a "rm -Rf * ; cmake ../" in my "build" directory.
The "cmake ../" raised no error on the console, I then ran "make".

Note :
Strangely enough, I had the same error (Error: the swig import helper was not fixed...) some hours before, stopping the compilation circa 70%. I ran make again and the compilation gone throught the 70% but failed later with a GCC error (didn't saved it).

** Plateform Ubuntu 14.04 :

Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

** The command swig -version gives :

SWIG Version 4.0.0
Compiled with g++ [x86_64-unknown-linux-gnu]
Configured options: +pcre

** CMakefiles/CMakeError.log :

Performing C++ SOURCE FILE Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE failed with the following output:
Change Dir: /home/jeremy/kicad/kicad/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec1021890506/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1021890506.dir/build.make CMakeFiles/cmTryCompileExec1021890506.dir/build
make[1]: Entering directory `/home/jeremy/kicad/kicad/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/jeremy/kicad/kicad/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1021890506.dir/src.cxx.o
/usr/bin/c++ -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -DCOMPILER_SUPPORTS_WSUGGEST_OVERRIDE -fPIE -Wsuggest-override -o CMakeFiles/cmTryCompileExec1021890506.dir/src.cxx.o -c /home/jeremy/kicad/kicad/build/CMakeFiles/CMakeTmp/src.cxx
g++-4.8.real: error: unrecognized command line option '-Wsuggest-override'
make[1]: *** [CMakeFiles/cmTryCompileExec1021890506.dir/src.cxx.o] Error 1
make[1]: Leaving directory `/home/jeremy/kicad/kicad/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec1021890506/fast] Error 2

Source file was:
int main() { return 0;}

** gcc -v gives :
COLLECT_GCC=/usr/bin/gcc-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.4' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-...

Read more...

Revision history for this message
Nick Østergaard (nickoe) wrote :

So since the swig version is 4.0.0 I guess you are running a development version you built yourself as I think the latest swig release is 3.0.12.

See https://github.com/swig/swig/releases

I guess you need to do as suggested by the error output you posted in the original description.

Changed in kicad:
status: Incomplete → New
milestone: none → 6.0.0-rc1
Revision history for this message
Matteo Bernardini (ponce) wrote :

following this as swig 4.0.0 has been released and I got the exact same output also on Slackware current.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

fix_swig_imports.py is a script to cleanup pcbnew.py

Please send us the first lines of pcbnew.py, that should contain something like:
"if _swig_python_version_info >= (2, 7, 0):"

Revision history for this message
Steven Falco (stevenfalco) wrote :

I'm seeing this failure on Fedora Rawhide. pcbnew.py contains:

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.0
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError('Python 2.7 or later required')

Revision history for this message
jean-pierre charras (jp-charras) wrote :

The header has changed and fix_swig_imports.py needs a patch.

I need more lines (all lines until the first "def" section in pcbnew.py.

Thanks

Revision history for this message
Steven Falco (stevenfalco) wrote :

Here is more of the file:

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.0
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError('Python 2.7 or later required')

# Import the low-level C/C++ module
if __package__ or '.' in __name__:
    from . import _pcbnew
else:
    import _pcbnew

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
    if name == "thisown":
        return self.this.own(value)
    if name == "this":
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name, None)
    if method:
        return method(self, value)
    if not static:
        object.__setattr__(self, name, value)
    else:
        raise AttributeError("You cannot add attributes to %s" % self)

Revision history for this message
Steven Falco (stevenfalco) wrote :

Here is the whole file as an attachement.

Revision history for this message
Steven Falco (stevenfalco) wrote :

For completeness, this bug has also been reported downstream at the Fedora bug tracker:

https://bugzilla.redhat.com/show_bug.cgi?id=1708155

tags: added: python
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Steven,

There is a patch available on the dev mailing list, could you try it out? [1]

1. https://lists.launchpad.net/kicad-developers/msg40588.html

Revision history for this message
Steven Falco (stevenfalco) wrote :

The patch is good. I built for Fedora 29, 30, and rawhide. All built completely.

I tested the Fedora 30 and rawhide builds.

I recommend adding this patch to the official sources.

Revision history for this message
Matteo Bernardini (ponce) wrote :

I can confirm it working too on Slackware current: thanks!

Revision history for this message
Jon Evans (craftyjon) wrote :

Patch was committed in 5685174808f5ca973e916a10f9f93660ee4dc4f2

Changed in kicad:
status: New → Fix Committed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.