Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
887fc474
Commit
887fc474
authored
Sep 16, 2017
by
Zhangyi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile issues with glog on ubuntu-16.04
parent
147062b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
8 deletions
+50
-8
config_brpc.sh
config_brpc.sh
+43
-8
logging.h
src/butil/logging.h
+7
-0
No files found.
config_brpc.sh
View file @
887fc474
...
...
@@ -50,7 +50,7 @@ if [ -z "$HDRS_IN" ] || [ -z "$LIBS_IN" ]; then
fi
find_dir_of_lib
()
{
local
lib
=
$(
find
${
LIBS_IN
}
-name
"lib
${
1
}
.a"
-o
-name
"lib
${
1
}
.so"
|
head
-n1
)
local
lib
=
$(
find
${
LIBS_IN
}
-name
"lib
${
1
}
.a"
-o
-name
"lib
${
1
}
.so"
-o
-name
"lib
${
1
}
.so.*"
|
head
-n1
)
if
[
!
-z
"
$lib
"
]
;
then
dirname
$lib
fi
...
...
@@ -183,9 +183,11 @@ append_to_output_libs() {
# $1: libdir, $2: libname, $3: indentation
append_to_output_linkings
()
{
if
[
-f
$1
/lib
$2
.a
]
;
then
append_to_output_libs
$1
$3
append_to_output
"
${
3
}
STATIC_LINKINGS+=-l
$2
"
export
STATICALLY_LINKED_
$2
=
1
else
append_to_output_libs
$1
$3
append_to_output
"
${
3
}
DYNAMIC_LINKINGS+=-l
$2
"
export
STATICALLY_LINKED_
$2
=
0
fi
...
...
@@ -217,6 +219,14 @@ else
fi
append_to_output
"endif"
# Check libunwind (required by tcmalloc and glog)
UNWIND_LIB
=
$(
find_dir_of_lib unwind
)
HAS_STATIC_UNWIND
=
""
if
[
-f
$UNWIND_LIB
/libunwind.a
]
;
then
HAS_STATIC_UNWIND
=
"yes"
fi
REQUIRE_UNWIND
=
""
OLD_HDRS
=
$HDRS
OLD_LIBS
=
$LIBS
append_to_output
"ifeq (
\$
(NEED_GPERFTOOLS), 1)"
...
...
@@ -232,18 +242,19 @@ else
if
[
-f
$TCMALLOC_LIB
/libtcmalloc.so
]
;
then
ldd
$TCMALLOC_LIB
/libtcmalloc.so
>
libtcmalloc.deps
if
grep
-q
libunwind libtcmalloc.deps
;
then
UNWIND_LIB
=
$(
find_dir_of_lib unwind
)
TCMALLOC_REQUIRE_UNWIND
=
"yes"
REQUIRE_UNWIND
=
"yes"
fi
fi
if
[
-z
"
$REQUIRE_UNWIND
"
]
;
then
if
[
-z
"
$
TCMALLOC_
REQUIRE_UNWIND
"
]
;
then
append_to_output
" STATIC_LINKINGS+=-ltcmalloc_and_profiler"
elif
[
-f
$UNWIND_LIB
/libunwind.a
]
;
then
append_to_output_libs
"
$UNWIND_LIB
"
" "
elif
[
!
-z
"
$HAS_STATIC_UNWIND
"
]
;
then
append_to_output
" STATIC_LINKINGS+=-ltcmalloc_and_profiler -lunwind"
if
grep
-q
liblzma libtcmalloc.deps
;
then
LZMA_LIB
=
$(
find_dir_of_lib lzma
)
append_to_output_linkings
$LZMA_LIB
lzma
" "
if
[
!
-z
"
$LZMA_LIB
"
]
;
then
append_to_output_linkings
$LZMA_LIB
lzma
" "
fi
fi
else
append_to_output
" DYNAMIC_LINKINGS+=-ltcmalloc_and_profiler"
...
...
@@ -264,14 +275,38 @@ if [ $WITH_GLOG != 0 ]; then
else
append_to_output_libs
"
$GLOG_LIB
"
" "
if
[
-f
$GLOG_LIB
/libglog.a
]
;
then
append_to_output
" STATIC_LINKINGS+=-lglog"
if
[
-f
"
$GLOG_LIB
/libglog.so"
]
;
then
ldd
$GLOG_LIB
/libglog.so
>
libglog.deps
if
grep
-q
libunwind libglog.deps
;
then
GLOG_REQUIRE_UNWIND
=
"yes"
REQUIRE_UNWIND
=
"yes"
fi
fi
if
[
-z
"
$GLOG_REQUIRE_UNWIND
"
]
;
then
append_to_output
"STATIC_LINKINGS+=-lglog"
elif
[
!
-z
"
$HAS_STATIC_UNWIND
"
]
;
then
append_to_output
"STATIC_LINKINGS+=-lglog -lunwind"
if
grep
-q
liblzma libglog.deps
;
then
LZMA_LIB
=
$(
find_dir_of_lib lzma
)
if
[
!
-z
"
$LZMA_LIB
"
]
;
then
append_to_output_linkings
$LZMA_LIB
lzma
fi
fi
else
append_to_output
"DYNAMIC_LINKINGS+=-lglog"
fi
else
append_to_output
"
DYNAMIC_LINKINGS+=-lglog"
append_to_output
"DYNAMIC_LINKINGS+=-lglog"
fi
rm
-f
libglog.deps
fi
fi
append_to_output
"CPPFLAGS+=-DBRPC_WITH_GLOG=
$WITH_GLOG
"
if
[
!
-z
"
$REQUIRE_UNWIND
"
]
;
then
append_to_output_libs
"
$UNWIND_LIB
"
" "
fi
# required by UT
#gtest
GTEST_LIB
=
$(
find_dir_of_lib gtest
)
...
...
src/butil/logging.h
View file @
887fc474
...
...
@@ -33,6 +33,13 @@
# include <glog/logging.h>
# include <glog/raw_logging.h>
// define macros that not implemented in glog
# ifndef DCHECK_IS_ON // glog didn't define DCHECK_IS_ON in older version
# if defined(NDEBUG)
# define DCHECK_IS_ON() 0
# else
# define DCHECK_IS_ON() 1
# endif // NDEBUG
# endif // DCHECK_IS_ON
# if DCHECK_IS_ON()
# define DPLOG(...) PLOG(__VA_ARGS__)
# define DPLOG_IF(...) PLOG_IF(__VA_ARGS__)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment