Skip to content

Commit 3f292f9

Browse files
committed
fix cmake2 build error
1 parent 09fe57b commit 3f292f9

File tree

7 files changed

+27
-21
lines changed

7 files changed

+27
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ We extend a tool named pgxc_ctl from PG-XC/PG-XL open-source project to support
5656
* install dependent packages (use Centos as an example)
5757

5858
```bash
59-
sudo yum install libzstd-devel libzstd zstd cmake openssl-devel protobuf-devel readline-devel libxml2-devel libxslt-devel zlib-devel bzip2-devel lz4-devel snappy-devel
59+
sudo yum install bison flex libzstd-devel libzstd zstd cmake openssl-devel protobuf-devel readline-devel libxml2-devel libxslt-devel zlib-devel bzip2-devel lz4-devel snappy-devel
6060
```
6161
* set up ssh login without password
6262

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ fi
6161
# build polardb consensus dynamic library
6262
cd $CODEHOME/src/backend/polar_dma/libconsensus/polar_wrapper
6363
if [[ "$BLD_OPT" == "debug" ]]; then
64-
sh ./build.sh -r -t debug
64+
bash ./build.sh -r -t debug
6565
else
66-
sh ./build.sh -r -t release
66+
bash ./build.sh -r -t release
6767
fi
6868
cd $CODEHOME
6969

src/backend/polar_dma/libconsensus/consensus/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ELSE()
7878
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -O3 -fPIC ")
7979
ENDIF()
8080

81-
INCLUDE_DIRECTORIES (include
81+
include_directories(include
8282
${CMAKE_INSTALL_PREFIX}/include/easy
8383
${CMAKE_CURRENT_SOURCE_DIR}/include/
8484
${CMAKE_CURRENT_SOURCE_DIR}/../dependency/easy/src/io/
@@ -119,22 +119,23 @@ link_directories(
119119
${CMAKE_INSTALL_PREFIX}/lib
120120
)
121121

122-
find_package(Protobuf)
122+
find_package(Protobuf REQUIRED)
123123
SET (PROTOBUF_CPP ${CMAKE_CURRENT_SOURCE_DIR}/consensus/protocol/paxos.pb.c ${CMAKE_CURRENT_SOURCE_DIR}/consensus/protocol/paxos.pb.h)
124124
add_custom_command (
125125
OUTPUT ${PROTOBUF_CPP}
126126
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/protocol &&
127-
(${Protobuf_PROTOC_EXECUTABLE} -I. --cpp_out=. paxos.proto)
127+
(${PROTOBUF_PROTOC_EXECUTABLE} -I. --cpp_out=. paxos.proto)
128128
COMMENT "generage protobuf cpp"
129129
)
130130
add_custom_target (paxos_pb
131131
ALL DEPENDS ${PROTOBUF_CPP}
132132
)
133-
INCLUDE_DIRECTORIES(${Protobuf_INCLUDE_DIRS})
134-
ADD_LIBRARY (aliconsensus STATIC ${AC_SRC})
135-
TARGET_LINK_LIBRARIES (aliconsensus pthread snappy z
133+
include_directories(${Protobuf_INCLUDE_DIRS})
134+
add_definitions(-w)
135+
add_library(aliconsensus STATIC ${AC_SRC})
136+
target_link_libraries(aliconsensus pthread snappy z
136137
bz2 lz4 rt ssl crypto myeasy ${PROTOBUF_LIBRARIES} ${EXTRA_LINK})
137-
ADD_DEPENDENCIES(aliconsensus paxos_pb)
138+
add_dependencies(aliconsensus paxos_pb)
138139

139140
install(TARGETS aliconsensus DESTINATION lib)
140141
install(FILES ${INC_FILE} DESTINATION include/aliconsensus)

src/backend/polar_dma/libconsensus/consensus/build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Script for Dev's daily work. It is a good idea to use the exact same
44
# build options as the released version.
55

6+
set -e
7+
68
get_key_value()
79
{
810
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
@@ -89,22 +91,21 @@ else
8991
fi
9092

9193
CWD="`pwd`"
92-
if [[ "${install_dir:0:1}" == "/" ]]
93-
then
94+
if [[ "${install_dir:0:1}" == "/" ]]; then
9495
dest_dir=$install_dir
9596
else
9697
dest_dir=$CWD"/"$install_dir
9798
fi
9899

99100
if [ ! -d bu ];then
100-
mkdir bu
101+
mkdir bu
101102
fi
102103
cd bu
103104

104105
# modify this cmake script for you own needs
105106
cmake -D CMAKE_INSTALL_PREFIX=$dest_dir -D WITH_DEBUG=$debug -D WITHOUT_CXX11_ABI=$without_cxx11_abi -D WITH_TSAN=OFF -D WITH_ASAN=$with_asan ..
106-
make libmyeasy -j
107+
make libmyeasy -sj
107108
cd ../protocol
108109
cd ../bu
109-
make -j
110+
make -sj
110111
make install

src/backend/polar_dma/libconsensus/dependency/easy/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
8181

8282
INCLUDE_DIRECTORIES (${OPENSSL_INCLUDE_DIR} include io packet thread util packet/http)
8383

84+
add_definitions(-w)
8485
add_library (myeasy STATIC ${PRJ_SRC})
8586
TARGET_LINK_LIBRARIES (myeasy ev ${OPENSSL_LIBRARIES})
8687

src/backend/polar_dma/libconsensus/polar_wrapper/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ENDIF()
4343

4444
find_package(Protobuf REQUIRED)
4545
INCLUDE_DIRECTORIES(${Protobuf_INCLUDE_DIRS})
46-
link_directories(${Protobuf_LIBRARIES})
46+
LINK_DIRECTORIES(${Protobuf_LIBRARIES})
4747

4848
INCLUDE_DIRECTORIES (
4949
${CMAKE_CURRENT_SOURCE_DIR}/include
@@ -54,6 +54,7 @@ INCLUDE_DIRECTORIES (
5454
${CMAKE_CURRENT_SOURCE_DIR}/../../../../include
5555
)
5656

57+
ADD_DEFINITIONS(-w)
5758
ADD_LIBRARY (polar_consensus_wrapper SHARED ${AC_SRC})
5859
TARGET_LINK_LIBRARIES (polar_consensus_wrapper protobuf ${EXTRA_LINK})
5960

@@ -63,6 +64,6 @@ TARGET_LINK_LIBRARIES (polar_consensus_wrapper
6364
${CMAKE_CURRENT_SOURCE_DIR}/lib/libaliconsensus.a
6465
"-Wl,--no-whole-archive" ${EXTRA_LINK})
6566

66-
install(TARGETS polar_consensus_wrapper DESTINATION lib)
67-
install(FILES ${INC_FILE} DESTINATION include)
68-
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/easy DESTINATION include)
67+
INSTALL(TARGETS polar_consensus_wrapper DESTINATION lib)
68+
INSTALL(FILES ${INC_FILE} DESTINATION include)
69+
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/easy DESTINATION include)

src/backend/polar_dma/libconsensus/polar_wrapper/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -e
4+
35
usage()
46
{
57
cat <<EOF
@@ -68,7 +70,7 @@ fi
6870
CWD="`pwd`"
6971
cd ../consensus
7072
xpaxos_dest_dir=$CWD
71-
sh -x ./build.sh -t $build_type -a $with_asan -c $without_cxx11_abi -d $xpaxos_dest_dir
73+
bash ./build.sh -t $build_type -a $with_asan -c $without_cxx11_abi -d $xpaxos_dest_dir
7274
cd "${CWD}"
7375

7476
if [ x"$build_type" = x"debug" ]; then
@@ -84,5 +86,5 @@ rm -rf bu
8486
mkdir bu && cd bu
8587

8688
cmake -D CMAKE_INSTALL_PREFIX=../../../ -D WITH_DEBUG=$debug -D WITHOUT_CXX11_ABI=$without_cxx11_abi -D WITH_ASAN=$with_asan ..
87-
make -j
89+
make -sj
8890
make install

0 commit comments

Comments
 (0)