contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.47k stars 107 forks source link

memory exhaust when compiling mocs_compilation.cpp #1534

Closed jg1uaa closed 5 months ago

jg1uaa commented 5 months ago

Contour Terminal version

0.4.4-master-2dcb6604

Installer source

Github: source code cloned

Operating System

Void Linux

Architecture

x86-64

Other Software

gcc-13.2.0 libfreetype-2.13.2 libunicode-0.4.0 boxed-cpp 1.2.2 libfontconfig-2.14.2 harfbuzz-8.5.0 pkg-config 0.29.2 libxkbcommon-1.7.0

Steps to reproduce

after git clone and install necessary components (I used distro-provided boxed-cpp and libunicode etc., not from scripts/install-deps.sh),

[uaa@voidlinux-vm ~]$ mkdir -p contour/build
[uaa@voidlinux-vm ~]$ cd contour/build/
[uaa@voidlinux-vm build]$ cmake ..
[uaa@voidlinux-vm build]$ make VERBOSE=1

Expected Behavior

Normally, build with no error.

Actual Behavior

Memory exhaust occurs compiling ContourTerminalDisplay_autogen/mocs_compilation.cpp.o. I faced the problem with Void Linux on QEMU virtual machine. 24GB memory + 12GB swap.

Consolidate compiler generated dependencies of target ContourTerminalDisplay
make[2]: Leaving directory '/home/uaa/contour/build'
make  -f src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/build.make src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/build
make[2]: Entering directory '/home/uaa/contour/build'
[ 73%] Building CXX object src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/ContourTerminalDisplay_autogen/mocs_compilation.cpp.o
cd /home/uaa/contour/build/src/contour/display && /usr/bin/c++ -DCONTOUR_APP_ID=\"org.contourterminal.Contour\" -DCONTOUR_BUILD_TYPE=\"RelWithDebInfo\" -DCONTOUR_STACKTRACE_ADDR2LINE=1 -DFMT_HEADER_ONLY=1 -DHAVE_BACKTRACE -DHAVE_BACKTRACE_SYMBOLS -DHAVE_CXXABI_H -DHAVE_DLADDR -DHAVE_DLFCN_H -DHAVE_DLSYM -DHAVE_EXECINFO_H -DHAVE_SYS_SELECT_H -DHAVE_UNWIND_H -DLIBTERMINAL_LOG_TRACE=1 -DQT_CORE_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0x050F00 -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -I/home/uaa/contour/build/src/contour/display/ContourTerminalDisplay_autogen/include -I/home/uaa/contour/build/src/contour/display/../.. -I/home/uaa/contour/src -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib64/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtOpenGL -isystem /usr/include/qt6/QtMultimedia -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtQuickControls2 -O2 -g -DNDEBUG -std=c++20 -fdiagnostics-color=always -fdiagnostics-color=always -maes -fPIC -MD -MT src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/ContourTerminalDisplay_autogen/mocs_compilation.cpp.o -MF CMakeFiles/ContourTerminalDisplay.dir/ContourTerminalDisplay_autogen/mocs_compilation.cpp.o.d -o CMakeFiles/ContourTerminalDisplay.dir/ContourTerminalDisplay_autogen/mocs_compilation.cpp.o -c /home/uaa/contour/build/src/contour/display/ContourTerminalDisplay_autogen/mocs_compilation.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/build.make:100: src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/ContourTerminalDisplay_autogen/mocs_compilation.cpp.o] Error 1
make[2]: Leaving directory '/home/uaa/contour/build'
make[1]: *** [CMakeFiles/Makefile2:572: src/contour/display/CMakeFiles/ContourTerminalDisplay.dir/all] Error 2
make[1]: Leaving directory '/home/uaa/contour/build'
make: *** [Makefile:156: all] Error 2
[uaa@voidlinux-vm build]$

Additional notes

CMake configutration log:

[uaa@voidlinux-vm build]$ cmake ..
-- [Version] Git branch: master
-- [Version] Git SHA: 2dcb6604
-- [Version] version source: git & /home/uaa/contour/metainfo.xml
-- [Version] version triple: 0.4.4
-- [Version] version string: 0.4.4-master-2dcb6604
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ccache] Disabled: Not found.
-- [clang-tidy] Disabled.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- addr2line: /usr/bin/addr2line
-- No sanitizer enabled.
-- No 3rdparty libraries found at /home/uaa/contour/_deps/sources
-- Found HarfBuzz: /usr/lib/libharfbuzz.so
-- Found Freetype: /usr/lib/libfreetype.so (found version "2.13.2")
-- Found libunicode, version: 0.4.0
-- Found boxed-cpp, version: 1.2.2
-- Found boxed-cpp: 1.2.2 (system package)
-- Performing Test fdiagnostics-color=always
-- Performing Test fdiagnostics-color=always - Success
-- Adding compiler flag: -fdiagnostics-color=always.
-- Enabling pedantic compiler options: no
-- Looking for backtrace
-- Looking for backtrace - found
-- Looking for backtrace_symbols
-- Looking for backtrace_symbols - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Looking for dlsym
-- Looking for dlsym - found
-- Looking for include file dlfcn.h
-- Looking for include file dlfcn.h - found
-- Looking for include file cxxabi.h
-- Looking for include file cxxabi.h - found
-- Looking for include file execinfo.h
-- Looking for include file execinfo.h - found
-- Looking for include file sys/select.h
-- Looking for include file sys/select.h - found
-- Looking for include file unwind.h
-- Looking for include file unwind.h - found
-- [crispy-core] Adding compile definition: HAVE_BACKTRACE
-- [crispy-core] Adding compile definition: HAVE_BACKTRACE_SYMBOLS
-- [crispy-core] Adding compile definition: HAVE_CXXABI_H
-- [crispy-core] Adding compile definition: HAVE_DLADDR
-- [crispy-core] Adding compile definition: HAVE_DLFCN_H
-- [crispy-core] Adding compile definition: HAVE_DLSYM
-- [crispy-core] Adding compile definition: HAVE_EXECINFO_H
-- [crispy-core] Adding compile definition: HAVE_SYS_SELECT_H
-- [crispy-core] Adding compile definition: HAVE_UNWIND_H
-- [crispy] Compile unit tests: OFF
-- Found Fontconfig: /usr/lib/libfontconfig.so (found version "2.14.2")
-- Checking for module 'harfbuzz'
--   Found harfbuzz, version 8.5.0
-- [text_shaper] Librarires: unicode::unicode;boxed-cpp::boxed-cpp;fmt::fmt-header-only;range-v3::range-v3;Microsoft.GSL::GSL;Freetype::Freetype;PkgConfig::harfbuzz;Fontconfig::Fontconfig
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libssh2'
--   No package 'libssh2' found
-- [vtpty] Builtin-SSH support disabled
-- [vtbackend] Compile unit tests: OFF
-- [vtbackend] Enable VT sequence tracing: ON
-- [vtbackend] Enable passive render buffer update: OFF
-- [vtbackend] Build bench-headless: OFF
-- [vtbackend] Build documentation tool: OFF
-- [vtrasterizer] Compile unit tests:
-- Qt components: Core;Gui;Qml;Quick;QuickControls2;Network;Multimedia;Widgets;OpenGL;OpenGLWidgets;Core5Compat
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Found OpenGL: /usr/lib/libOpenGL.so
-- Found WrapOpenGL: TRUE
-- Found XKB: /usr/lib64/libxkbcommon.so (found suitable version "1.7.0", minimum required is "0.5.0")
-- Found WrapVulkanHeaders: /usr/include
-- Executable tic found (/usr/bin/tic).
-- ==============================================================================
--     Contour ThirdParties
-- ------------------------------------------------------------------------------
-- Catch2              (tests disabled)
-- GSL                 system package
-- fmt                 system package
-- freetype            system package
-- harfbuzz            system package
-- range-v3            system package
-- yaml-cpp            system package
-- termbench-pro       (bench-headless disabled)
-- libunicode          system package (0.4.0)
-- boxed-cpp           system package
-- ------------------------------------------------------------------------------
-- ==============================================================================
--     Contour (0.4.4-master-2dcb6604)
-- ------------------------------------------------------------------------------
-- System:                                             x86_64 (Linux)
-- Build type:                                         RelWithDebInfo
-- C++ standard:                                       C++20 (GNU)
-- Using ccache:                                       CCACHE-NOTFOUND
-- Build with sanitizer:                               OFF
-- Build unit tests:                                   OFF
-- Enable with code coverage:                          OFF
-- Build contour frontend GUI:                         ON
-- Build contour using Qt:                             6 (6.6.0)
-- Build contour using mimalloc:                       OFF
-- Clang Tidy:                                         OFF
-- |> Enable performance metrics:                      OFF
-- ------------------------------------------------------------------------------
-- Configuring done (2.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/uaa/contour/build
[uaa@voidlinux-vm build]$
Yaraslaut commented 5 months ago

Hi @jg1uaa, thanks for the report. We are aware of this issue, and for gcc 14, everything is alright. In the mean time I would suggest to use clang, or ask void people @classabbyamp if it is possible to bump gcc version

jg1uaa commented 5 months ago

Thanks! I use clang-17.0.6 instead of gcc-13.2.0, the problem solved.

[uaa@voidlinux-vm build]$ CC=clang CXX=clang++ cmake ..
-- [Version] Git branch: master
-- [Version] Git SHA: 2dcb6604
-- [Version] version source: git & /home/uaa/contour/metainfo.xml
-- [Version] version triple: 0.4.4
-- [Version] version string: 0.4.4-master-2dcb6604
-- The CXX compiler identification is Clang 17.0.6
(snip)
Compiling contour.terminfo
cd /home/uaa/contour/build/src/contour && /home/uaa/contour/build/src/contour/contour generate terminfo to contour.terminfo && /usr/bin/tic -x -o /home/uaa/contour/build/src/contour/terminfo contour.terminfo
make[2]: Leaving directory '/home/uaa/contour/build'
[100%] Built target contour
make[1]: Leaving directory '/home/uaa/contour/build'
/usr/bin/cmake -E cmake_progress_start /home/uaa/contour/build/CMakeFiles 0
[uaa@voidlinux-vm build]$