Search Unity

How to find which version of emsdk to install to build for WebGL on Ubuntu

Discussion in 'Web' started by lovechai, Apr 26, 2021.

  1. lovechai

    lovechai

    Joined:
    Feb 16, 2018
    Posts:
    2
    ./emsdk install x.xx.xx // <--- how to determine which version to use?
    I'm using Unity Version 2020.1.3f1
     
  2. brendanduncan

    brendanduncan

    Joined:
    Jul 26, 2017
    Posts:
    3
    Unity includes Emscripten internally, you don't need to install your own emsdk to build on Linux.
     
  3. lovechai

    lovechai

    Joined:
    Feb 16, 2018
    Posts:
    2
    In theory sure... I had to build on Windows because the Linux WebGL build did not work and I had no means to debug the build process.
     
  4. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    We are using Emscripten 1.38.11 for Unity < 2021.2.

    For Unity >= 2021.2 Beta we will 99% likely be using Emscripten 2.0.19. (I'll give a 1% chance for some catastrophic regression that requires us to temporarily back it out..)

    Though like Brendan wrote, on each platform one should not need to install Emsdk themselves. We currently support only Ubuntu 18.04 and Ubuntu 20.04 distributions for Linux. If you are still interested, give Linux another go after Unity 2021.2 Beta becomes available, hopefully the new compiler will fix up the build process (I did spend quite a bit of time on the Linux build testing for 2021.2)
     
    DrViJ likes this.
  5. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    @jukka_j How can we set the environment variables with unity supplied emscripten? It does not contain sdk folder. I am trying to compile a huge c++ library and it builds with newer version of emscripten 2.0.X but not with old version of emscripten like 1.38.11.

    One more thing, newer version of emscripten does not build .bc file. Only .a file, how are we suppose to put .a file in plugin folder and let unity compile it along ?
     
  6. Jeff-Kesselman

    Jeff-Kesselman

    Joined:
    Apr 5, 2010
    Posts:
    99
    If you mean on the emscripten command line, You can set PlayerSettings.WebGL.emscriptenArgs = "your args"

    AIUI you just set that in an editor script before starting your build.
     
  7. Jeff-Kesselman

    Jeff-Kesselman

    Joined:
    Apr 5, 2010
    Posts:
    99
    Does 2021 support V8 4GB wasm linear memory as shipped, or do we have to hack that in to your memory growth code?
     
  8. jowitt_msft

    jowitt_msft

    Joined:
    Feb 11, 2016
    Posts:
    16
    We're using the .a files and they've been working well in Unity.
     
  9. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    Can you provide more detail? And which version of unity you use?
     
  10. alex_dossamer

    alex_dossamer

    Joined:
    Jun 19, 2018
    Posts:
    25
    Hello! I'm very sorry to necro a dead thread--

    I wanted to link you to an issue related to FMOD, WebGL, and Unity's version of Emscripten:
    https://qa.fmod.com/t/unity-2021-2-0f1-webgl-build-failures-emscripten/17881/6

    FMOD's webGL binaries are built against emscripten 2.0.20; as far as I can tell, in Unity 2021.2.8f1, the bundled version of emscripten is still 2.0.19.

    I'm running into the following issue (stack traces in the linked thread):
    On a local M1 mac laptop, I can build a game with WebGL for FMOD successfully. It runs in browser served from localhost fine.

    Using an Ubuntu-20.04 runner on GitHub Actions with game-ci's Unity cloud build, the linker wasm-ld fails when it hits the FMOD webgl binary (see link for details).

    This is a blocking issue for me, because my team's playtesting approach relies on cloud builds functioning--any thoughts on how to remediate the issue? Thank you!! --Alex
     
  11. shortChangeDev

    shortChangeDev

    Joined:
    Oct 22, 2016
    Posts:
    3
    Hi! Have you found a solution ? I'm encountering the same issue.
     
  12. alex_dossamer

    alex_dossamer

    Joined:
    Jun 19, 2018
    Posts:
    25