Search Unity

Webgl build with Brotli compression fails

Discussion in 'Getting Started' started by bginin2this, Apr 24, 2019.

  1. bginin2this

    bginin2this

    Joined:
    Dec 28, 2017
    Posts:
    16
    Hello everyone .-

    I have been trying to deploy a Webgl build to the server, but normal gzip compression doesnt run at my server url or domain, now i have switched to Brotli compression Format at Player Publishing Settings, but it throws to me 3 errors the first one is python realated.-

    Code (csharp):
    1.  
    2. Failed running python "/home/jorgecg/Unity/Hub/Editor/2019.1.0f2/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/python/bro.py" -o "/backup/Unity Projectos/Unity Projectos/Actualizado 21Abril2019/BinaryWritter/Temp/StagingArea/Data/Output/Build/BinaryWritter.data.unityweb.compressed" -i "/backup/Unity Projectos/Unity Projectos/Actualizado 21Abril2019/BinaryWritter/Temp/StagingArea/Data/Output/Build/BinaryWritter.data.unityweb" --comment "UnityWeb Compressed Content (brotli)"
    3.  
    4. stdout:
    5. stderr:Traceback (most recent call last):  File "/home/jorgecg/Unity/Hub/Editor/2019.1.0f2/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/python/bro.py", line 8, in <module>    import brotli  File "/home/jorgecg/Unity/Hub/Editor/2019.1.0f2/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg/brotli.py", line 7, in <module>  File "/home/jorgecg/Unity/Hub/Editor/2019.1.0f2/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg/brotli.py", line 6, in __bootstrap__  File "/usr/lib/python3.7/imp.py", line 342, in load_dynamic    return _load(spec)ImportError: /home/jorgecg/.cache/Python-Eggs/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg-tmp/brotli.so: invalid ELF header
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    7.  
    Oh btw im on Linux, i saw a thread, this one https://issuetracker.unity3d.com/is...-python-lacks-permissions-for-group-and-other in which it explains how to give permissions to the python directory and also to the bro.py python file, i have even created "executable" the file, but the above error persists. I imagine i need to fix this error before the other 2 ones i have while building to Webgl. Thank in advance.
     
    antoined73 likes this.
  2. playspace_seat2

    playspace_seat2

    Joined:
    Jul 13, 2016
    Posts:
    2
    Hi!,

    Any news on this, I'm facing the exact same problem and can't really figure out why?

    Thanks in advance!
     
  3. x4121

    x4121

    Joined:
    Aug 26, 2020
    Posts:
    1
    I was struggling with this for quite a while, I "solved" it by renaming the MacOS egg and creating a symlink to the Linux egg with the name of the previous MacOS egg...
    I honestly don't know why the bro.py tries to load the MacOS egg during the import. There might be something messed up with the environment the Editor tries to start the python script

    In case it was a bit unclear

    cd $UNITY_EDITOR_DIR/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist
    mv Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg.bkup
    ln -s $PWD/Brotli-0.4.0-py2.7-linux-x86_64.egg Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg
     
    ohin and lovechai like this.
  4. iluha_ua

    iluha_ua

    Joined:
    Jan 13, 2021
    Posts:
    1
    I suggest to switch from Brotli to gzip.
    File -> Buld Settings -> Player Settings -> Player -> Publishing Settings -> Compression Format -> Gzip
     
  5. antoined73

    antoined73

    Joined:
    Feb 23, 2014
    Posts:
    24
    Same problem here. I don't want to do manual stuff in the engines, so I'd rather change de compression format for the moment.
    Code (CSharp):
    1. #if UNITY_EDITOR_LINUX
    2.         PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Gzip; // Brotli not working on linux compilation at the moment. See (https://forum.unity.com/threads/webgl-build-with-brotli-compression-fails.666823/)
    3. #else
    4.         PlayerSettings.WebGL.compressionFormat = (devMode ? WebGLCompressionFormat.Gzip : WebGLCompressionFormat.Brotli);
    5. #endif
    Please unity team, do you have any input on this ?
    Thanks
     
    Last edited: Jan 22, 2021
  6. andy_pondy

    andy_pondy

    Joined:
    Dec 11, 2017
    Posts:
    6

    this leads to another problem then

    stderr:Traceback (most recent call last):  File "/home/apatel/Unity/Hub/Editor/2019.4.12f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/python/bro.py", line 8, in <module>    import brotli  File "<frozen zipimport>", line 259, in load_module  File "/home/apatel/Unity/Hub/Editor/2019.4.12f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg/brotli.py", line 7, in <module>  File "/home/apatel/Unity/Hub/Editor/2019.4.12f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg/brotli.py", line 6, in __bootstrap__  File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic    return _load(spec)ImportError: /home/apatel/.cache/Python-Eggs/Brotli-0.4.0-py2.7-macosx-10.10-x86_64.egg-tmp/brotli.so: undefined symbol: Py_InitModule4_64
     
  7. xavierho_mada

    xavierho_mada

    Joined:
    Nov 28, 2021
    Posts:
    1
    Firefox also doesn't support Broti compression and fails at the window, while Chrome launches fine. Switching to gzip as suggested works.
     
  8. alonthegreat

    alonthegreat

    Joined:
    Jan 24, 2014
    Posts:
    1
    gzip works okay on desktop, but then fails if the game runs as WebGL from an iPad browser :oops: I wish there was a catch-all cross platform solution