Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cocotb error: Failed to import module test_eth_axis_rx: can't use AF_INET6, IPv6 is disabled #78

Open
cyberchrime opened this issue Aug 3, 2023 · 0 comments

Comments

@cyberchrime
Copy link

cyberchrime commented Aug 3, 2023

When trying to simulate https://github.com/alexforencich/verilog-ethernet/tree/master/tb/eth_axis_rx from the verilog-ethernet project with cocotb, cocotb and scapy complain about IPv6 support being disabled in Python.

rm -f results.xml
make -f Makefile results.xml
make[1]: Entering directory '/home/user/verilog-ethernet/tb/eth_axis_rx'
rm -f results.xml
MODULE=test_eth_axis_rx TESTCASE= TOPLEVEL=eth_axis_rx TOPLEVEL_LANG=verilog \
         /opt/oss-cad-suite/bin/vvp -M /opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs -m libcocotbvpi_icarus   sim_build/sim.vvp -fst -fst
     -.--ns INFO     gpi                                ..mbed/gpi_embed.cpp:105  in set_program_name_in_venv        Using Python virtual environment interpreter at OSS CAD Suite/bin/python
     -.--ns INFO     gpi                                ../gpi/GpiCommon.cpp:101  in gpi_print_registered_impl       VPI registered
     0.00ns INFO     cocotb                             Running on Icarus Verilog version 13.0 (devel)
     0.00ns INFO     cocotb                             Running tests with cocotb v1.9.0.dev0 from /opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb
     0.00ns INFO     cocotb                             Seeding Python random module with 1691062797
--- Logging error ---
Traceback (most recent call last):
  File "/opt/oss-cad-suite/lib/python3.8/logging/__init__.py", line 1081, in emit
    msg = self.format(record)
  File "/opt/oss-cad-suite/lib/python3.8/logging/__init__.py", line 925, in format
    return fmt.format(record)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/error.py", line 93, in format
    from scapy.config import conf
ImportError: cannot import name 'conf' from partially initialized module 'scapy.config' (most likely due to a circular import) (/home/user/.local/lib/python3.8/site-packages/scapy/config.py)
Call stack:
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/__init__.py", line 232, in _initialise_testbench
    _initialise_testbench_(argv_)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/__init__.py", line 315, in _initialise_testbench_
    regression_manager = RegressionManager.from_discovery(top)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 174, in from_discovery
    return cls(dut, tests)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 153, in __init__
    for test in tests:
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 203, in _discover_tests
    module = _my_import(module_name)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 72, in _my_import
    mod = __import__(name)
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/verilog-ethernet/tb/eth_axis_rx/test_eth_axis_rx.py", line 30, in <module>
    from scapy.layers.l2 import Ether
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/layers/l2.py", line 16, in <module>
    from scapy.ansmachine import AnsweringMachine
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/ansmachine.py", line 18, in <module>
    from scapy.arch import get_if_addr
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/__init__.py", line 14, in <module>
    from scapy.config import conf, _set_conf_sockets
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/config.py", line 934, in <module>
    log_scapy.warning("IPv6 support disabled in Python. Cannot load Scapy IPv6 layers.")  # noqa: E501
Message: 'IPv6 support disabled in Python. Cannot load Scapy IPv6 layers.'
Arguments: ()
     0.00ns WARNING  scapy                              IPv6 support disabled in Python. Cannot load Scapy IPv6 layers.
     0.00ns CRITICAL cocotb.regression                  Failed to import module test_eth_axis_rx: can't use AF_INET6, IPv6 is disabled
     0.00ns INFO     cocotb.regression                  MODULE variable was "test_eth_axis_rx"
     0.00ns INFO     cocotb.regression                  Traceback: 
     0.00ns INFO     cocotb.regression                  Traceback (most recent call last):
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 203, in _discover_tests
                                                            module = _my_import(module_name)
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 72, in _my_import
                                                            mod = __import__(name)
                                                          File "<frozen importlib._bootstrap>", line 991, in _find_and_load
                                                          File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
                                                          File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
                                                            exec(co, module.__dict__)
                                                          File "/home/user/verilog-ethernet/tb/eth_axis_rx/test_eth_axis_rx.py", line 30, in <module>
                                                            from scapy.layers.l2 import Ether
                                                          File "<frozen importlib._bootstrap>", line 991, in _find_and_load
                                                          File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
                                                          File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
                                                            exec(co, module.__dict__)
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/layers/l2.py", line 16, in <module>
                                                            from scapy.ansmachine import AnsweringMachine
                                                          File "<frozen importlib._bootstrap>", line 991, in _find_and_load
                                                          File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
                                                          File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
                                                            exec(co, module.__dict__)
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/ansmachine.py", line 18, in <module>
                                                            from scapy.arch import get_if_addr
                                                          File "<frozen importlib._bootstrap>", line 991, in _find_and_load
                                                          File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
                                                          File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
                                                          File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
                                                            exec(co, module.__dict__)
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/__init__.py", line 151, in <module>
                                                            _set_conf_sockets()  # Apply config
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/config.py", line 645, in _set_conf_sockets
                                                            conf.ifaces.reload()
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 237, in reload
                                                            self._reload_provs()
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 233, in _reload_provs
                                                            self._load(prov.reload(), prov)
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 52, in reload
                                                            return self.load()
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/linux.py", line 413, in load
                                                            ips = in6_getifaddr()
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/linux.py", line 331, in in6_getifaddr
                                                            addr = scapy.utils6.in6_ptop(
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/utils6.py", line 697, in in6_ptop
                                                            return inet_ntop(socket.AF_INET6, inet_pton(socket.AF_INET6, str))
                                                          File "/home/user/.local/lib/python3.8/site-packages/scapy/pton_ntop.py", line 93, in inet_pton
                                                            return socket.inet_pton(af, addr)
                                                        OSError: can't use AF_INET6, IPv6 is disabled
                                                        
Traceback (most recent call last):
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/__init__.py", line 232, in _initialise_testbench
    _initialise_testbench_(argv_)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/__init__.py", line 315, in _initialise_testbench_
    regression_manager = RegressionManager.from_discovery(top)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 174, in from_discovery
    return cls(dut, tests)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 153, in __init__
    for test in tests:
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 203, in _discover_tests
    module = _my_import(module_name)
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/regression.py", line 72, in _my_import
    mod = __import__(name)
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/verilog-ethernet/tb/eth_axis_rx/test_eth_axis_rx.py", line 30, in <module>
    from scapy.layers.l2 import Ether
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/layers/l2.py", line 16, in <module>
    from scapy.ansmachine import AnsweringMachine
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/ansmachine.py", line 18, in <module>
    from scapy.arch import get_if_addr
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/__init__.py", line 151, in <module>
    _set_conf_sockets()  # Apply config
  File "/home/user/.local/lib/python3.8/site-packages/scapy/config.py", line 645, in _set_conf_sockets
    conf.ifaces.reload()
  File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 237, in reload
    self._reload_provs()
  File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 233, in _reload_provs
    self._load(prov.reload(), prov)
  File "/home/user/.local/lib/python3.8/site-packages/scapy/interfaces.py", line 52, in reload
    return self.load()
  File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/linux.py", line 413, in load
    ips = in6_getifaddr()
  File "/home/user/.local/lib/python3.8/site-packages/scapy/arch/linux.py", line 331, in in6_getifaddr
    addr = scapy.utils6.in6_ptop(
  File "/home/user/.local/lib/python3.8/site-packages/scapy/utils6.py", line 697, in in6_ptop
    return inet_ntop(socket.AF_INET6, inet_pton(socket.AF_INET6, str))
  File "/home/user/.local/lib/python3.8/site-packages/scapy/pton_ntop.py", line 93, in inet_pton
    return socket.inet_pton(af, addr)
OSError: can't use AF_INET6, IPv6 is disabled
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='/proc/net/if_inet6'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/__init__.py", line 331, in _sim_event
    scheduler.log.error(msg)
AttributeError: 'NoneType' object has no attribute 'log'
     0.00ns ERROR    gpi                                Passing event to upper layer failed
FST info: dumpfile eth_axis_rx.fst opened for output.
FST warning: sim_build/cocotb_iverilog_dump.v:3: $dumpfile called after $dumpvars started,
                                                 using existing file (eth_axis_rx.fst).
FST warning: ignoring signals in previously scanned scope eth_axis_rx.
ERROR: results.xml was not written by the simulation!
make[1]: *** [/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/share/makefiles/simulators/Makefile.icarus:96: results.xml] Error 1
make[1]: Leaving directory '/home/user/verilog-ethernet/tb/eth_axis_rx'
make: *** [/opt/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/share/makefiles/Makefile.inc:40: sim] Error 2

I found this stackoverflow resource, which states that Python must be configured to have IPv6 support to resolve this issue. However, as it can be seen here, it was disabled:

CONFIG_SITE=config.site ./configure --prefix=${INSTALL_PREFIX} --enable-optimizations --enable-shared --with-system-ffi --with-openssl=/opt/local --host=${CROSS_NAME} --build=`gcc -dumpmachine` --disable-ipv6
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant