Hi Everyone,

I just tried to compile gem5 on our cluster and got a really the following error when starting gem5:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
File "/bubo/home/h24/ansan501/workspace/gem5/src/python/importer.py", line 75, in load_module
    exec code in mod.__dict__
File "/bubo/home/h24/ansan501/workspace/gem5/src/python/m5/__init__.py", line 35, in <module>
    import internal
File "/bubo/home/h24/ansan501/workspace/gem5/src/python/importer.py", line 75, in load_module
    exec code in mod.__dict__
File "/bubo/home/h24/ansan501/workspace/gem5/src/python/m5/internal/__init__.py", line 32, in <module>
    import event
File "/bubo/home/h24/ansan501/workspace/gem5/src/python/importer.py", line 75, in load_module
    exec code in mod.__dict__
File "/bubo/home/h24/ansan501/workspace/gem5/build/X86/python/swig/event.py", line 107, in <module>
    class Event(m5.internal.serialize.Serializable):
AttributeError: 'module' object has no attribute 'internal'

I believe this is because of a bug [1] introduced in SWIG 2.0.9. The problem is that the Python code generated by SWIG contains in this version uses fully qualified package names, which causes problems when there are dependencies between modules in the same package. Specifically, when __init__ in m5.internal imports event, event tries to load m5.internal.serialize. What seems to happen at this point is that serialize isn't added to m5.internal's dictionary, which means that m5.serialize.Serializable can't be resolved. However, 'import serialize' or 'import Serializable from m5.internal.serialize' works as expected (SWIG prior to version 2.0.9 did the former).

Unless there are any objections, I'd like to add a check in the scons configuration and produce an error if someone tries to build gem5 with this version. Is everyone OK with this?

//Andreas

[1] http://sourceforge.net/p/swig/bugs/1297/
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to