WebGL build fails on Ubuntu 20

I’m trying to build a project for the web, but I’m getting these errors. I don’t know how to fix it. Help me

Building Library/Bee/artifacts/WebGL/il2cpp/release_WebGL_wasm/w0pr1fsran19.o failed with output:
Traceback (most recent call last):
File "/mnt/work/gamedev/engine/unity3d/2022.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten/emcc.py", line 23, in <module>
from tools.toolchain_profiler import ToolchainProfiler
File "/mnt/work/gamedev/engine/unity3d/2022.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten/tools/toolchain_profiler.py", line 17, in <module>
from . import response_file
File "/mnt/work/gamedev/engine/unity3d/2022.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten/tools/response_file.py", line 10, in <module>
from .utils import WINDOWS
File "/mnt/work/gamedev/engine/unity3d/2022.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten/tools/utils.py", line 11, in <module>
from . import diagnostics
File "/mnt/work/gamedev/engine/unity3d/2022.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten/tools/diagnostics.py", line 9, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'

Well that is quite odd. Python 3.8 should definitely be new enough. The error seems some kind of internal Python bug, since it is Python’s own init.py that fails to import its own submodule.

Searching the error message on the web, I find a hit like this

https://stackoverflow.com/questions/27022373/python3-importerror-no-module-named-ctypes-when-using-value-from-module-mul

that suggests

“Installing libffi-dev and re-installing python3.7 fixed the problem for me.”

I have such a breakdown, perhaps I once damaged the python. I don’t know what to do. everything suggests installing Ubuntu

9286981--1301632--Screenshot from 2023-09-11 19-36-30.png

I fixed it, the system Python was broken, in my opinion it was still a long time ago.

Was:
/usr/local/bin/python3.8 -c “import ctypes”
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.8/ctypes/init.py”, line 7, in
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named ‘_ctypes’

I did:
sudo rm /usr/local/bin/python3.8
sudo ln -s /home/technoninja/.pyenv/shims/python3.8 /usr/local/bin/python3.8

Be sure to pay attention to pyenv

1 Like

Awesome, the Linux systems sometimes need some tough sudo love to work.