Bug 183595

Summary: Cmake for static build of libjavascriptcoregtk and libwebkit2gtk fails: install TARGETS given no ARCHIVE DESTINATION for static library target "WebKit".
Product: WebKit Reporter: Didier Spaier <didier>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: bugs-noreply, didier, mcatanzaro, sfroberg13, stefan.froberg
Priority: P2    
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
log of Cmake
none
patch for static build
none
Config log most features enabled)
none
Build log (most features enabled).
none
Patch for building static webkitgtk
none
Patch for building without OpenGL part 1/2
none
Patch for building without OpenGL part 2/2
none
Buid log as shared. none

Description Didier Spaier 2018-03-13 08:07:06 PDT
Created attachment 335694 [details]
log of Cmake

Version: 2.20.0

I maintain the Slint distribution, cf. http://slint.fr

I want to make a bundle of yelp + a stripped down webkitgtk because Slint is a stable distribution thus I can't upgrade webkit often but don't want to put users at risk no doing so. I assume that there are few risks is webkit is only used by yelp, aka gnome-help, as we ship MATE of which several components can benefit

In that aim I tried to statically build striped down libjavascriptcoregtk and libwebkit2gtk.

Having read https://bugs.webkit.org/show_bug.cgi?id=181695 I patch the source files as in the patch pasted below:
==================================
diff -Naur webkitgtk-2.20.0/CMakeLists.txt webkitgtk-2.20.0.new/CMakeLists.txt
--- webkitgtk-2.20.0/CMakeLists.txt	2018-02-19 08:44:43.000000000 +0100
+++ webkitgtk-2.20.0.new/CMakeLists.txt	2018-03-13 10:26:05.257118833 +0100
@@ -129,10 +129,10 @@
 set(PAL_LIBRARY_TYPE STATIC)
 set(WebCore_LIBRARY_TYPE STATIC)
 set(WebKitLegacy_LIBRARY_TYPE SHARED)
-set(WebKit_LIBRARY_TYPE SHARED)
+set(WebKit_LIBRARY_TYPE STATIC)
 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
 
-set(CMAKE_POSITION_INDEPENDENT_CODE True)
+# set(CMAKE_POSITION_INDEPENDENT_CODE True)
 
 # -----------------------------------------------------------------------------
 # Install JavaScript shell
diff -Naur webkitgtk-2.20.0/Source/cmake/OptionsGTK.cmake webkitgtk-2.20.0.new/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.20.0/Source/cmake/OptionsGTK.cmake	2018-03-12 10:28:34.000000000 +0100
+++ webkitgtk-2.20.0.new/Source/cmake/OptionsGTK.cmake	2018-03-13 10:27:58.120795554 +0100
@@ -72,7 +72,7 @@
 # and the option is not relevant to any other WebKit ports.
 WEBKIT_OPTION_DEFINE(ENABLE_GLES2 "Whether to enable OpenGL ES 2.0." PUBLIC ${ENABLE_GLES2_DEFAULT})
 WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
-WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC OFF)
 WEBKIT_OPTION_DEFINE(ENABLE_OPENGL "Whether to use OpenGL." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(ENABLE_PLUGIN_PROCESS_GTK2 "Whether to build WebKitPluginProcess2 to load GTK2 based plugins." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(ENABLE_QUARTZ_TARGET "Whether to enable support for the Quartz windowing target." PUBLIC ${GTK3_SUPPORTS_QUARTZ})
@@ -374,7 +374,7 @@
 set(WebKit2_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/WebKit/webkit2gtk-${WEBKITGTK_API_VERSION}.pc)
 set(WebKit2WebExtension_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/WebKit/webkit2gtk-web-extension-${WEBKITGTK_API_VERSION}.pc)
 
-set(JavaScriptCore_LIBRARY_TYPE SHARED)
+# set(JavaScriptCore_LIBRARY_TYPE SHARED)
 set(SHOULD_INSTALL_JS_SHELL ON)
 
 # Add a typelib file to the list of all typelib dependencies. This makes it easy to
========================
I try then to configure as below:
========================
LIBDIRSUFFIX="64"
CFLAGS="-Wno-expansion-to-defined"
CXXFLAGS="-Wno-expansion-to-defined"
CXXFLAGS+=" -fno-delete-null-pointer-checks"
CFLAGS+=" -fno-delete-null-pointer-checks"
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_DRAG_SUPPORT=OFF \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_ICONDATABASE=OFF \
-DENABLE_INDEXED_DATABASE=OFF \
-DENABLE_NOTIFICATIONS=OFF \
-DENABLE_PLUGIN_PROCESS_GTK2=OFF \
-DENABLE_SPELLCHECK=OFF \
-DENABLE_VIDEO=OFF \
-DENABLE_WEBDRIVER=OFF \
-DENABLE_WEB_AUDIO=OFF \
-DENABLE_WEB_CRYPTO=OFF \
-DLIBEXEC_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX}/webkit2gtk-4.0 \
-DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
-DPORT=GTK \
-DSHARED_CORE=OFF \
-DUSE_LIBHYPHEN=OFF \
-DUSE_LIBNOTIFY=OFF \
-DUSE_LIBSECRET=OFF \
-DUSE_SYSTEM_MALLOC=ON \
-DUSE_WOFF2=OFF \
.. 2>&1| tee ../../CONFIGLOGSTATIC-2.20.0
===================
But this fails with this error message:
===================
CMake Error at Source/WebKit/CMakeLists.txt:996 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "WebKit".
===================
I attach the output CONFIGLOGSTATIC-2.20.0.

Please advise, bearing in mind that I am not a developer, so do not hesitate to state the obvious.
Comment 1 Michael Catanzaro 2018-03-13 09:06:12 PDT
You're trying to do something unsupported that nobody has ever managed to do successfully before, so hiring a software developer would certainly be advisable. Notice that in bug #181695, the developer did not manage to get JavaScript working at all. WebKit is intended to be installed as a shared library; if you build it as a static library, you're going to effectively have 4-5 different copies of it installed, one static linked into each secondary process, so the already-huge installed size will balloon.

You're also disabling a ton of unsupported hidden build flags, so even if you were trying to do a shared library build, I wouldn't expect it to work.

(In reply to Didier Spaier from comment #0)
> CMake Error at Source/WebKit/CMakeLists.txt:996 (install):
>   install TARGETS given no ARCHIVE DESTINATION for static library target
>   "WebKit".

I guess it wants you to tell it where to install it.
Comment 2 Stefan Fröberg 2018-03-13 09:32:26 PDT
Add this to Source/WebKit/CMakeLists.txt

install(TARGETS WebKit WebProcess NetworkProcess
        ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
        LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
        RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}"
    )


Actually, I managed to get static JavaScriptCore work, but it was only after I switched static musl compiled *Process files with static glibc compiled process files. Then it worked.

But still as today, have no clue why the musl-compiled three *Process files caused the problem .....
Comment 3 Michael Catanzaro 2018-03-13 09:44:05 PDT
(In reply to Michael Catanzaro from comment #1)
> You're trying to do something unsupported that nobody has ever managed to do
> successfully before

I stand corrected! :)
Comment 4 Didier Spaier 2018-03-13 10:40:37 PDT
Well, at I did manage to build 2.18.6 at least as shared with this:

-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_DRAG_SUPPORT=OFF \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_ICONDATABASE=OFF \
-DENABLE_INDEXED_DATABASE=OFF \
-DENABLE_NOTIFICATIONS=OFF \
-DENABLE_PLUGIN_PROCESS_GTK2=OFF \
-DENABLE_SPELLCHECK=OFF \
-DENABLE_VIDEO=OFF \
-DENABLE_WEBDRIVER=OFF \
-DENABLE_WEB_AUDIO=OFF \
-DENABLE_WEB_CRYPTO=OFF \
-DLIBEXEC_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX}/webkit2gtk-4.0 \
-DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
-DPORT=GTK \
-DUSE_LIBHYPHEN=OFF \
-DUSE_LIBNOTIFY=OFF \
-DUSE_LIBSECRET=OFF \
-DUSE_SYSTEM_MALLOC=ON \
..

I will try Stefan's code snippet and, if I succeed, will check the size.

If it's too big, I will ship it as shared but in in a "hidden" path and use a wrapper script that sets LD_LIBRARY_PATH then exec yelp-binary.

Ugly workaround maybe, but that works

I'll need some days to try, then will report the outcome.

Thanks to both of you.
Comment 5 Stefan Fröberg 2018-03-13 10:47:48 PDT
BTW Michael, few weeks(month?) ago I talked with Konstantin Tokarev about Qt port of webkit and asked if it will support webkit 2 eventually and he said yes.
So does that mean that Qt port will also need those three separate *Process files (WebkitStorageProcess, WebkitNetworkProcess and WebkitWebProcess) ?

Also, what actually is the WebKitStorageProcess used for ? Sqlite database for cookies?
Could it be eliminated (and save space) if one developes private browser that never stores cookies to disk but keeps them in RAM?
Comment 6 Michael Catanzaro 2018-03-13 11:16:27 PDT
(In reply to Stefan Fröberg from comment #5)
> BTW Michael, few weeks(month?) ago I talked with Konstantin Tokarev about Qt
> port of webkit and asked if it will support webkit 2 eventually and he said
> yes.
> So does that mean that Qt port will also need those three separate *Process
> files (WebkitStorageProcess, WebkitNetworkProcess and WebkitWebProcess) ?

If applications opt-in to the new API, yes. I recommend switching to using Konstantin's fork of QtWebKit as your upstream, as all major distros have already done.

> Also, what actually is the WebKitStorageProcess used for ? Sqlite database
> for cookies?
> Could it be eliminated (and save space) if one developes private browser
> that never stores cookies to disk but keeps them in RAM?

Nope, it's mandatory. Storage process is used for databases and for service workers. Not for cookies. You're not going to save a significant amount of space... unless you try static linking WebKit into it. :P
Comment 7 Adrian Perez 2018-03-13 12:55:31 PDT
Hi Stefan! Indeed it is tricky to get static builds to work (as you
have already discovered!), so I wanted to chime in to give you a couple
of possible alternatives that you may want to consider:

 * Build WebKitGTK+ as dynamic libraries, using a custom installation
   prefix, e.g. with “-DCMAKE_INSTALL_PREFIX=/usr/libexec/yelp-webkit”,
   disabling the WebKitGTK+ features that Yelp does not need to work, 
   and then linking Yelp to the libraries in the custom prefix.

 * Use something like Flatpak which is precisely intended for bundling
   applications, where application bundles can have their dependencies
   included with them. You could have a custom Flatpak build of Yelp
   for your distribution which includes a custom build of WebKitGTK+
   inside the application bundle.

Any of the above will get you out of the “build a static WebKitGTK+”
minefield. That being said, we are not against using static builds of
WebKitGTK+ but as Michael already mentioned, it is not a particularly
attractive option: static builds prevent the multiple processes that
are needed by WebKitGTK+ from sharing the code segments of the shared
libraries (which saves both disk space and memory).
Comment 8 Didier Spaier 2018-03-13 14:11:13 PDT
Created attachment 335727 [details]
patch for static build
Comment 9 Didier Spaier 2018-03-13 14:12:26 PDT
Created attachment 335728 [details]
Config log  most features enabled)
Comment 10 Didier Spaier 2018-03-13 14:13:21 PDT
Created attachment 335729 [details]
Build log (most features enabled).
Comment 11 Didier Spaier 2018-03-13 14:15:02 PDT
No luck so far, after having completed the patch as advised by Stefan. CMake ran OK but the build failed.

I first ran CMake with the same features as in my previous attempt, then once again this time disabling the features for which deps are missing or too old on my system. The end of the build log is the same in both cases.

I attach the new patch, named build_main_libs_static_2.20.0.diff, the config log, named CONFIGLOGSTATIC-2.20.0.full, and the build log, named MAKELOGSTATIC-2.20.0.

Before I give up, probably then switching to the first alternative proposed by Adrian as I don't ship flatpak yet in Slint, any clue is still appreciated.
Comment 12 Didier Spaier 2018-03-13 14:18:48 PDT
I just forgot, here are the options that correspond to my last attempt (most features enabled):

LIBDIRSUFFIX="64"
CFLAGS="-Wno-expansion-to-defined"
CXXFLAGS="-Wno-expansion-to-defined"
CXXFLAGS+=" -fno-delete-null-pointer-checks"
CFLAGS+=" -fno-delete-null-pointer-checks"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_WEB_AUDIO=OFF \
-DENABLE_VIDEO=OFF \
-DLIBEXEC_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX}/webkit2gtk-4.0 \
-DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
-DPORT=GTK \
-DUSE_SYSTEM_MALLOC=ON \
-DUSE_WOFF2=OFF \
Comment 13 Stefan Fröberg 2018-03-14 08:15:31 PDT
(In reply to Adrian Perez from comment #7)
> Hi Stefan! Indeed it is tricky to get static builds to work (as you
> have already discovered!), so I wanted to chime in to give you a couple
> of possible alternatives that you may want to consider:
> 
>  * Build WebKitGTK+ as dynamic libraries, using a custom installation
>    prefix, e.g. with “-DCMAKE_INSTALL_PREFIX=/usr/libexec/yelp-webkit”,
>    disabling the WebKitGTK+ features that Yelp does not need to work, 
>    and then linking Yelp to the libraries in the custom prefix.
> 
>  * Use something like Flatpak which is precisely intended for bundling
>    applications, where application bundles can have their dependencies
>    included with them. You could have a custom Flatpak build of Yelp
>    for your distribution which includes a custom build of WebKitGTK+
>    inside the application bundle.
> 
What would be the pro's and con's of those approach?
Does the user need to install extra stuff for example? Does it need specific support from distro?

What Im trying to do is build as self-standing app as possible without needing to worry things crazy things like: glibc versioning, having static binary that is not really static (glibc dlopen thing) and so on....

static build musl library would have allowed me to do that but unfortunatley it's not playing nicely with webkit...



> Any of the above will get you out of the “build a static WebKitGTK+”
> minefield. That being said, we are not against using static builds of
> WebKitGTK+ but as Michael already mentioned, it is not a particularly
> attractive option: static builds prevent the multiple processes that
> are needed by WebKitGTK+ from sharing the code segments of the shared
> libraries (which saves both disk space and memory).


Okay, is there anyway that the pulled depencies, at least for some of those three *Process files could be lessened? That would greatly help with the size...

Now, for example, this is best I can do:

-rwxr-xr-x 1 wizard wizard 95M maali 14 17:09 WebKitWebProcess


95 MB, for one of the three *Process files. that added with the other and the app itself the total size is around 285 - 380 MB ... jeez... (as a side note, Qt port of webkit(1?) is only 78 MB as static)


I give my musl-static build another run, try to produce patch and then test that with glibc and see how that works.
Comment 14 Stefan Fröberg 2018-03-14 08:25:42 PDT
Also, I found out another thing: icu

Checking my libicudata.a I found out that it's around 26 MB. 
That's all just static data sitting there but AFAIK it's not all necessarily needed (it has fully algorithmic conversion for some of the most important encodings) and could be stripped down.

Further is the libicudata.a really needed in all three *Process files?
Comment 15 Stefan Fröberg 2018-03-14 12:36:00 PDT
(In reply to Didier Spaier from comment #10)
> Created attachment 335729 [details]
> Build log (most features enabled).

That looks similar to bug I posted sometime ago

https://bugs.webkit.org/show_bug.cgi?id=183190


root/WebKit/build/DerivedSources/ForwardingHeaders/wtf/TypeCasts.h:82:80:   required from 'typename WTF::match_constness<Source, Target>::type& WTF::downcast(Source&) [with Target = WebCore::Document; Source = WebCore::ScriptExecutionContext; typename WTF::match_constness<Source, Target>::type = WebCore::Document]'
/root/WebKit/Source/WebCore/bindings/js/JSWebAnimationCustom.cpp:47:49:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/type_traits:1512:12: error: invalid use of incomplete type 'class WebCore::Document'
     struct is_base_of

Did not get that error with 2.18.6 however with my gcc 7.3.0
Comment 16 Stefan Fröberg 2018-03-14 18:18:53 PDT
Success. 
Statically compiled webkitgtk 2.18.6 against musl library.
Even JavaScript works now (don't know what I did differently this time)

https://www.orwell1984.today/testbrowser.tar.xz
unpacked size, whopping 344 MB ...
To test just do ./test url (for example: ./test https://encrypted.google.com)


Below is my configuration, lot's of stuff disabled, even opengl.

CFLAGS="-Wno-expansion-to-defined -fno-strict-aliasing -static" CXXFLAGS="-Wno-expansion-to-defined -fno-strict-aliasing -static" LDFLAGS="-static" cmake -DCMAKE_BUILD_TYPE=Release -DSHARED_CORE=OFF -DCMAKE_INSTALL_PREFIX=/robinhood -DENABLE_X11_TARGET=ON -DENABLE_ACCELERATED_2D_CANVAS=OFF -DCMAKE_INSTALL_FULL_LIBEXECDIR=./ -DCMAKE_SKIP_RPATH=ON -DPORT=GTK -DENABLE_WEBGL=OFF -DUSE_LIBNOTIFY=OFF -DENABLE_SPELLCHECK=OFF -DENABLE_INTROSPECTION=OFF -DENABLE_API_TESTS=OFF -DLIB_INSTALL_DIR=/usr/lib -DUSE_LIBHYPHEN=OFF -DENABLE_MINIBROWSER=OFF -DUSE_SYSTEM_MALLOC=OFF -DENABLE_GEOLOCATION=OFF -DENABLE_GTKDOC=OFF -DENABLE_PLUGIN_PROCESS_GTK2=OFF -DENABLE_NETSCAPE_PLUGIN_API=OFF -DENABLE_OPENGL=OFF -DENABLE_SAMPLING_PROFILER=OFF -DENABLE_TOUCH_EVENTS=OFF -DENABLE_VIDEO=OFF -DENABLE_WEBDRIVER=OFF -DENABLE_WEB_AUDIO=OFF -DENABLE_WEBKIT2=ON -DENABLE_WEBASSEMBLY=OFF -DUSE_THIN_ARCHIVES=OFF -DENABLE_TOOLS=OFF -DENABLE_REMOTE_INSPECTOR=ON -DENABLE_JIT=OFF -DENABLE_ASSEMBLER=OFF -Wno-dev ..


Quick and dirty patch for static building following with also 2 patches for building with opengl disabled and only X11 backend left.
Comment 17 Stefan Fröberg 2018-03-14 18:20:49 PDT
Created attachment 335818 [details]
Patch for building static webkitgtk

Patch for building static webkitgtk 2.18.6
Comment 18 Stefan Fröberg 2018-03-14 18:23:31 PDT
Created attachment 335819 [details]
Patch for building without OpenGL part 1/2
Comment 19 Stefan Fröberg 2018-03-14 18:24:04 PDT
Created attachment 335820 [details]
Patch for building without OpenGL part 2/2
Comment 20 Stefan Fröberg 2018-03-14 18:33:38 PDT
Forgot one thing.
When/if the build get's around 99% then the link.txt needs tweaking for each *Process files to build them successfully.

For example, for webkitgtk-2.18.6/build/Source/WebKit/CMakeFiles/StorageProcess.dir/link.txt the following monster was needed (I had to remove any *.so references and wrap the static libs between into -Wl,--start-group ... -Wl,--end-group to solve circular dependency madness...


/usr/bin/c++  -Wno-noexcept-type -Wno-maybe-uninitialized -Wno-expansion-to-defined -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wextra -Wall -Wno-expansion-to-defined -fno-strict-aliasing -static -fno-strict-aliasing -fno-exceptions -std=c++14 -fno-rtti -O3 -DNDEBUG  -static -fuse-ld=gold -Wl,--disable-new-dtags -rdynamic CMakeFiles/StorageProcess.dir/StorageProcess/EntryPoint/unix/StorageProcessMain.cpp.o  -o ../../bin/WebKitStorageProcess -Wl,--start-group ../../lib/libwebkit2gtk-4.0.a ../../lib/libWebCoreGTK.a ../../lib/libWebCorePlatformGTK.a -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0  ../../lib/libWebCoreDerivedSources.a ../../lib/libjavascriptcoregtk-4.0.a ../../lib/libPAL.a ../../lib/libwoff2.a ../../lib/libbrotli.a ../../lib/libxdgmime.a /usr/lib/libcairo.a /usr/lib/libfontconfig.a /usr/lib/libfreetype.a /usr/lib/libharfbuzz.a /usr/lib/libharfbuzz-icu.a /usr/lib/libgcrypt.a /usr/lib/libjpeg.a /usr/lib/libpng.a /usr/lib/libwebp.a /usr/lib/libatk-1.0.a /usr/lib/libcairo.a /usr/lib/libfontconfig.a /usr/lib/libfreetype.a /usr/lib/libharfbuzz.a /usr/lib/libharfbuzz-icu.a /usr/lib/libgcrypt.a /usr/lib/libjpeg.a /usr/lib/libpng.a /usr/lib/libwebp.a /usr/lib/libatk-1.0.a /usr/lib/libgmodule-2.0.a -lsecret-1 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib/libsoup-2.4.a /usr/lib/libtasn1.a /usr/lib/libxml2.a /usr/lib/libxslt.a /usr/lib/libsqlite3.a /usr/lib/libX11.a /usr/lib/libXcomposite.a /usr/lib/libXdamage.a /usr/lib/libXrender.a /usr/lib/libXt.a ../../lib/libWTFGTK.a ../../lib/libbmalloc.a -ldl /usr/lib/libicudata.a /usr/lib/libicuuc.a /usr/lib/libgio-2.0.a /usr/lib/libgobject-2.0.a /usr/lib/libz.a /usr/lib/libicui18n.a /usr/lib/libglib-2.0.a -lffi -lpcre -lxcb -lgpg-error -lXau -lXdmcp -lgraphite2 -llzma -lexpat -lbz2 -lxcb-shm -lxcb-render -lpixman-1 -lepoxy -lX11-xcb -lpangoft2-1.0 -lX11 -lXi -lXfixes -lXext -latk-bridge-2.0 -ldbus-1 -latspi  -Wl,--end-group
Comment 21 Didier Spaier 2018-03-15 07:51:05 PDT
Created attachment 335843 [details]
Buid log as shared.
Comment 22 Didier Spaier 2018-03-15 07:52:38 PDT
(In reply to Stefan Fröberg from comment #15)
> (In reply to Didier Spaier from comment #10)
> > Created attachment 335729 [details]
> > Build log (most features enabled).
> 
> That looks similar to bug I posted sometime ago
> 
> https://bugs.webkit.org/show_bug.cgi?id=183190
> Did not get that error with 2.18.6 however with my gcc 7.3.0

Yes, it looks very similar to what I get her with gcc 5.5.0.

To make sure I tried again using the same options with 2.18.6 (success) and 2.20.0 (failure). I just added USE_WOFF2=OFF for 2.20 as I don't have that installed. Also, with 2.20.0 it took only 2 minutes to get to more than 50% completion. Isn't that strange?

Variables and options:

LIBDIRSUFFIX="64"
CFLAGS="-Wno-expansion-to-defined"
CXXFLAGS="-Wno-expansion-to-defined"
CXXFLAGS+=" -fno-delete-null-pointer-checks"
CFLAGS+=" -fno-delete-null-pointer-checks"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_DRAG_SUPPORT=OFF \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_ICONDATABASE=OFF \
-DENABLE_INDEXED_DATABASE=OFF \
-DENABLE_NOTIFICATIONS=OFF \
-DENABLE_PLUGIN_PROCESS_GTK2=OFF \
-DENABLE_SPELLCHECK=OFF \
-DENABLE_VIDEO=OFF \
-DENABLE_WEBDRIVER=OFF \
-DENABLE_WEB_AUDIO=OFF \
-DENABLE_WEB_CRYPTO=OFF \
-DLIBEXEC_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX}/webkit2gtk-4.0 \
-DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
-DPORT=GTK \
-DUSE_LIBHYPHEN=OFF \
-DUSE_LIBNOTIFY=OFF \
-DUSE_LIBSECRET=OFF \
-DUSE_SYSTEM_MALLOC=ON \
-DUSE_WOFF2=OFF \
.. 2>&1| tee ../../CONFIGLOGSHARED-2.20.0
make -j 2 2>&1| tee ../../MAKELOGSHARED-2.20.0|| return 1

I attach the MAKELOGSHARED-2.20.0.

So, as far as I can tell there is a regression in 2.20.0 vs 2.18.6.
Comment 23 Stefan Fröberg 2018-03-15 08:13:10 PDT
(In reply to Didier Spaier from comment #22)
> (In reply to Stefan Fröberg from comment #15)
> > (In reply to Didier Spaier from comment #10)
> > > Created attachment 335729 [details]
> > > Build log (most features enabled).
> > 
> > That looks similar to bug I posted sometime ago
> > 
> > https://bugs.webkit.org/show_bug.cgi?id=183190
> > Did not get that error with 2.18.6 however with my gcc 7.3.0
> 
> Yes, it looks very similar to what I get her with gcc 5.5.0.
> 
> To make sure I tried again using the same options with 2.18.6 (success) and
> 2.20.0 (failure). I just added USE_WOFF2=OFF for 2.20 as I don't have that
> installed. Also, with 2.20.0 it took only 2 minutes to get to more than 50%
> completion. Isn't that strange?
> 
> Variables and options:
> 
> LIBDIRSUFFIX="64"
> CFLAGS="-Wno-expansion-to-defined"
> CXXFLAGS="-Wno-expansion-to-defined"
> CXXFLAGS+=" -fno-delete-null-pointer-checks"
> CFLAGS+=" -fno-delete-null-pointer-checks"
> cmake \
> -DCMAKE_BUILD_TYPE=Release \
> -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
> -DCMAKE_INSTALL_PREFIX=/usr \
> -DCMAKE_SKIP_RPATH=ON \
> -DENABLE_DRAG_SUPPORT=OFF \
> -DENABLE_GEOLOCATION=OFF \
> -DENABLE_ICONDATABASE=OFF \
> -DENABLE_INDEXED_DATABASE=OFF \
> -DENABLE_NOTIFICATIONS=OFF \
> -DENABLE_PLUGIN_PROCESS_GTK2=OFF \
> -DENABLE_SPELLCHECK=OFF \
> -DENABLE_VIDEO=OFF \
> -DENABLE_WEBDRIVER=OFF \
> -DENABLE_WEB_AUDIO=OFF \
> -DENABLE_WEB_CRYPTO=OFF \
> -DLIBEXEC_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX}/webkit2gtk-4.0 \
> -DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
> -DPORT=GTK \
> -DUSE_LIBHYPHEN=OFF \
> -DUSE_LIBNOTIFY=OFF \
> -DUSE_LIBSECRET=OFF \
> -DUSE_SYSTEM_MALLOC=ON \
> -DUSE_WOFF2=OFF \
> .. 2>&1| tee ../../CONFIGLOGSHARED-2.20.0
> make -j 2 2>&1| tee ../../MAKELOGSHARED-2.20.0|| return 1
> 
> I attach the MAKELOGSHARED-2.20.0.
> 
> So, as far as I can tell there is a regression in 2.20.0 vs 2.18.6.

Yes, that's for sure. 
BTW, I made a custom libicudata.a and linked all the stuff against it and saved around 100 MB from the total :-)
So now the total size of my test app + 3 *Process files is 251 MB.
But there is more, if Im not wrong the whole webkitgtk is compiled with -O3 
That adds size of about 30% 
So next I try how it behaves with -O2 or even -Os and also the total size.
Comment 24 Stefan Fröberg 2018-03-15 08:15:32 PDT
Also, I don't see any breakings with encodings so far (knocks wood) after replacing stock libicudata.a (26 MB) with my custom libicudata.a (1.7 MB)

Tested with:
./test http://www.qq.com
and looks same as the previous bigger version : -)
Comment 25 Stefan Fröberg 2018-03-16 07:29:08 PDT
Hmmm...
Should these be added to end of list(APPEND WebCore_LIBRARIES
at Source/WebCore/PlatformGTK.cmake ?

${X11_Xau_LIB}
${X11_Xdmcp_LIB}
${X11_Xext_LIB}
${X11_Xfixes_LIB}
${X11_Xi_LIB}
Comment 26 Stefan Fröberg 2018-03-16 13:17:57 PDT
using -Os and LTO takes away another 100 MB. 
Now the total size about 153 MB
Have to check if size optimizing the depencies the webkitgtk uses bring any supstantial savings ....