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.
  2. Dismiss Notice

Bug Cross compilation from Windows to Linux seems broken on 2022

Discussion in 'Linux' started by camille_viot_avatar_medical, Jul 20, 2023.

  1. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    Hi,

    I am trying to deploy a Linux build done from Windows but I have trouble running it with 2022. My repro project so far is a bare bone project with the sample of the com.unity.renderstreaming package imported on nothing else.

    With Unity 2021:
    * The build succeed
    * I copy the output to a computer running Ubuntu (more on that later)
    * The exe starts and everything run fine

    Now with Unity 2022.3.4f1:
    * The build succeed
    * I copy the output to the same computer that earlier
    * The exe stop immediately complaining that it doesn't find libX11.so (see attached PlayerLog)

    About the computer, I tested on 2. A real one with a NVidia GPU hosted on AWS running Ubuntu 18. One inside a Hyper-V VM running Ubuntu 22. The results were the same on both.

    Any ideas what is happening?
     

    Attached Files:

  2. tylerinthezoo

    tylerinthezoo

    Unity Technologies

    Joined:
    Jun 15, 2022
    Posts:
    82
    did you try ldd on your built player? it looks like the loader does not find the x11 dependency.
     
  3. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    No. I know ldd from name and just get a rough idea. Can you elaborate on what I need to know with it please?
     
  4. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    Well I just ran ldd on the 2021 and 2022 version and the output are very similar:

    2021

    Code (csharp):
    1.  
    2.     linux-vdso.so.1 (0x00007ffc176ee000)
    3.     UnityPlayer.so => /home/ubuntu/TestCamille/UnitySamples2021/./UnityPlayer.so (0x00007fbc72e89000)
    4.     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbc72aeb000)
    5.     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbc728d3000)
    6.     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbc726b4000)
    7.     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbc722c3000)
    8.     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbc720bf000)
    9.     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbc71eb7000)
    10.     /lib64/ld-linux-x86-64.so.2 (0x00007fbc7502d000)
    11.  
    2022
    Code (csharp):
    1.  
    2.    linux-vdso.so.1 (0x00007ffe49be1000)
    3.    UnityPlayer.so => /home/ubuntu/TestCamille/UnitySamples2022/./UnityPlayer.so (0x00007fe1a053f000)
    4.    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe1a01a1000)
    5.    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe19ff89000)
    6.    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe19fd6a000)
    7.    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe19f979000)
    8.    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe19f775000)
    9.    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe19f56d000)
    10.    /lib64/ld-linux-x86-64.so.2 (0x00007fe1a2565000)
    11.  
     
  5. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    Reading some articles online I managed to launch the executable from the command line with the the following command

    Code (csharp):
    1. export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libX11.so.6
    Not sure why this is needed though.
     
    Last edited: Jul 25, 2023
  6. tylerinthezoo

    tylerinthezoo

    Unity Technologies

    Joined:
    Jun 15, 2022
    Posts:
    82
    ldd is the linker and loader program on linux which tells the dependencies of the libraries. I just throw this there as the log suggests there is a library missing from implib-gen: libX11.so: failed to load library, and implib-gen seems to be doing a lazy load at runtime and try to find the x11 library which it failed. implib-gen seems to be a plugin that you used in your code, which im not sure what it's loading and why it's loading it.
     
  7. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    Make sense for the first part. But for the other I have no code today, just the official sample for WebRTC and Render streaming. What is really is that the change of behavior between Unity 2021 and 2022.
     
    Last edited: Jul 25, 2023
  8. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    tylerinthezoo likes this.
  9. tylerinthezoo

    tylerinthezoo

    Unity Technologies

    Joined:
    Jun 15, 2022
    Posts:
    82
    okay, this is indeed a plugin, although it seems like an unity official plugin i guess. Look at the code, it is just doing a dlopen on the x11 library and it assumes this comes by default on the system, and then the rest of it depends on the loader, so if dlopen could not find the x11 lib, it basically means that it is not in the system lib. You could check whether there is a libX11.so in /lib. You might have a versioned libX11.so.6, but it does not look for that and you successfully run the program after using ld_preload since it loaded all the symbols from libx11.so.6 which happened to be the same symbols used in the functions.
     
  10. camille_viot_avatar_medical

    camille_viot_avatar_medical

    Joined:
    Jun 20, 2023
    Posts:
    9
    Thanks for details. From the top of my head (I have to verify) I had indeed a libX11.so.6 but not a symlink named libX11.so.
    Do you think I should open an issue on the package? Also, since it worked out of the box with Unity 20221 but not 2022 does this mean that somehow Unity 2021 did some trick regarding library loading and that way the plugin "just" worked?
     
  11. tylerinthezoo

    tylerinthezoo

    Unity Technologies

    Joined:
    Jun 15, 2022
    Posts:
    82
    i am not sure what kind of system you are on. Ubuntu should have the symlink for libX11. I would doubt that It is a code change since there is no need to change the code if the code was doing a exhaustive search. (from full search to just dlopen seems like a downgrade to me)