feat(build): add 'CONSERVE_MEMORY' cmake option

When CONSERVE_MEMORY=ON and gcc is being used, we provide additional
command line options that will minimize the amount of memory used by gcc
when compiling Lean.
This is an attempt to fix the "out-of-memory" failures when building
Lean at Travis.
This commit is contained in:
Leonardo de Moura 2014-09-29 12:44:29 -07:00
parent 6630ed8165
commit 1a1e9a2340
2 changed files with 20 additions and 2 deletions

View file

@ -23,6 +23,7 @@ env:
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
TCMALLOC=OFF TCMALLOC=OFF
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# ======================================================= # =======================================================
# DEBUG Build # DEBUG Build
# ======================================================= # =======================================================
@ -41,6 +42,7 @@ env:
TCMALLOC=ON TCMALLOC=ON
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# D3. clang++-3.3 | DEBUG # D3. clang++-3.3 | DEBUG
- CMAKE_CXX_COMPILER=clang++-3.3 - CMAKE_CXX_COMPILER=clang++-3.3
CMAKE_BUILD_TYPE=DEBUG CMAKE_BUILD_TYPE=DEBUG
@ -53,6 +55,7 @@ env:
TCMALLOC=OFF TCMALLOC=OFF
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# ======================================================= # =======================================================
# RELEASE Build # RELEASE Build
# ======================================================= # =======================================================
@ -70,6 +73,7 @@ env:
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
PACKAGE=TRUE PACKAGE=TRUE
CONSERVE_MEMORY=ON
# R3. clang++-3.3 | RELEASE # R3. clang++-3.3 | RELEASE
- CMAKE_CXX_COMPILER=clang++-3.3 - CMAKE_CXX_COMPILER=clang++-3.3
CMAKE_BUILD_TYPE=RELEASE CMAKE_BUILD_TYPE=RELEASE
@ -83,6 +87,7 @@ env:
UPLOAD=linux UPLOAD=linux
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# ======================================================= # =======================================================
# MEMCHECK Build # MEMCHECK Build
# ======================================================= # =======================================================
@ -110,6 +115,7 @@ env:
MEMCHECK_RANGE=1,40 MEMCHECK_RANGE=1,40
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# M2-2. g++-4.8 | DEBUG | MEMCHECK | CDASH # M2-2. g++-4.8 | DEBUG | MEMCHECK | CDASH
- CMAKE_CXX_COMPILER=g++-4.8 - CMAKE_CXX_COMPILER=g++-4.8
CMAKE_BUILD_TYPE=DEBUG CMAKE_BUILD_TYPE=DEBUG
@ -118,6 +124,7 @@ env:
MEMCHECK_RANGE=40,80 MEMCHECK_RANGE=40,80
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# ======================================================= # =======================================================
# DOXYGEN Build # DOXYGEN Build
# ======================================================= # =======================================================
@ -127,6 +134,7 @@ env:
BUILD_DOXYGEN=TRUE BUILD_DOXYGEN=TRUE
TCMALLOC=OFF TCMALLOC=OFF
LUA=52 LUA=52
CONSERVE_MEMORY=ON
# ======================================================= # =======================================================
# Different Lua Versions # Different Lua Versions
# ======================================================= # =======================================================
@ -137,6 +145,7 @@ env:
UPLOAD=linux UPLOAD=linux
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=51 LUA=51
CONSERVE_MEMORY=ON
# LJIT. g++-4.8 | RELEASE | | CDASH # LJIT. g++-4.8 | RELEASE | | CDASH
- CMAKE_CXX_COMPILER=g++-4.8 - CMAKE_CXX_COMPILER=g++-4.8
CMAKE_BUILD_TYPE=RELEASE CMAKE_BUILD_TYPE=RELEASE
@ -144,6 +153,7 @@ env:
UPLOAD=linux UPLOAD=linux
PUSH_TO_CDASH=TRUE PUSH_TO_CDASH=TRUE
LUA=JIT LUA=JIT
CONSERVE_MEMORY=ON
install: install:
- until sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; do echo retry; done - until sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; do echo retry; done
@ -230,7 +240,7 @@ script:
- if [[ $TESTCOV != ON ]]; then - if [[ $TESTCOV != ON ]]; then
TESTCOV=OFF; TESTCOV=OFF;
fi fi
- /usr/bin/cmake -DIGNORE_SORRY=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTCOV=${TESTCOV} -DTCMALLOC=${TCMALLOC} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${GENERATOR} -DCMAKE_PROGRAM_PATH=/usr/bin ../src; - /usr/bin/cmake -DIGNORE_SORRY=ON -DCONSERVE_MEMORY=${CONSERVE_MEMORY} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTCOV=${TESTCOV} -DTCMALLOC=${TCMALLOC} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${GENERATOR} -DCMAKE_PROGRAM_PATH=/usr/bin ../src;
- if [[ $CMAKE_BUILD_TYPE == DEBUG || $CMAKE_BUILD_TYPE == RELEASE || $TESTCOV == ON ]]; then - if [[ $CMAKE_BUILD_TYPE == DEBUG || $CMAKE_BUILD_TYPE == RELEASE || $TESTCOV == ON ]]; then
SITE=Ubuntu12.04@Travis; SITE=Ubuntu12.04@Travis;
if [[ $CMAKE_BUILD_TYPE == RELEASE ]]; then if [[ $CMAKE_BUILD_TYPE == RELEASE ]]; then

View file

@ -27,6 +27,9 @@ option(IGNORE_SORRY "IGNORE_SORRY" OFF)
# When cross-compiling, we do not compile the standard library since # When cross-compiling, we do not compile the standard library since
# the executable will not work on the host machine # the executable will not work on the host machine
option(CROSS_COMPILE "CROSS_COMPILE" OFF) option(CROSS_COMPILE "CROSS_COMPILE" OFF)
# When ON we try to minimize the amount of memory needed to compile Lean using gcc.
# We use this flag when compiling at Travis.
option(CONSERVE_MEMORY "CONSERVE_MEMORY" OFF)
# Added for CTest # Added for CTest
include(CTest) include(CTest)
@ -60,9 +63,14 @@ if("${CACHE_EXPRS}" MATCHES "ON")
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_CACHE_EXPRS") set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_CACHE_EXPRS")
endif() endif()
if(("${CONSERVE_MEMORY}" MATCHES "ON") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
message(STATUS "Using compilation flags for minimizing the amount of memory used by gcc")
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} --param ggc-min-heapsize=32768 --param ggc-min-expand=20")
endif()
if("${STATIC}" MATCHES "ON") if("${STATIC}" MATCHES "ON")
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
message(STATUS "Creating a static executable") message(STATUS "Creating a static executable")
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
endif() endif()
# Set Module Path # Set Module Path