Commit 00a7a10f authored by gejun's avatar gejun

Fixes on building in baidu-internal

parent 36fc4e5f
......@@ -2,9 +2,10 @@ NEED_LIBPROTOC=1
include config.mk
# Notes on the flags:
# 1. -fno-omit-frame-pointer is required by perf/tcmalloc-profiler which use frame pointers by default
# 2. -D__const__= MUST be added in user's gcc compilation as well to avoid the over-optimization on TLS variables by gcc
# 3. Removed -Werror to not block compilation for non-vital warnings, especially when the code is compiled on newer systems. If you use the code in production, add -Werror back
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
# 3. Removed -Werror: Not block compilation for non-vital warnings, especially when the
# code is tested on newer systems. If the code is used in production, add -Werror back
CPPFLAGS=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\"$(shell git rev-parse --short HEAD)\"
CXXFLAGS=$(CPPFLAGS) -O2 -g -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x -include brpc/config.h
CFLAGS=$(CPPFLAGS) -O2 -g -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer
......
......@@ -32,7 +32,7 @@ if [ -z "$HDRS_IN" ] || [ -z "$LIBS_IN" ]; then
fi
find_dir_of_lib() {
local lib=$(find ${LIBS_IN} -name "lib${1}.*" | head -n1)
local lib=$(find ${LIBS_IN} -name "lib${1}.a" -o -name "lib${1}.so*" | head -n1)
if [ ! -z "$lib" ]; then
dirname $lib
fi
......@@ -72,14 +72,13 @@ find_dir_of_header_or_die() {
if [ -z "$dir" ]; then
>&2 $ECHO "Fail to find $1 from --headers"
exit 1
else
$ECHO $dir
fi
$ECHO $dir
}
# required headers
PTHREAD_HDR=$(find_dir_of_header_or_die pthread.h)
OPENSSL_HDR=$(find_dir_of_header_or_die openssl/ssl.h)
# Inconvenient to check these headers in baidu-internal
#PTHREAD_HDR=$(find_dir_of_header_or_die pthread.h)
#OPENSSL_HDR=$(find_dir_of_header_or_die openssl/ssl.h)
STATIC_LINKINGS=
DYNAMIC_LINKINGS="-lpthread -lrt -lssl -lcrypto -ldl -lz"
......
BRPC_PATH = ../../
include $(BRPC_PATH)/config.mk
CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -fPIC -fno-omit-frame-pointer
# Notes on the flags:
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -Wno-unused-parameter -fPIC -fno-omit-frame-pointer
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
STATIC_LINKINGS += -lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
......
NEED_GPERFTOOLS=1
BRPC_PATH=../../
include $(BRPC_PATH)/config.mk
CXXFLAGS=-std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -fPIC -fno-omit-frame-pointer
# Notes on the flags:
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -Wno-unused-parameter -fPIC -fno-omit-frame-pointer
ifeq ($(NEED_GPERFTOOLS), 1)
CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
......
NEED_GPERFTOOLS=1
BRPC_PATH=../..
include $(BRPC_PATH)/config.mk
CXXFLAGS=-std=c++0x -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -fPIC -fno-omit-frame-pointer
# Notes on the flags:
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -Wno-unused-parameter -fPIC -fno-omit-frame-pointer
ifeq ($(NEED_GPERFTOOLS), 1)
CXXFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment