libcef.so: cannot open shared object file: No such file

Having problems with building or using CEF? This forum is here to help. Please do not post bug reports or feature requests here.

libcef.so: cannot open shared object file: No such file

Postby cdunham » Tue Jun 25, 2013 4:24 pm

I am running Linux Mint and attempting to build an application that uses CEF3. Everything compiles fine, but when I try to run the resulting application I get the following error:

Code: Select all
./test: error while loading shared libraries: libcef.so: cannot open shared object file: No such file or directory


I've been working on getting this simple test up and running for the better part of a day.

Here is the stats on my machine:
Code: Select all
$ ~/Downloads/cef_binary_3.1453.1255_linux64 $ uname -a
Linux mymachine 3.5.0-27-generic #46-Ubuntu SMP Mon Mar 25 19:58:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


I have downloaded cef_binary_3.1453.1255_linux64.7z from the downloads page and can build the cefclient application just fine

Code: Select all
./build.sh Debug V=1
  TOUCH out/Debug/obj.target/gtk.stamp
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/transfer_util.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/cef_stream_resource_handler.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/cef_byte_read_handler.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/cef_xml_object.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/cef_zip_archive.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/libcef_dll_wrapper.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/wrapper/libcef_dll_wrapper2.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/allow_certificate_error_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/app_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/auth_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/browser_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/binary_value_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/before_download_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/browser_host_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/browser_process_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/client_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/command_line_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/completion_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/context_menu_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/context_menu_params_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/cookie_manager_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/cookie_visitor_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/domdocument_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/domevent_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/domevent_listener_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/domnode_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/domvisitor_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/dialog_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/dictionary_value_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/display_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/download_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/download_item_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/download_item_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/file_dialog_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/focus_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/frame_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/geolocation_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/geolocation_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/jsdialog_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/jsdialog_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/keyboard_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/life_span_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/list_value_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/load_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/menu_model_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/post_data_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/post_data_element_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/process_message_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/quota_callback_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/read_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/render_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/render_process_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/request_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/request_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/resource_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/response_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/scheme_registrar_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/stream_reader_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/stream_writer_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/string_visitor_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/task_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/task_runner_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/trace_client_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/urlrequest_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/urlrequest_client_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/v8accessor_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/v8context_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/v8exception_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/v8handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/v8stack_frame_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/v8stack_trace_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/v8value_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/web_plugin_info_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/cpptoc/write_handler_cpptoc.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/xml_reader_ctocpp.o
  CXX(target) out/Debug/obj.target/libcef_dll_wrapper/libcef_dll/ctocpp/zip_reader_ctocpp.o
  AR(target) out/Debug/obj.target/libcef_dll_wrapper.a
  COPY out/Debug/files/dialogs.html
  COPY out/Debug/files/binding.html
  COPY out/Debug/files/domaccess.html
  COPY out/Debug/files/localstorage.html
  COPY out/Debug/files/logo.png
  COPY out/Debug/files/other_tests.html
  COPY out/Debug/files/performance.html
  COPY out/Debug/files/transparency.html
  COPY out/Debug/files/window.html
  COPY out/Debug/files/xmlhttprequest.html
  COPY out/Debug/cef.pak
  COPY out/Debug/devtools_resources.pak
  COPY out/Debug/locales
  COPY out/Debug/libcef.so
  CXX(target) out/Debug/obj.target/cefclient/cefclient/cefclient.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/binding_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_app.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_app_delegates.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_handler.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_renderer.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_switches.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/dialog_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/dom_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/performance_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/performance_test_tests.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/scheme_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/string_util.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/window_test.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/cefclient_gtk.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/client_handler_gtk.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/resource_util_linux.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/resource_util_posix.o
  CXX(target) out/Debug/obj.target/cefclient/cefclient/window_test_gtk.o
  LINK(target) out/Debug/cefclient
  LINK(target) out/Debug/cefclient: Finished


I can also run cefclient just fine. Window opens and everything works well.

I started off following http://blog.erikd.org/2013/01/14/chromium-embedded-framework-3-bare-bones/ and am trying to compile and link the following very short application

Code: Select all
#include <gtk/gtk.h>

#include "include/cef_app.h"
#include "include/cef_client.h"

class CefHandler : public CefClient {
    public:
        CefHandler() {}
        ~CefHandler() {}

        IMPLEMENT_REFCOUNTING(CefHandler);
};

CefRefPtr<CefHandler> g_handler;

int main(int argc, char *argv[]) {
    CefMainArgs main_args(argc, argv);

    int exitCode = CefExecuteProcess(main_args, NULL);
    if (exitCode >= 0) {
        return exitCode;
    }
    return 0;
}


Here is the g++ command line that I am using

Code: Select all
g++ -Ilib/cef3 -o build/test `pkg-config --cflags gtk+-2.0` main.cpp -Llib/cef3/Debug -lcef -lcef_dll_wrapper `pkg-config --libs gtk+-2.0`


In the lib/cef3/Debug directory is the libcef.so that is placed in /out/Debug/ when I run the build.sh Debug to build the cefclient application. I'm guessing I am missing something regarding the use of the libcef_dll_wrapper. I also just copy the cef3 include files into the lib/cef3 directory.

What is the correct placement of these files relative to each other? As a side note, I also can not run the ce3barebones application. I have cloned it from the github repo here https://github.com/aphistic/cef3barebones and I replaced all of the files with the new ones that I have built from the CEF3 download.

Thanks,
Casey
cdunham
Newbie
 
Posts: 3
Joined: Tue Jun 25, 2013 11:10 am

Re: libcef.so: cannot open shared object file: No such file

Postby cdunham » Tue Jun 25, 2013 8:24 pm

Well, I seemed to get it to work, by changing the command to

Code: Select all
$ LD_LIBRARY_PATH=. ./test


That runs it. But I am not completely understanding why I have to do it for my compiled code, but I don't need to do it for the cefclient? I can run that just as you would expect

Code: Select all
$ ./cefclient


So at least I'm sure it isn't just my compilation!
cdunham
Newbie
 
Posts: 3
Joined: Tue Jun 25, 2013 11:10 am

Re: libcef.so: cannot open shared object file: No such file

Postby Czarek » Wed Jun 26, 2013 2:06 am

Add this switch when linking:

Code: Select all
-Wl,-rpath,.


From the cefclient.gyp file:

Code: Select all
          'link_settings': {
            'ldflags': [
              # Look for libcef.so in the current directory. Path can also be
              # specified using the LD_LIBRARY_PATH environment variable.
              '-Wl,-rpath,.',
            ],


Using LD_LIBRARY_PATH is not portable across systems.
Maintainer of the CEF Python, PHP Desktop, CEF2go and CEF C API projects.
User avatar
Czarek
Genius
 
Posts: 1096
Joined: Sun Nov 06, 2011 2:12 am
Location: Poland

Re: libcef.so: cannot open shared object file: No such file

Postby cdunham » Wed Jun 26, 2013 8:06 am

That worked, awesome thanks!

Really appreciate the help.

Just in case anyone else runs into this, the updated command is

Code: Select all
g++ -Ilib/cef3 -o build/test `pkg-config --cflags gtk+-2.0` main.cpp -Llib/cef3/Debug -lcef -lcef_dll_wrapper -Wl,-rpath,. `pkg-config --libs gtk+-2.0`
cdunham
Newbie
 
Posts: 3
Joined: Tue Jun 25, 2013 11:10 am


Return to Support Forum

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], HarmlessDave and 9 guests