gettext_boost.cpp
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
gettext_boost.cpp
Hi,
I have a "strange" computer setup and specs, but I'm wondering does anyone else experience problems compiling gettext_boost.cpp?
It's not a big file, but for some reason my computer chokes when it compiles that file with cmake.
With scons it freezes with gettext_boost.cpp and the computer becomes unresponsive.
I run a live debian (of sorts) distro, so RAM is already an issue for me, and there is no swap.
I have a "strange" computer setup and specs, but I'm wondering does anyone else experience problems compiling gettext_boost.cpp?
It's not a big file, but for some reason my computer chokes when it compiles that file with cmake.
With scons it freezes with gettext_boost.cpp and the computer becomes unresponsive.
I run a live debian (of sorts) distro, so RAM is already an issue for me, and there is no swap.
Re: gettext_boost.cpp
That doesn't mean much with C++ because a
.cpp
file can (and probably will) include thousands of lines of other files...It may just be that you are running out of memory. When I try to compile that file, it uses over 1.5 GB memory:
Code: Select all
$ /usr/bin/time g++ -o build/release/gettext_boost.o -c -Werror=non-virtual-dtor -std=c++11 -Wold-style-cast -Wall -Wextra -pthread -Wno-unused-local-typedefs -Wno-maybe-uninitialized -fPIE -O3 -include boost-patched/bind/arg.hpp -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -D_X11 -DLOAD_REVISION -DFIFODIR='"/var/run/wesnothd"' -DWESNOTH_PATH='"/usr/local/share/wesnoth"' -DLOCALEDIR='"translations"' -DHAS_RELATIVE_LOCALEDIR -Ibuild -Isrc src/gettext_boost.cpp
30.68user 1.13system 0:31.85elapsed 99%CPU (0avgtext+0avgdata 1625972maxresident)k
0inputs+9360outputs (0major+458297minor)pagefaults 0swaps
scripting/game_lua_kernel.cpp
(which is the largest .cpp
file in the Wesnoth source code) it uses less than 1 GB memory:Code: Select all
$ /usr/bin/time g++ -o build/release/scripting/game_lua_kernel.o -c -Werror=non-virtual-dtor -std=c++11 -Wold-style-cast -Wall -Wextra -pthread -Wno-unused-local-typedefs -Wno-maybe-uninitialized -fPIE -O3 -include boost-patched/bind/arg.hpp -D_REENTRANT -DHAVE_LIBDBUS -DHAVE_FRIBIDI -DHAVE_HISTORY -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -D_X11 -DFIFODIR='"/var/run/wesnothd"' -DWESNOTH_PATH='"/usr/local/share/wesnoth"' -DLOCALEDIR='"translations"' -DHAS_RELATIVE_LOCALEDIR -Ibuild -Isrc -isystem /usr/include/SDL2 -isystem /usr/include/cairo -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/pixman-1 -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -isystem /usr/include/pango-1.0 -isystem /usr/include/harfbuzz -isystem /usr/include/dbus-1.0 -isystem /usr/lib/x86_64-linux-gnu/dbus-1.0/include -isystem /usr/include/fribidi src/scripting/game_lua_kernel.cpp
13.53user 0.81system 0:14.37elapsed 99%CPU (0avgtext+0avgdata 946136maxresident)k
0inputs+4120outputs (0major+272173minor)pagefaults 0swaps
Re: gettext_boost.cpp
Thank you for looking into the cause.
I wonder if that file can be broken up and built into 2 objects and then linked to half that insane 1.5GB footprint.
I wonder if that file can be broken up and built into 2 objects and then linked to half that insane 1.5GB footprint.
Re: gettext_boost.cpp
I'm not sure what compiler you're using, but you might want to try using clang if you haven't already; I tested it and it seems to use quite a bit less memory than gcc (less than 1 GB).
Code: Select all
$ /usr/bin/time clang++ -o build/release/gettext_boost.o -c -Werror=non-virtual-dtor -std=c++11 -Wold-style-cast -Wall -Wextra -pthread -Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized -Wno-unused-lambda-capture -Wno-unused-local-typedefs -Wno-maybe-uninitialized -fPIE -O3 -include boost-patched/bind/arg.hpp -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -D_X11 -DLOAD_REVISION -DFIFODIR='"/var/run/wesnothd"' -DWESNOTH_PATH='"/usr/local/share/wesnoth"' -DLOCALEDIR='"translations"' -DHAS_RELATIVE_LOCALEDIR -Ibuild -Isrc src/gettext_boost.cpp
27.54user 0.46system 0:28.06elapsed 99%CPU (0avgtext+0avgdata 897048maxresident)k
0inputs+2272outputs (0major+226473minor)pagefaults 0swaps
Re: gettext_boost.cpp
As suggested, I installed clang and passed the flag
Few hours later, it successfully compiled 1.12, 1.14 and 1.15 with no freezing or lagging the mouse cursor even once!
Thank you so much. Your suggestion was super helpful.
-DCMAKE_CXX_COMPILER=clang++
to cmake.Few hours later, it successfully compiled 1.12, 1.14 and 1.15 with no freezing or lagging the mouse cursor even once!
Thank you so much. Your suggestion was super helpful.