chore: strip binaries only in release builds (#13208)
This commit ensures binaries are only stripped in the `release` build preset, not in any of the other presets. Since `release` is used for development, the commit adds a non-stripping copy called `dev` that can be used via `cmake --preset dev`.
This commit is contained in:
parent
33c3604b87
commit
67b6e815b9
5 changed files with 31 additions and 6 deletions
|
|
@ -6,6 +6,6 @@ vscode:
|
||||||
- leanprover.lean4
|
- leanprover.lean4
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Release build
|
- name: Build
|
||||||
init: cmake --preset release
|
init: cmake --preset dev
|
||||||
command: make -C build/release -j$(nproc || sysctl -n hw.logicalcpu)
|
command: make -C build/release -j$(nproc || sysctl -n hw.logicalcpu)
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,26 @@
|
||||||
"configurePresets": [
|
"configurePresets": [
|
||||||
{
|
{
|
||||||
"name": "release",
|
"name": "release",
|
||||||
"displayName": "Default development optimized build config",
|
"displayName": "Release build config",
|
||||||
"generator": "Unix Makefiles",
|
"generator": "Unix Makefiles",
|
||||||
"binaryDir": "${sourceDir}/build/release"
|
"binaryDir": "${sourceDir}/build/release"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dev",
|
||||||
|
"displayName": "Default development optimized build config",
|
||||||
|
"cacheVariables": {
|
||||||
|
"STRIP_BINARIES": "OFF"
|
||||||
|
},
|
||||||
|
"generator": "Unix Makefiles",
|
||||||
|
"binaryDir": "${sourceDir}/build/dev"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "debug",
|
"name": "debug",
|
||||||
"displayName": "Debug build config",
|
"displayName": "Debug build config",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
"LEAN_EXTRA_CXX_FLAGS": "-DLEAN_DEFAULT_THREAD_STACK_SIZE=16*1024*1024",
|
"LEAN_EXTRA_CXX_FLAGS": "-DLEAN_DEFAULT_THREAD_STACK_SIZE=16*1024*1024",
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
"STRIP_BINARIES": "OFF"
|
||||||
},
|
},
|
||||||
"generator": "Unix Makefiles",
|
"generator": "Unix Makefiles",
|
||||||
"binaryDir": "${sourceDir}/build/debug"
|
"binaryDir": "${sourceDir}/build/debug"
|
||||||
|
|
@ -26,7 +36,8 @@
|
||||||
"name": "reldebug",
|
"name": "reldebug",
|
||||||
"displayName": "Release with assertions enabled",
|
"displayName": "Release with assertions enabled",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "RelWithAssert"
|
"CMAKE_BUILD_TYPE": "RelWithAssert",
|
||||||
|
"STRIP_BINARIES": "OFF"
|
||||||
},
|
},
|
||||||
"generator": "Unix Makefiles",
|
"generator": "Unix Makefiles",
|
||||||
"binaryDir": "${sourceDir}/build/reldebug"
|
"binaryDir": "${sourceDir}/build/reldebug"
|
||||||
|
|
@ -38,6 +49,7 @@
|
||||||
"LEAN_EXTRA_CXX_FLAGS": "-fsanitize=address,undefined -DLEAN_DEFAULT_THREAD_STACK_SIZE=16*1024*1024",
|
"LEAN_EXTRA_CXX_FLAGS": "-fsanitize=address,undefined -DLEAN_DEFAULT_THREAD_STACK_SIZE=16*1024*1024",
|
||||||
"LEANC_EXTRA_CC_FLAGS": "-fsanitize=address,undefined",
|
"LEANC_EXTRA_CC_FLAGS": "-fsanitize=address,undefined",
|
||||||
"LEAN_EXTRA_LINKER_FLAGS": "-fsanitize=address,undefined -fsanitize-link-c++-runtime",
|
"LEAN_EXTRA_LINKER_FLAGS": "-fsanitize=address,undefined -fsanitize-link-c++-runtime",
|
||||||
|
"STRIP_BINARIES": "OFF",
|
||||||
"SMALL_ALLOCATOR": "OFF",
|
"SMALL_ALLOCATOR": "OFF",
|
||||||
"USE_MIMALLOC": "OFF",
|
"USE_MIMALLOC": "OFF",
|
||||||
"BSYMBOLIC": "OFF",
|
"BSYMBOLIC": "OFF",
|
||||||
|
|
@ -58,6 +70,10 @@
|
||||||
"name": "release",
|
"name": "release",
|
||||||
"configurePreset": "release"
|
"configurePreset": "release"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dev",
|
||||||
|
"configurePreset": "dev"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "debug",
|
"name": "debug",
|
||||||
"configurePreset": "debug"
|
"configurePreset": "debug"
|
||||||
|
|
@ -81,6 +97,11 @@
|
||||||
"configurePreset": "release",
|
"configurePreset": "release",
|
||||||
"output": {"outputOnFailure": true, "shortProgress": true}
|
"output": {"outputOnFailure": true, "shortProgress": true}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dev",
|
||||||
|
"configurePreset": "dev",
|
||||||
|
"output": {"outputOnFailure": true, "shortProgress": true}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "debug",
|
"name": "debug",
|
||||||
"configurePreset": "debug",
|
"configurePreset": "debug",
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ cd lean4
|
||||||
cmake --preset release
|
cmake --preset release
|
||||||
make -C build/release -j$(nproc || sysctl -n hw.logicalcpu)
|
make -C build/release -j$(nproc || sysctl -n hw.logicalcpu)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For development, `cmake --preset dev` is recommended instead.
|
||||||
|
|
||||||
You can replace `$(nproc || sysctl -n hw.logicalcpu)` with the desired parallelism amount.
|
You can replace `$(nproc || sysctl -n hw.logicalcpu)` with the desired parallelism amount.
|
||||||
|
|
||||||
The above commands will compile the Lean library and binaries into the
|
The above commands will compile the Lean library and binaries into the
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ option(CCACHE "use ccache" ON)
|
||||||
option(SPLIT_STACK "SPLIT_STACK" OFF)
|
option(SPLIT_STACK "SPLIT_STACK" OFF)
|
||||||
# When OFF we disable LLVM support
|
# When OFF we disable LLVM support
|
||||||
option(LLVM "LLVM" OFF)
|
option(LLVM "LLVM" OFF)
|
||||||
|
option(STRIP_BINARIES "Strip produced binaries" ON)
|
||||||
|
|
||||||
# When ON we include githash in the version string
|
# When ON we include githash in the version string
|
||||||
option(USE_GITHASH "GIT_HASH" ON)
|
option(USE_GITHASH "GIT_HASH" ON)
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ else
|
||||||
-Wl,--whole-archive ${LIB}/temp/Lean.*o.export ${LIB}/temp/libleanshell.a -Wl,--no-whole-archive -Wl,--start-group -lInit -lStd -lLean -lleancpp -Wl,--end-group ${CMAKE_BINARY_DIR}/runtime/libleanrt_initial-exec.a ${LEANSHARED_LINKER_FLAGS} ${TOOLCHAIN_SHARED_LINKER_FLAGS} ${LEANC_OPTS}
|
-Wl,--whole-archive ${LIB}/temp/Lean.*o.export ${LIB}/temp/libleanshell.a -Wl,--no-whole-archive -Wl,--start-group -lInit -lStd -lLean -lleancpp -Wl,--end-group ${CMAKE_BINARY_DIR}/runtime/libleanrt_initial-exec.a ${LEANSHARED_LINKER_FLAGS} ${TOOLCHAIN_SHARED_LINKER_FLAGS} ${LEANC_OPTS}
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq "${CMAKE_BUILD_TYPE}" "Release"
|
ifeq "${STRIP_BINARIES}" "ON"
|
||||||
ifeq "${CMAKE_SYSTEM_NAME}" "Linux"
|
ifeq "${CMAKE_SYSTEM_NAME}" "Linux"
|
||||||
# We only strip like this on Linux for now as our other platforms already seem to exclude the
|
# We only strip like this on Linux for now as our other platforms already seem to exclude the
|
||||||
# unexported symbols by default
|
# unexported symbols by default
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue