summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2013-03-14 16:08:55 +0100
committerAndreas Sandberg <andreas@sandberg.pp.se>2013-03-14 16:08:55 +0100
commit9544e8fbe0c47d5d4e62b2b8cbbcfb4f1a212037 (patch)
tree2c1198001c6acf2271fa6fe7384d6d00f6dec7f7 /SConstruct
parentfc6f569d94fe35a8c9a833e64dd82d6978dfb1cf (diff)
downloadgem5-9544e8fbe0c47d5d4e62b2b8cbbcfb4f1a212037.tar.xz
scons: Check for known buggy version of SWIG (2.0.9)
SWIG version 2.0.9 uses fully qualified module names despite of the importing module being in the same package as the imported module. This has the unfortunate consequence of causing the following error when importing m5.internal.event: Traceback (most recent call last): File "<string>", line 1, in <module> File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "src/python/m5/__init__.py", line 35, in <module> import internal File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "src/python/m5/internal/__init__.py", line 32, in <module> import event File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "build/X86/python/swig/event.py", line 107, in <module> class Event(m5.internal.serialize.Serializable): AttributeError: 'module' object has no attribute 'internal' When 'event' is loaded, it triggers 'serialize' to be loaded. However, it seems like the dictionary of 'm5' isn't updated until after __init__.py terminates, which means that 'event' never sees the 'internal' attribute on 'm5'. Older versions of SWIG didn't include the fully qualified module name if the modules were in the same package.
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct9
1 files changed, 9 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 4ca4ae56d..a5a598660 100755
--- a/SConstruct
+++ b/SConstruct
@@ -713,6 +713,15 @@ if compareVersions(swig_version[2], min_swig_version) < 0:
print ' Installed version:', swig_version[2]
Exit(1)
+if swig_version[2] == "2.0.9":
+ print '\n' + termcap.Yellow + termcap.Bold + \
+ 'Warning: SWIG version 2.0.9 sometimes generates broken code.\n' + \
+ termcap.Normal + \
+ 'This problem only affects some platforms and some Python\n' + \
+ 'versions. See the following SWIG bug report for details:\n' + \
+ 'http://sourceforge.net/p/swig/bugs/1297/\n'
+
+
# Set up SWIG flags & scanner
swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
main.Append(SWIGFLAGS=swig_flags)