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
6a2aafc8
Commit
6a2aafc8
authored
Aug 18, 2017
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation in ubuntu; Update README
Change-Id: I2a2ba1d9c9180f8d7210508207442b77d4f115da
parent
83507a6b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
32 deletions
+57
-32
Makefile
Makefile
+1
-1
README
README
+6
-2
config_brpc.sh
config_brpc.sh
+35
-13
Makefile
example/echo_c++/Makefile
+2
-2
Makefile
example/http_c++/Makefile
+3
-3
Makefile
example/memcache_c++/Makefile
+1
-1
Makefile
example/multi_threaded_echo_c++/Makefile
+2
-2
Makefile
example/redis_c++/Makefile
+2
-2
Makefile
test/Makefile
+5
-6
No files found.
Makefile
View file @
6a2aafc8
...
...
@@ -261,7 +261,7 @@ libmcpack2pb.dbg.a:$(MCPACK2PB_DEBUG_OBJS)
protoc-gen-mcpack
:
mcpack2pb/generator.o libmcpack2pb.a libbase.a libbthread.a libbvar.a
@
echo
"Linking
$@
"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
libbrpc.a
:
$(BRPC_OBJS)
@
echo
"Packing
$@
"
...
...
README
View file @
6a2aafc8
...
...
@@ -8,18 +8,22 @@ protobuf: sudo apt-get install libprotobuf-dev libprotoc-dev protobuf-compiler
leveldb(used by rpcz): sudo apt-get install libleveldb-dev libsnappy-dev
openssl(for https): libssl-dev
**compile**
git clone this repo. cd into the repo and run: sh config_brpc.sh --
inc
s=/usr/include --libs=/usr/lib
git clone this repo. cd into the repo and run: sh config_brpc.sh --
header
s=/usr/include --libs=/usr/lib
**run echo example**
cd into example/echo_c++, make, run echo_server and echo_client
**run examples with cpu/heap profilers**
sudo apt-get install libgoogle-perftools-dev libunwind-dev liblzma-dev
Rerun config_brpc.sh
**compile tests**
Install gmock and gtest, use the gtest embedded in gmock and don't install libgtest-dev
sudo apt-get install google-mock; cd /usr/src; sudo cmake .; sudo make; sudo mv lib*.a gtest/lib*.a /usr/lib; sudo mv gtest/include/gtest /usr/include/
Rerun config_brpc.sh and run make in test/
### Baidu-internal
**setup directories**
download deps: third-64/gflags@gflags_2-0-0-100_PD_BL third-64/protobuf@protobuf_2-4-1-1100_PD_BL third-64/leveldb@leveldb_1-0-0-0_PD_BL
**compile**
git clone this repo. cd into the repo and run: sh config_brpc.sh --
inc
s=../../../third-64 --libs=../../../third-64
git clone this repo. cd into the repo and run: sh config_brpc.sh --
header
s=../../../third-64 --libs=../../../third-64
**run examples with cpu/heap profilers**
download deps: third-64/tcmalloc@tcmalloc_1-7-0-200_PD_BL
Rerun config_brpc.sh
config_brpc.sh
View file @
6a2aafc8
...
...
@@ -123,7 +123,9 @@ CONTENT="${CONTENT}\nDYNAMIC_LINKINGS=$DYNAMIC_LINKINGS"
CONTENT
=
"
${
CONTENT
}
\n
ifeq (
\$
(NEED_GPERFTOOLS), 1)"
# required by cpu/heap profiler
TCMALLOC_LIB
=
$(
find_dir_of_lib tcmalloc_and_profiler
)
if
[
!
-z
"
$TCMALLOC_LIB
"
]
;
then
if
[
-z
"
$TCMALLOC_LIB
"
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
\$
(error
\"
Fail to find gperftools
\"
)"
else
if
absent_in_the_list
"
$TCMALLOC_LIB
"
"
$LIBS2
"
;
then
CONTENT
=
"
${
CONTENT
}
\n
LIBS+=
$TCMALLOC_LIB
"
LIBS2
=
"
${
LIBS2
}
\n
$TCMALLOC_LIB
"
...
...
@@ -159,26 +161,46 @@ CONTENT="${CONTENT}\nendif"
# required by UT
#gtest
GTEST_LIB
=
$(
find_dir_of_lib gtest
)
GTEST_HDR
=
$(
find_dir_of_header gtest/gtest.h
)
CONTENT
=
"
${
CONTENT
}
\n
ifeq (
\$
(NEED_GTEST), 1)"
CONTENT
=
"
${
CONTENT
}
\n
HDRS+=
$GTEST_HDR
"
CONTENT
=
"
${
CONTENT
}
\n
LIBS+=
$GTEST_LIB
"
if
[
-f
$GTEST_LIB
/libgtest.a
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
STATIC_LINKINGS+=-lgtest -lgtest_main"
if
[
-z
"
$GTEST_LIB
"
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
\$
(error
\"
Fail to find gtest
\"
)"
else
CONTENT
=
"
${
CONTENT
}
\n
DYNAMIC_LINKINGS+=-lgtest -lgtest_main"
GTEST_HDR
=
$(
find_dir_of_header gtest/gtest.h
)
if
absent_in_the_list
"
$GTEST_LIB
"
"
$LIBS2
"
;
then
CONTENT
=
"
${
CONTENT
}
\n
LIBS+=
$GTEST_LIB
"
LIBS2
=
"
${
LIBS2
}
\n
$GTEST_LIB
"
fi
if
absent_in_the_list
"
$GTEST_HDR
"
"
$HDRS2
"
;
then
CONTENT
=
"
${
CONTENT
}
\n
HDRS+=
$GTEST_HDR
"
HDRS2
=
"
${
HDRS2
}
\n
$GTEST_HDR
"
fi
if
[
-f
$GTEST_LIB
/libgtest.a
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
STATIC_LINKINGS+=-lgtest -lgtest_main"
else
CONTENT
=
"
${
CONTENT
}
\n
DYNAMIC_LINKINGS+=-lgtest -lgtest_main"
fi
fi
CONTENT
=
"
${
CONTENT
}
\n
endif"
#gmock
GMOCK_LIB
=
$(
find_dir_of_lib gmock
)
GMOCK_HDR
=
$(
find_dir_of_header gmock/gmock.h
)
CONTENT
=
"
${
CONTENT
}
\n
ifeq (
\$
(NEED_GMOCK), 1)"
CONTENT
=
"
${
CONTENT
}
\n
HDRS+=
$GMOCK_HDR
"
CONTENT
=
"
${
CONTENT
}
\n
LIBS+=
$GMOCK_LIB
"
if
[
-f
$GMOCK_LIB
/libgmock.a
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
STATIC_LINKINGS+=-lgmock -lgmock_main"
if
[
-z
"
$GMOCK_LIB
"
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
\$
(error
\"
Fail to find gmock
\"
)"
else
CONTENT
=
"
${
CONTENT
}
\n
DYNAMIC_LINKINGS+=-lgmock -lgmock_main"
GMOCK_HDR
=
$(
find_dir_of_header gmock/gmock.h
)
if
absent_in_the_list
"
$GMOCK_LIB
"
"
$LIBS2
"
;
then
CONTENT
=
"
${
CONTENT
}
\n
LIBS+=
$GMOCK_LIB
"
LIBS2
=
"
${
LIBS2
}
\n
$GMOCK_LIB
"
fi
if
absent_in_the_list
"
$GMOCK_HDR
"
"
$HDRS2
"
;
then
CONTENT
=
"
${
CONTENT
}
\n
HDRS+=
$GMOCK_HDR
"
HDRS2
=
"
${
HDRS2
}
\n
$GMOCK_HDR
"
fi
if
[
-f
$GMOCK_LIB
/libgmock.a
]
;
then
CONTENT
=
"
${
CONTENT
}
\n
STATIC_LINKINGS+=-lgmock -lgmock_main"
else
CONTENT
=
"
${
CONTENT
}
\n
DYNAMIC_LINKINGS+=-lgmock -lgmock_main"
fi
fi
CONTENT
=
"
${
CONTENT
}
\n
endif"
$ECHO
"
$CONTENT
"
>
config.mk
example/echo_c++/Makefile
View file @
6a2aafc8
...
...
@@ -25,11 +25,11 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
$(LDFLA
GS)
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKIN
GS)
-o
$@
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
$(LDFLA
GS)
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKIN
GS)
-o
$@
%.pb.cc
:
%.proto
@
echo
"Generating
$@
"
...
...
example/http_c++/Makefile
View file @
6a2aafc8
...
...
@@ -32,15 +32,15 @@ clean:
http_client
:
$(CLIENT_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
benchmark_http
:
$(BENCHMARK_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
http_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
%.pb.cc
:
%.proto
@
echo
"Generating
$@
"
...
...
example/memcache_c++/Makefile
View file @
6a2aafc8
...
...
@@ -19,7 +19,7 @@ clean:
memcache_client
:
$(OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
example/multi_threaded_echo_c++/Makefile
View file @
6a2aafc8
...
...
@@ -30,11 +30,11 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
%.pb.cc
:
%.proto
@
echo
"Generating
$@
"
...
...
example/redis_c++/Makefile
View file @
6a2aafc8
...
...
@@ -23,11 +23,11 @@ clean:
redis_press
:
$(PRESS_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
redis_cli
:
$(CLI_OBJS)
@
echo
"Linking
$@
"
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
-Xlinker
"-)"
-o
$@
@
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
test/Makefile
View file @
6a2aafc8
...
...
@@ -9,7 +9,6 @@ CFLAGS=$(CPPFLAGS) -g -pipe -Wall -W -Werror -fPIC -fstrict-aliasing -Wno-unused
HDRPATHS
=
-I
.
-I
..
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
LDFLAGS
=
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
$(DYNAMIC_LINKINGS)
TEST_BASE_SOURCES
=
\
at_exit_unittest.cc
\
...
...
@@ -172,19 +171,19 @@ clean_bins:
test_base
:
$(TEST_BASE_OBJS) ../libbase.dbg.a
@
echo
"Linking
$@
"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
$(LDFLAGS)
-Xlinker
"-)"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
test_bvar
:
$(TEST_BVAR_OBJS) ../libbase.dbg.a ../libbvar.dbg.a
@
echo
"Linking
$@
"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
$(LDFLAGS)
-Xlinker
"-)"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
bthread%unittest
:
bthread%unittest.o ../libbase.dbg.a ../libbvar.dbg.a ../libbthread.dbg.a
@
echo
"Linking
$@
"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
$(LDFLAGS)
-Xlinker
"-)"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
brpc_%_unittest
:
brpc_%_unittest.o $(TEST_PROTO_OBJS)
../libbase.dbg.a ../libbvar.dbg.a ../libbthread.dbg.a ../libbrpc.dbg.a ../libmcpack2pb.dbg.a ../libjson2pb.dbg.a
brpc_%_unittest
:
$(TEST_PROTO_OBJS) brpc_%_unittest.o
../libbase.dbg.a ../libbvar.dbg.a ../libbthread.dbg.a ../libbrpc.dbg.a ../libmcpack2pb.dbg.a ../libjson2pb.dbg.a
@
echo
"Linking
$@
"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
$(LDFLAGS)
-Xlinker
"-)"
@
$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
%.pb.cc
:
%.proto
@
echo
"Generating
$@
"
...
...
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