openwrt / openwrt/packages

_testcapi | ipq40xx generic | ModuleNotFoundError when extra C flags used

Open
#23,607 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Maintainer: not sure it's relevant, this package may not be intentionally included
Environment: armv7-a | GL.iNet GL-A1300 | ipq40xx/generic | master

Anytime a kernel C flag or target C flag is added in menuconfig it results in this error. I've tried several combinations of them with no change in reults. Anytime there is something custom there, it cannot find this python module _testcapi. This error doesn't show up until near the end of compilation, and all 10 times I have tested it this is the steps I take

make dirclean
make menuconfig / save
make -jnproc V=sc (make V=sc didn't make a difference)

I don't even know where to being with this. The flags I was trying to use were different combinations/ommissions of these

-mtune=cortex-a7
-mfpu=neon-vfpv4
-mfloat-abi=hard
-O2
-O3
-funsafe-math-optimizations (tried after it was failing)

The target c flags were default to -O2 -pipe, so I left that there or change -O2 to -O3.

The build works perfectly fine as is without the extra C flags added. I've attached my working configuration file.
config.buildinfo.zip

Error

0:02:55 load avg: 3.62 [37/44] test_sqlite3
Failed to import test module: test.test_sqlite3.test_dbapi
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

Failed to import test module: test.test_sqlite3.test_dump
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dump.py", line 5, in <module>
    from .test_dbapi import memory_database
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

Failed to import test module: test.test_sqlite3.test_hooks
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_hooks.py", line 29, in <module>
    from test.test_sqlite3.test_dbapi import memory_database, cx_limit
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

Failed to import test module: test.test_sqlite3.test_regression
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_regression.py", line 31, in <module>
    from test.test_sqlite3.test_dbapi import memory_database, cx_limit
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

Failed to import test module: test.test_sqlite3.test_transactions
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_transactions.py", line 28, in <module>
    from test.test_sqlite3.test_dbapi import memory_database
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

Failed to import test module: test.test_sqlite3.test_userfunctions
Traceback (most recent call last):
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_userfunctions.py", line 35, in <module>
    from test.test_sqlite3.test_dbapi import cx_limit
  File "/home/knuxyl/Mount/4tb/system/git/openwrt/build_dir/hostpkg/Python-3.11.7/Lib/test/test_sqlite3/test_dbapi.py", line 37, in <module>
    from _testcapi import INT_MAX, ULLONG_MAX
ModuleNotFoundError: No module named '_testcapi'

0:02:55 load avg: 3.62 [38/44] test_statistics -- test_sqlite3 failed (uncaught exception)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with make dirclean, make menuconfig, and make -jnproc V=sc using the reported ARM target and extra C flags. Inspect build_dir/hostpkg/Python-3.11.7 and the failing test.test_sqlite3 imports, especially _testcapi; done means the configured build completes without the ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.