Search Unity

Preloading Library from within Editor when running Project

Discussion in 'Linux' started by Germanunkol, Sep 19, 2016.

  1. Germanunkol

    Germanunkol

    Joined:
    Oct 25, 2015
    Posts:
    11
    I am trying to integrate Chromium into my project, using the CEF and the ChromiumFX project for C#-Wrappings.

    When running a ChromiumFX sample project, I need to preload the libcef.so library (because of this issue) like so:
    LD_PRELOAD=libcef.so exec mono Windowless.exe "$@"

    First Question: How do I preload the library when I run the script from within the unity editor?
    I.e. what's the unity-internal equivalent of LD_PRELOAD? I've tried starting Unity with LD_PRELOAD=libcef.so, but that doesn't help, and I've experimented with the Plugins folders, but no luck there, either.

    Second Question: I've built the project and then run this with the LD_PRELOAD command. It runs and finds the libraries successfully. However, there's another issue:
    The default unity input-setup screen shows up, I choose a resolution and start the project. It shows the Made-With-Unity animation. Then the screen goes gray. At this point, there's nothing in Player.log besides a Gtk-Warning message saying that it can't find UnityPlayer.png. Then, the input-setup screen pops up a second time, as if it restarts the game. If I choose any resolution and hit "Ok", it shows the Made-With-Unity animation a second time and then crashes, without error message. The
    This may have something to do with chromium being a multi-process library, but I've set it to run in a single process, so this shouldn't be the issue?
    So why does unity start a second time?
     
    Last edited: Sep 19, 2016
  2. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Unity uses (its own version of) CEF internally - I'm not sure it will work to load another version in the editor.

    That's a good question. I know chrome likes to use /proc/self/exe to manage its own processes - are you sure you've successfully disabled multiprocess mode?
     
  3. Germanunkol

    Germanunkol

    Joined:
    Oct 25, 2015
    Posts:
    11
    Thanks a lot for the quick reply!
    Ah, yes, I noticed that. It's probably used for the Asset Store?
    Is there maybe a way to use this already included version while running from the editor? I'm guessing this would be pretty complicated...

    You're right, this is what's happening. I don't know why, but for some reason the lline "CfxSettings.SingleProcess = true" doesn't do anything in ChromiumFX. I posted an issue over on their site.
    Now I've moved to a dedicated "SubProcess" executable, so that it doesn't start the main Unity Build multiple times. This works (i.e. it starts the SubProcess executable when it tries to start a new process), but for some reason crashes with a segfault just a short time after.
    The segfault seems to come from within libcef.so. I will try to rebuild this lib in debug mode, in the hopes of getting more info out of it then. Any other hints on how to best debug a segfault in a standalone executable?