Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question WebGL build fails on Ubuntu 20

Discussion in 'Web' started by blackbirddev, Sep 11, 2023.

  1. blackbirddev

    blackbirddev

    Joined:
    Jul 23, 2021
    Posts:
    8
    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'
    ```
     

    Attached Files:

  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    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...named-ctypes-when-using-value-from-module-mul

    that suggests

    "Installing libffi-dev and re-installing python3.7 fixed the problem for me."
     
  3. blackbirddev

    blackbirddev

    Joined:
    Jul 23, 2021
    Posts:
    8
    I have such a breakdown, perhaps I once damaged the python. I don't know what to do. everything suggests installing Ubuntu
     

    Attached Files:

  4. blackbirddev

    blackbirddev

    Joined:
    Jul 23, 2021
    Posts:
    8
    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 "<string>", line 1, in <module>
    File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
    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
     
    unityruba likes this.
  5. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Awesome, the Linux systems sometimes need some tough sudo love to work.