Linux: Libraries/Resources in Subdirectory

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Linux: Libraries/Resources in Subdirectory

Postby zerodefect » Tue Feb 20, 2018 12:22 pm

Current application/folder setup within a Linux environment:

Code: Select all
Application/
    myApp
    tpsdks/  <=  ("Third Party SDKS") CEF3 is in a subdirectory
        libcef.so
        icudtl.dat
        libEGL.so, libGLESv2.so, ...
        cef.pak, devtools_resources.pak, ...
        natives_blob.bin, snapshot_blob.bin
        locales/
            en-US.pak, ...


I've had a good read of the 'General Usage'. I appreciate that what I'm trying to achieve is quite different from the default/outlined application structure within the wiki. The code for my application looks something like:

Code: Select all
    CefMainArgs main_args(argc, argv);
    CefSettings settings;

    // Specify the path for the sub-process executable.
    CefString(&settings.browser_subprocess_path).FromWString(L"cb_html5_renderer");

    CefString(&settings.resources_dir_path).FromWString(L"tpsdks");
    CefString(&settings.locales_dir_path).FromWString(L"tpsdks");

    settings.windowless_rendering_enabled = 1;

    // Crash! Bang! Boom!
    // Everything goes wrong here.
    CefInitialize(main_args, settings, nullptr, nullptr);

    CefRunMessageLoop();

    CefShutdown();


Subprocess:

Code: Select all
int main(int argc, char* argv[])
{
    // Structure for passing command-line arguments.
    // The definition of this structure is platform-specific.
    CefMainArgs main_args(argc, argv);

    // Execute the sub-process logic. This will block until the sub-process should exit.
    return CefExecuteProcess(main_args, nullptr, nullptr);
}


The problem I'm having is that a call to 'CefInitialize(...)' will always crash. I've tried variations of the above code but to no avail. Now with some variations of my code, there is a log message to stdout/stderr complaining that 'icudtl.dat' cannot be located.

If I move the various CEF files to the application directory, I can get it working (with a few tweaks to the code).

A few questions I had:
  • Is what I'm trying to achieve possible?
  • Can the various 'settings' configuration paths be relative?
  • Must I set LD_LIBRARY_PATH? (I have tried messing with this a bit)

One other question...can I run CefMainArgs, CefInitialize, CefRunMessageLoop, CefShutdown in a separate thread of the main application thread? Am I asking for trouble?

Running on Ubuntu 17.10 with gcc 7.2.
zerodefect
Techie
 
Posts: 26
Joined: Tue Feb 20, 2018 11:24 am

Re: Linux: Libraries/Resources in Subdirectory

Postby Czarek » Tue Feb 20, 2018 12:45 pm

icudlt.dat issue is https://bitbucket.org/chromiumembedded/ ... e-on-linux

Use absolute paths to be safe.

CefInitialize, CefShutdown, CefRunMessageLoop must be called on main application thread, as documentation in cef_app.h states.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Linux: Libraries/Resources in Subdirectory

Postby zerodefect » Tue Feb 20, 2018 4:17 pm

Thanks for your response.

Can I overcome my problem with your patch (loading icudtl.dat)? If I apply your patch, what do I need to set code-wise given my example above. Sorry, I'm not too familiar with the CEF API.
zerodefect
Techie
 
Posts: 26
Joined: Tue Feb 20, 2018 11:24 am

Re: Linux: Libraries/Resources in Subdirectory

Postby Czarek » Wed Feb 21, 2018 5:24 am

See code here in first comment https://github.com/chromiumembedded/cef/pull/4
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 38 guests