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.
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
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.
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 ?
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
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
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 :
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.
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