Revert to LIB_MODE=static for optimized builds (#11195)

Summary:
Continuous performance testing indicates there's a small performance hit with shared library (-fPIC) builds, so while retaining the motivation for https://github.com/facebook/rocksdb/issues/11168, we set the default for DEBUG_LEVEL=0 Makefile builds back to LIB_MODE=static.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11195

Test Plan: CI, with some updated checks and removal of some now obsolete LIB_MODE overrides

Reviewed By: cbi42

Differential Revision: D43090576

Pulled By: pdillinger

fbshipit-source-id: 755fe5d07005f85caf24e16f90228ffd46a6e250
This commit is contained in:
Peter Dillinger 2023-02-07 11:26:55 -08:00 committed by Facebook GitHub Bot
parent 68fa90ca43
commit b5827c806c
2 changed files with 20 additions and 11 deletions

View File

@ -287,16 +287,20 @@ jobs:
steps: steps:
- checkout # check out the code in the project directory - checkout # check out the code in the project directory
- run: make V=1 -j32 LIB_MODE=shared release - run: make V=1 -j32 LIB_MODE=shared release
- run: ls librocksdb.so # ensure shared lib built
- run: ./db_stress --version # ensure with gflags - run: ./db_stress --version # ensure with gflags
- run: make clean - run: make clean
- run: make V=1 -j32 LIB_MODE=static release - run: make V=1 -j32 release
- run: ls librocksdb.a # ensure static lib built
- run: ./db_stress --version # ensure with gflags - run: ./db_stress --version # ensure with gflags
- run: make clean - run: make clean
- run: apt-get remove -y libgflags-dev - run: apt-get remove -y libgflags-dev
- run: make V=1 -j32 LIB_MODE=shared release - run: make V=1 -j32 LIB_MODE=shared release
- run: ls librocksdb.so # ensure shared lib built
- run: if ./db_stress --version; then false; else true; fi # ensure without gflags - run: if ./db_stress --version; then false; else true; fi # ensure without gflags
- run: make clean - run: make clean
- run: make V=1 -j32 LIB_MODE=static release - run: make V=1 -j32 release
- run: ls librocksdb.a # ensure static lib built
- run: if ./db_stress --version; then false; else true; fi # ensure without gflags - run: if ./db_stress --version; then false; else true; fi # ensure without gflags
- post-steps - post-steps
@ -504,7 +508,7 @@ jobs:
resource_class: 2xlarge resource_class: 2xlarge
steps: steps:
- pre-steps - pre-steps
- run: DEBUG_LEVEL=0 LIB_MODE=static make -j32 run_microbench # TODO: LIB_MODE only to work around unresolved linker failures - run: DEBUG_LEVEL=0 make -j32 run_microbench
- post-steps - post-steps
build-linux-mini-crashtest: build-linux-mini-crashtest:

View File

@ -44,13 +44,6 @@ quoted_perl_command = $(subst ','\'',$(perl_command))
# Set the default DEBUG_LEVEL to 1 # Set the default DEBUG_LEVEL to 1
DEBUG_LEVEL?=1 DEBUG_LEVEL?=1
# LIB_MODE says whether or not to use/build "shared" or "static" libraries.
# Mode "static" means to link against static libraries (.a)
# Mode "shared" means to link against shared libraries (.so, .sl, .dylib, etc)
#
# Set the default LIB_MODE to shared for efficient `make check` etc.
LIB_MODE?=shared
# OBJ_DIR is where the object files reside. Default to the current directory # OBJ_DIR is where the object files reside. Default to the current directory
OBJ_DIR?=. OBJ_DIR?=.
@ -81,7 +74,19 @@ else ifneq ($(filter jtest rocksdbjava%, $(MAKECMDGOALS)),)
endif endif
endif endif
$(info $$DEBUG_LEVEL is ${DEBUG_LEVEL}) # LIB_MODE says whether or not to use/build "shared" or "static" libraries.
# Mode "static" means to link against static libraries (.a)
# Mode "shared" means to link against shared libraries (.so, .sl, .dylib, etc)
#
ifeq ($(DEBUG_LEVEL), 0)
# For optimized, set the default LIB_MODE to static for code size/efficiency
LIB_MODE?=static
else
# For debug, set the default LIB_MODE to shared for efficient `make check` etc.
LIB_MODE?=shared
endif
$(info $$DEBUG_LEVEL is $(DEBUG_LEVEL), $$LIB_MODE is $(LIB_MODE))
# Figure out optimize level. # Figure out optimize level.
ifneq ($(DEBUG_LEVEL), 2) ifneq ($(DEBUG_LEVEL), 2)