[webkit-gtk] Compiling the lib w/ 4GB RAM

Carlos Alberto Lopez Perez clopez at igalia.com
Tue Nov 23 16:54:01 PST 2021

On 15/11/2021 12:40, Adrian Perez de Castro wrote:
> On Mon, 15 Nov 2021 09:40:00 +0100 René <gadefoxren at gmail.com> wrote:
>> I spent this weekend trying to build the lib from the source code.
>> Unfortunately I can't compile the file Unifiedxxx_767013ce-4.cpp,
>> because the HDD is swappin like crazy. It seems 4 GB is not enough for
>> the process although I'm running on console only so I can free some
>> memory.. Is there any possibility to split these huge source files so
>> gcc can handle the process w/ "only" ,) 4 GB RAM. Thanks..
> With 4 GiB you will be tight to be able to build and link WebKit, but
> it _might_ be possible with some tweaking:
> - You can pass “-DENABLE_UNIFIED_BUILDS=OFF” to disable unified builds.
>   This will save you some memory (as you guessed, building huge combined
>   sources takes more RAM).
> - Then the challenge is linking, this is slightly more likely to succeed
>   using the GNU binutils linker instead of Gold. You can tell CMake to
>   no try using Gold passing “-DUSE_LD_GOLD=OFF” to it.
> - You may still run into low memory, setting “LDFLAGS='-Wl,--no-keep-memory'”
>   in the environment before running CMake will definitely help.
> - Last but not least, try to not run a desktop environment (like GNOME)
>   at the same time, to leave more memory for the build process.
> - If you still run low on memory, you may need to have some swap, or increase
>   the amount of swap space.
> I hope these tips help. Cheers,

Good tips!

Another good one is:

If the build is crashing at the linking step due to not enough memory,
then something that can help _a lot_ is reducing the size of the object
files by removing debug info from them.

You can pass in the CXXFLAGS environment variable the "-g1" flag to
reduce the debug info that goes into the object files (or even "-g0" to
not have any debug info at all inside them).

Note: Is recommended to start a new clean build from scratch if you
modify the value passed in the CXXFLAGS environment variable to the build.

Best regards.

More information about the webkit-gtk mailing list