Greetings,
Since llceflib has been made public and I could also find Callum's
viewer-cef branch on bibucket, I decided to give a try at a Linux build.
CHAPTER 1: an adventure (just kidding !) *
As I anticipated, having llceflib built from the pre-built CEF3 binaries
( https://cefbuilds.com/ ) was quite easy (just a matter of writing two
CMakeLists.txt files, a llceflibimpl.cpp file, a build script (since I
don't use automake and the Linux stuff for it was missing anyway), and
fixing some non-ISO C++ conformant lines that made gcc choke).
Under three hours after I started (which includes the time it took to
backport the plugin code from viewer-cef to the Cool VL Viewer), I had
a successful build...
What I did not anticipate, however, was that libcef.so, while it was
working fine when used from the example cefclient shipped with CEF,
lamentably crashed when loaded from SLPlugin/media_plugin_cef...
The crash was:
*** glibc detected ***
/usr/local/CoolVLViewer-i686-1.26.15.0/bin/llplugin/SLPlugin: free():
invalid size: 0x08442000 ***
=== Backtrace: =
/lib/i686/libc.so.6(+0x6cf32)[0xb722bf32]
/usr/local/CoolVLViewer-i686-1.26.15.0/lib/libcef.so(+0x8fe725)[0xb3720725]
The problem comes from the fact that libcef.so includes... tcmalloc !..
Of course, memory (i.e. classes, etc) allocated by SLPlugin before it
loads media_plugin_cef (which itself causes libcef.so to be loaded by
the dynamic linker), cannot be released afterwards (because then,
SLPlugin gets infected by tcmalloc, and ends up releasing with
tcmalloc's free() strucures that were allocated with the system
malloc()).
That's *really* a *very* stupid thing to link a custom memory allocator
to a dynamic library that may be loaded at any moment (and not only at
the consummer program's startup): CEF coders, shame on you !
The only solution is to rebuild libcef.so without tcmalloc (I also tried
and built the Cool VL Viewer with tcmalloc, since it's one of the options
I can enable with the flip of a cmake variable, but even this doesn't solve
the issue, since the two tcmalloc instances got different heaps and memory
pointers).
After rebuilding, the new, tcmalloc-less libcef.so works just fine. All
in all, and not counting the rebuilding time (building CEF from sources
involves the downloading of 16Gb of sources which take several hours to
compile), it took me just under 6 hours of actual work to have a
functional Linux build of the Cool VL Viewer with CEF.
CHAPTER 2: HOWTOs *
I will give hereafter:
- For TPV developers, the pointers to ready-to-use files so to easily
integrate CEF to their TPV Linux builds.
- For both TPV developers and Linden Lab (the latter stubornely refusing
to reuse my code without a privacy-threatening CA, even though the said
code is GPL/LGPL), directions/hints/advices on how to rebuild CEF on
Linux and integrate it in a Linux viewer build (directions, hints and
advices don't involve any copyright issue, so LL can reuse them without
a CA !... No excuse any more, LL !).
A.- Ready to use stuff (for TPV developers):
- llceflib pre-compiled package with Linux binary (built on a Rosa 2012
system with the following requirements for target systems: glibc v2.13
or newer, libstdc++.so.6.0.16 (gcc v4.6) or newer, libX11 v1.5.0 or
newer, libXi v1.6.0 or newer (the latter two are in fact libcef.so
requirements, see the chapter about runtime dependencies below).
Get it from:
http://sldev.free.fr/libraries/llceflib-linux-no_tcmalloc-20150709.tar.bz2
md5sum: 3dd8afe90b8460da060362fad1de85fd
- Diff file, summing up all the changes I had to do to the Cool VL Viewer
sources. Of course, that diff won't be directly usable as a patch file
for your own viewer, but it will give you pointers and methods to what
need to be changed in your own viewer. The diff file also includes the
backport of Callum's viewer-cef code, with the necessary bug fixes. It
also provides a new feature I implemented, allowing to switch between
the WebKit and the CEF plugin in real time via the new UseCEF debug
variable (i.e., after changing that variable, every newly spawn plugin
uses the corresponding embedded browser). Get it from there:
http://sldev.free.fr/libraries/patches/CoolVLViewer-CEF-diff.txt
The diff was made against the current experimental version of the Cool
VL Viewer, which sources are available (till next Saturday, after they
will be updated to the next release) here:
http://sldev.free.fr/sources/slviewer-src-cool_vl_viewer-1261318.tar.gz
- If you wish to rebuild your own lllceflib library yourself, first make
sure you got the 'ninja' build tool installed on your system as well as
a recent version of cmake (3.0 or newer).
Then simply download the tcmalloc-less CEF3 bundle from:
http://sldev.free.fr/libraries/sources/cef_binary_3.2272.32.gbda8dc7_linux32-no_tcmalloc.tar.bz2
as we