WebKit2 status

The build will always run out of ram or swap thrash if you start it with too many jobs.

We can use a jobserver to fix this, here is one: steve - Gentoo wiki
I wanted to port it but have not gotten around to it, the jobserver will dynamically reduce the number of available compile jobs as ram becomes more scarce and so. :slight_smile:

It basically needs a) port to userlandfs OR fuse2 (they use fuse3) And an implementation for how we check for RAM, their implementation is based on /proc which we do not have.

EDIT: Now I’m wondering if this is a job we could make the roster do

Indeed at some point 100% of the RAM is now used on this PC.

I will need to switch back to the NUC until I have a better solution :confused:

you can use ā€œ-jā€ to specify less jobs as a workaround

19 posts were split to a new topic: Jobserver discussion

Some of the compile jobs take a HUGE amount of memory, and it seems a few of those run about the same time. If you don’t limit the number, they’ll use all of RAM and then some, and start thrashing, all of them at a time. Back in the day, when it still compiled for 32bits, I set NUMBER_OF_PROCESSORS so that 2 GB for each wouldn’t eat all my RAM. That would swap a bit some times but not for a long time and it was much faster than using all the processors. Nowadays I’ve had to reduce it even further. With 32 GB maybe limit to 10 or even 8. Try one of them and keep an eye on memory use.

Thanks for this tip I will fine tune the correct number :slight_smile:

I’ve just noticed today my sound card on this ASUS machine is working ! :slight_smile: :smiling_face_with_sunglasses:

Maybe one day I will replace windows by haiku on it :stuck_out_tongue:

A general question, I’ve used the debug build mode yesterday to start playing with MiniBrowser and the various issues, how do you debug : with the default debug tool ? With other methods / tools ?

1 Like

I use mainly DevConsole and logs (you need to set some environment variables to enable verbose logs, I think this is documented in the README).

Debugger can work if you have enough RAM.

1 Like

I’m curious if you have enough RAM to debug HaikuWebKit with the Haiku’s Debugger when everything has debugging symbols.

When I was working on it, I didn’t have enough RAM, so I built it with only some binaries having debugging symbols. I wrote down what I did to do that under ā€œDebugging informationā€ in Building WebKit Sensibly

I have 32 Gb on my NUC so I will test that soon.

5 posts were split to a new topic: Browser ideas

A post was merged into an existing topic: Browser ideas

The debug mode was stuck during the build and it was too time consuming (several attempts done this week without success) so I will check again with a regular release :slight_smile:

Not sure if I get how to do so for specific directories.

Let’s take my example : I would like to have debug symbols only for ā€œSource/WebKit/Shared/haikuā€, so I have create a new CMakeList.txt in that dir with :

string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")

And before I have changed the PlatformHaiku.cmake file by adding the line :

string(REPLACE "-g" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")

Then launch the compilation below, is that correct ?

Tools/Scripts/build-webkit --haiku --debug --no-fatal-warnings

Hmm, my blog post must not quite be right…

Here’s a diff containing the changes I made.

diff --git a/Source/cmake/OptionsHaiku.cmake b/Source/cmake/OptionsHaiku.cmake
index 48159cca4b1..f2ea791a524 100644
--- a/Source/cmake/OptionsHaiku.cmake
+++ b/Source/cmake/OptionsHaiku.cmake
@@ -25,6 +25,13 @@ set(ENABLE_WEBKIT_LEGACY OFF)
 
 set(USE_ANGLE_EGL OFF)
 
+# Debugging information can be huge. Disable it.
+string(REPLACE "-g" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+
+# -Og decreases build size without affecting build time or debbugability
+# significantly.
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
+
 # To get assertions in release mode, we replace all -DNDEBUG with -UNDEBUG
 # (they are automatically added by CMake and there is no "release with asserts"
 # build available in WebKit)
diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt
index 79a9e8fa538..feee25763de 100644
--- a/Source/WTF/wtf/CMakeLists.txt
+++ b/Source/WTF/wtf/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 if (ENABLE_MALLOC_HEAP_BREAKDOWN AND NOT APPLE)
     include(MallocHeapBreakdown.cmake)
 endif ()
diff --git a/Source/WebCore/PlatformHaiku.cmake b/Source/WebCore/PlatformHaiku.cmake
index 06e1aa6cbe1..ae1d11e83a9 100644
--- a/Source/WebCore/PlatformHaiku.cmake
+++ b/Source/WebCore/PlatformHaiku.cmake
@@ -1,3 +1,6 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4 -g1")
+#string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g -g1")
+
 include(platform/Haiku.cmake)
 include(platform/ImageDecoders.cmake)
 include(platform/OpenSSL.cmake)
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt
index 19d9eaff829..8151ecd9914 100644
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 set_property(DIRECTORY . PROPERTY FOLDER "WebKit")
 
 set(WebKit_PRIVATE_INCLUDE_DIRECTORIES
diff --git a/Source/WebKit/PlatformHaiku.cmake b/Source/WebKit/PlatformHaiku.cmake
index 37e6e61f987..4e08b7b233f 100644
--- a/Source/WebKitLegacy/PlatformHaiku.cmake
+++ b/Source/WebKitLegacy/PlatformHaiku.cmake
@@ -1,3 +1,7 @@
+
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g")
+
 add_custom_command(
     OUTPUT ${WebKitLegacy_DERIVED_SOURCES_DIR}/WebKitVersion.h
     MAIN_DEPENDENCY ${WEBKITLEGACY_DIR}/scripts/generate-webkitversion.pl
diff --git a/Tools/MiniBrowser/haiku/CMakeLists.txt b/Tools/MiniBrowser/haiku/CMakeLists.txt
index 926d539edc7..b34022105bd 100644
--- a/Tools/MiniBrowser/haiku/CMakeLists.txt
+++ b/Tools/MiniBrowser/haiku/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 set(MiniBrowser_SOURCES
     ${TOOLS_DIR}/MiniBrowser/haiku/BrowserApp.cpp
     ${TOOLS_DIR}/MiniBrowser/haiku/BrowserWindow.cpp

Yeah, I think that should work. Certainly this is meant to be built using --debug.

Thank you, I got the build completed in debug mode after a few attempts (some minor adjustments were needed)

Now I will review if this is ok with debugger tools GUI: the default GUI debugger but also Qt Creator. First attempt with the default GUI was very long to load, so I will investigate what can be used.

3 Likes

I would like to update my blog post, so I’m curious what you needed to do to get it working?

I’ve done the below patch, but after trying to launch the Debugger tool or the Qt Creator+gdb, it’s quite too long to launch so for the moment no easy solution : /

diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt
index afac57ed841c..48378737fe01 100644
--- a/Source/WTF/wtf/CMakeLists.txt
+++ b/Source/WTF/wtf/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 if (ENABLE_MALLOC_HEAP_BREAKDOWN AND NOT APPLE)
     include(MallocHeapBreakdown.cmake)
 endif ()
diff --git a/Source/WebCore/PlatformHaiku.cmake b/Source/WebCore/PlatformHaiku.cmake
index 730cb4a4cfbb..b4f53c114fa1 100644
--- a/Source/WebCore/PlatformHaiku.cmake
+++ b/Source/WebCore/PlatformHaiku.cmake
@@ -1,3 +1,6 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4 -g1")
+#string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g -g1")
+
 include(platform/Haiku.cmake)
 include(platform/ImageDecoders.cmake)
 include(platform/OpenSSL.cmake)
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt
index 66103739975e..a686ce859774 100644
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 set_property(DIRECTORY . PROPERTY FOLDER "WebKit")
 
 set(WebKit_PRIVATE_INCLUDE_DIRECTORIES
diff --git a/Source/WebKit/PlatformHaiku.cmake b/Source/WebKit/PlatformHaiku.cmake
index 19d1cfb0c13a..5d98532cadb2 100644
--- a/Source/WebKit/PlatformHaiku.cmake
+++ b/Source/WebKit/PlatformHaiku.cmake
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g")
+
 include(Headers.cmake)
 include(Platform/Curl.cmake)
 
diff --git a/Source/WebKitLegacy/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/Source/WebKitLegacy/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
index 78c2da802ea0..f6173eb987af 100644
--- a/Source/WebKitLegacy/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
+++ b/Source/WebKitLegacy/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
@@ -48,6 +48,7 @@
 #include "WebCore/DOMWrapperWorld.h"
 #include "WebCore/FormState.h"
 #include "WebCore/Frame.h"
+#include "WebCore/FrameDestructionObserverInlines.h"
 #include "WebCore/FrameInlines.h"
 #include "WebCore/FrameLoader.h"
 #include "WebCore/FrameTree.h"
diff --git a/Source/WebKitLegacy/haiku/WebCoreSupport/IconDatabase.cpp b/Source/WebKitLegacy/haiku/WebCoreSupport/IconDatabase.cpp
index f974a8fb030a..fbc5bde9d29b 100644
--- a/Source/WebKitLegacy/haiku/WebCoreSupport/IconDatabase.cpp
+++ b/Source/WebKitLegacy/haiku/WebCoreSupport/IconDatabase.cpp
@@ -44,11 +44,16 @@
 #include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
 
+
+#define IS_ICON_SYNC_THREAD() (true)
+#define ASSERT_NOT_SYNC_THREAD() ((void)0)
+#define ASSERT_ICON_SYNC_THREAD() ((void)0)
+
 // For methods that are meant to support API from the main thread - should not be called internally
-#define ASSERT_NOT_SYNC_THREAD() ASSERT(!IS_ICON_SYNC_THREAD())
+//#define ASSERT_NOT_SYNC_THREAD() ASSERT(!IS_ICON_SYNC_THREAD())
 
 // For methods that are meant to support the sync thread ONLY
-#define ASSERT_ICON_SYNC_THREAD() ASSERT(IS_ICON_SYNC_THREAD())
+//#define ASSERT_ICON_SYNC_THREAD() ASSERT(IS_ICON_SYNC_THREAD())
 
 using namespace WebCore;
 
diff --git a/Source/cmake/OptionsHaiku.cmake b/Source/cmake/OptionsHaiku.cmake
index dc91e28c3037..f5fec698921d 100644
--- a/Source/cmake/OptionsHaiku.cmake
+++ b/Source/cmake/OptionsHaiku.cmake
@@ -25,6 +25,13 @@ set(ENABLE_WEBKIT_LEGACY ON)
 
 set(USE_ANGLE_EGL OFF)
 
+# Debugging information can be huge. Disable it.
+string(REPLACE "-g" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+
+# -Og decreases build size without affecting build time or debbugability
+# significantly.
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
+
 # To get assertions in release mode, we replace all -DNDEBUG with -UNDEBUG
 # (they are automatically added by CMake and there is no "release with asserts"
 # build available in WebKit)
diff --git a/Tools/MiniBrowser/haiku/CMakeLists.txt b/Tools/MiniBrowser/haiku/CMakeLists.txt
index 926d539edc73..b34022105bd9 100644
--- a/Tools/MiniBrowser/haiku/CMakeLists.txt
+++ b/Tools/MiniBrowser/haiku/CMakeLists.txt
@@ -1,3 +1,5 @@
+string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf-4")
+
 set(MiniBrowser_SOURCES
     ${TOOLS_DIR}/MiniBrowser/haiku/BrowserApp.cpp
     ${TOOLS_DIR}/MiniBrowser/haiku/BrowserWindow.cpp

BTW crash when quitting MiniBrowser is identified and should be fixed soon :stuck_out_tongue:

2 Likes

MiniBrowser : no more crash on exit, back and forward :slight_smile:

EDIT: MiniBrowser compiled and running on Debian : reading videos & co.

It means we could have a nice MiniBrowser using WebKit2 on Haiku, just a matter of time:)

17 Likes