Build libcef.so with gtk3 support

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.

Build libcef.so with gtk3 support

Postby linuxcef9 » Thu Jul 11, 2019 12:34 pm

Hi ,

I am trying to build libcef.so using gtk3. I added use_gtk3=true in GN_DEFINES but that doesn't seem to work.
Can you tell me what steps do I need to follow to enable gtk3 support in libcef.so?

I already have a successful build following the steps : https://bitbucket.org/chromiumembedded/ ... inux-setup
In automate-git.py, I specify cef branch name we want.
These are the defines I use : export GN_DEFINES="use_sysroot=true use_allocator=none symbol_level=1" . Just adding use_gtk3=true didn't work.

Thanks in advance.
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm

Re: Build libcef.so with gtk3 support

Postby magreenblatt » Thu Jul 11, 2019 12:44 pm

Why do you want to build CEF with gtk3 support? Recent versions of CEF have no GTK dependencies at all.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Build libcef.so with gtk3 support

Postby linuxcef9 » Thu Jul 11, 2019 3:01 pm

Why do you want to build CEF with gtk3 support? Recent versions of CEF have no GTK dependencies at all.


Because I first launch cef window and get its window id. I then use it to create an X window with cef window id as parent window.
Finally, I wrap the X window in a gtk3 window so that I can use gtk3 APIs for manipulating the window.
Now all this works fine with gtk2 window.

I know libcef.so has no dependencies on gtk but looks like there are some checks in cef/chromium source code - GTK_CHECK_VERSION
due to which there is crash when I create gtk3 window as parent of cef window. Basically, libcef is fine when I use gtk2 window as parent of cef window
but crashes when I use gtk3 window.

There was one more issue I faced : https://github.com/cztomczak/cefcapi/issues/9 but we could workaround that by using correct visual.
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm

Re: Build libcef.so with gtk3 support

Postby magreenblatt » Thu Jul 11, 2019 3:06 pm

linuxcef9 wrote:I know libcef.so has no dependencies on gtk but looks like there are some checks in cef/chromium source code - GTK_CHECK_VERSION
due to which there is crash when I create gtk3 window as parent of cef window. Basically, libcef is fine when I use gtk2 window as parent of cef window
but crashes when I use gtk3 window.

What CEF version are you using? Can you post the symbolized call stack for one of these crashes?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Build libcef.so with gtk3 support

Postby linuxcef9 » Thu Jul 11, 2019 3:40 pm

What CEF version are you using? Can you post the symbolized call stack for one of these crashes?



CEF version is 3538. Will post the call stack in a bit once I am able to repro the issue again.
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm

Re: Build libcef.so with gtk3 support

Postby magreenblatt » Thu Jul 11, 2019 4:05 pm

The GTK dependency was removed in this issue, and was merged in 3538 branch. You should verify that you're building with that change.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Build libcef.so with gtk3 support

Postby linuxcef9 » Thu Jul 11, 2019 8:30 pm

Below is callstack of crash :

Code: Select all
(gdb) bt
#0  0x0000555555589cda in (anonymous namespace)::XErrorHandlerImpl(Display*, XErrorEvent*) (display=0x55555593a3f0, event=0x7fffffffb6e0)
   at /home/linuxcef9/ttt/cef_binary_3.3538.1849.g458cc98_linux64/tests/cefsimple/cefsimple_linux.cc:13
#1  0x00007fffeceea8fa in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007fffecee782b in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007fffecee78d5 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007fffecee8830 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fffecee41cd in XSync () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007ffff2c8f15e in X11ErrorTracker() () at ./../../ui/gfx/x/x11_error_tracker.cc:29
#7  0x00007ffff2e63790 in SetIntArrayProperty() () at ./../../ui/base/x/x11_util.cc:853
#8  0x00007ffff2e6361a in SetIntProperty() () at ./../../ui/base/x/x11_util.cc:837
#9  0x00007ffff49de21f in InitX11Window() () at ./../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:1611
#10 0x00007ffff49dd59d in Init() () at ./../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:411
#11 0x00007ffff49cfe98 in InitNativeWidget() () at ./../../ui/views/widget/desktop_aura/desktop_native_widget_aura.cc:442
#12 0x00007ffff49b78ea in Init() () at ./../../ui/views/widget/widget.cc:343
#13 0x00007ffff26e2fd9 in Init() () at ../../cef/libcef/browser/native/window_delegate_view.cc:53
#14 0x00007ffff26ddfb7 in CreateHostWindow() () at ../../cef/libcef/browser/native/browser_platform_delegate_native_linux.cc:83
#15 0x00007ffff25be693 in CreateHostWindow () at ../../cef/libcef/browser/browser_host_impl.cc:3259
#16 0x00007ffff25be693 in CreateInternal() () at ../../cef/libcef/browser/browser_host_impl.cc:433
#17 0x00007ffff25bdd5c in Create() () at ../../cef/libcef/browser/browser_host_impl.cc:371
#18 0x00007ffff25bd5b4 in CreateBrowserSync() () at ../../cef/libcef/browser/browser_host_impl.cc:287
#19 0x00007ffff25bced6 in CreateBrowserWithHelper() () at ../../cef/libcef/browser/browser_host_impl.cc:142
#20 0x00007ffff2777873 in Run () at ../../base/callback.h:99
#21 0x00007ffff2777873 in RunTask() () at ./../../base/debug/task_annotator.cc:101
#22 0x00007ffff27a9b67 in RunTask() () at ./../../base/message_loop/message_loop.cc:434
#23 0x00007ffff27aa0b0 in DeferOrRunPendingTask () at ./../../base/message_loop/message_loop.cc:445
#24 0x00007ffff27aa0b0 in DoWork() () at ./../../base/message_loop/message_loop.cc:517
#25 0x00007ffff27ac539 in base::MessagePumpGlib::Run(base::MessagePump::Delegate*) () at ./../../base/message_loop/message_pump_glib.cc:309
#26 0x00007ffff27a9661 in Run() () at ./../../base/message_loop/message_loop.cc:386
#27 0x00007ffff27d4566 in Run() () at ./../../base/run_loop.cc:102
#28 0x00007ffff25e96d4 in CefRunMessageLoop() () at ../../cef/libcef/browser/context.cc:306
#29 0x00005555555c0978 in CefRunMessageLoop() () at /home/linuxcef9/ttt/cef_binary_3.3538.1849.g458cc98_linux64/libcef_dll/wrapper/libcef_dll_wrapper.cc:408
#30 0x000055555558a4d1 in main(int, char**) (argc=10, argv=0x7fffffffddb8) at /home/linuxcef9/ttt/cef_binary_3.3538.1849.g458cc98_linux64/tests/cefsimple/cefsimple_linux.cc:73


And below is stacktrace of xerror handler :

Code: Select all
(gdb) bt
#0  0x0000555555589cda in (anonymous namespace)::XErrorHandlerImpl(Display*, XErrorEvent*) (display=0x55555593a3f0, event=0x7fffffffbbf0)
   at /home/linuxcef9/ttt/cef_binary_3.3538.1849.g458cc98_linux64/tests/cefsimple/cefsimple_linux.cc:13
#1  0x00007fffeceea8fa in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007fffecee782b in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007fffecee78d5 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007fffecee8830 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fffecede716 in XQueryExtension () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007fffeced1ee6 in XInitExtension () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#7  0x00007fffea339fdf in XextAddDisplay () at /usr/lib/x86_64-linux-gnu/libXext.so.6
#8  0x00007fffea3347ab in XShapeCombineRectangles () at /usr/lib/x86_64-linux-gnu/libXext.so.6
#9  0x00007ffff49dfa44 in ResetWindowRegion() () at ./../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:1938
#0  0x0000555555589cda in (anonymous namespace)::XErrorHandlerImpl(Display*, XErrorEvent*) (display=0x55555593a3f0, event=0x7fffffffbfc0)
   at /home/linuxcef9/ttt/cef_binary_3.3538.1849.g458cc98_linux64/tests/cefsimple/cefsimple_linux.cc:13
#1  0x00007fffeceea8fa in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007fffecee782b in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007fffecee78d5 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007fffecee8830 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fffecece435 in XGetWindowProperty () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007fffececdda8 in XGetWMSizeHints () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#7  0x00007ffff49df16b in MapWindow() () at ./../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:1979
#8  0x00007ffff49defe2 in Show() () at ./../../ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:528


The GTK dependency was removed in this issue, and was merged in 3538 branch. You should verify that you're building with that change.


I verified that we have that commit.

Here's some snippet to explain how we create xwindow and wrap it in gtk2 window : https://gist.github.com/mmozeiko/240193 ... b33eab0465
Once that's created, we do window_info.parent_window = <window id of xwindow> so that cef becomes child of our window.
Thus, we are passing a gtk3 window created in a different process to gtk2.

Can you please help figure out where the issue is?

[edited to mention that window is created in different process]
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm

Re: Build libcef.so with gtk3 support

Postby magreenblatt » Thu Jul 11, 2019 8:58 pm

I don’t see anything in those callstacks related to GTK, it’s all just X11. Perhaps GTK3 is making incorrect X11 calls. I suggest you compare those calls to the GTK2 implementation to see how they differ.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Build libcef.so with gtk3 support

Postby Czarek » Sat Jul 13, 2019 4:40 am

Some GTK 3 versions don't work well with CEF, so it's a good idea to test different versions.
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: Build libcef.so with gtk3 support

Postby linuxcef9 » Mon Jul 15, 2019 1:16 pm

Thanks marshall and czarek.

We just fixed things from our app side by using the correct visual so that it works fine with gtk3.
Thanks for your help.
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 193 guests