Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

2021 LTS - WebGL emcc2 error

Discussion in 'WebGL' started by Arkuni, Apr 14, 2022.

  1. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    42
    Just updated from latest 2020 LTS to latest 2021 LTS. Had to remove WebGL 1 graphic API manually, but still getting the following error when trying to do a clean build.

    Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
    emcc2: error: Invalid command line option -s BINARYEN_TRAP_MODE=clamp: The wasm backend does not support a trap mode (it always clamps, in effect)
    UnityEditor.GenericMenu:CatchMenu (object,string[],int)


    Does anyone know what this means?

    Let me know if I need to provide more details.
     
  2. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    42
    I found the answer myself. I went into my project and just searched for "BINARYEN_TRAP_MODE" in all files. Turns out the they were arguments provided by projectSettings.asset

    Deleting it did the trick.
     
  3. mdangalan

    mdangalan

    Joined:
    Jul 25, 2016
    Posts:
    1
    This did not work for me. ProjectSettings.asset does not contain a "BINARYEN_TRAP_MODE" string. Any help would be appreciated since im stuck with this issue.
     
  4. tomkail_betterup

    tomkail_betterup

    Joined:
    Nov 17, 2021
    Posts:
    59
    We're hitting this too. Since upgrading from 2021.2.7f1 to 2021.3.5f1 our builds fail with this error.
    The Project settings file did indeed contain that argument. It's not visible in the Project Settings window, so it seems it's something that isn't correctly changed on upgrading projects.
     
    Last edited: Jun 29, 2022
  5. brian-nielsen

    brian-nielsen

    Joined:
    Apr 18, 2018
    Posts:
    15
    This worked for me. Bless you beautiful people.
     
  6. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    778
    Background: Emscripten 1.39.0 deprecated this flag, but it was necessary before, see also imgui release notes
    So you should be save by just removing it :)