Skip to content

Commit ae19fbf

Browse files
committed
make doris compile successfully on ubuntu 1604 and centos 7.2
1 parent 9ac1669 commit ae19fbf

8 files changed

Lines changed: 62 additions & 64 deletions

File tree

‎be/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ else()
507507
endif()
508508

509509
set(PALO_LINK_LIBS ${PALO_LINK_LIBS}
510-
-lrt -lbfd -liberty -lc -lm -ldl -pthread -lz
510+
-lrt -lbfd -liberty -lc -lm -ldl -pthread
511511
)
512512

513513
# Set libraries for test

‎be/src/codegen/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(IR_DESC_GEN_OUTPUT
4646

4747
add_custom_command(
4848
OUTPUT ${IR_DESC_GEN_OUTPUT}
49-
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/gen_ir_descriptions.py
49+
COMMAND $ENV{PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/gen_ir_descriptions.py
5050
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_ir_descriptions.py
5151
COMMENT "Generating ir cross compile metadata."
5252
VERBATIM

‎build.sh‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,33 @@ PARALLEL=8
3333

3434
# Check java version
3535
if [ -z $JAVA_HOME ]; then
36-
echo "Error: JAVA_HOME is not set."
37-
exit 1
36+
echo "Error: JAVA_HOME is not set, use thirdparty/installed/jdk1.8.0_131"
37+
export JAVA_HOME=${PALO_HOME}/thirdparty/installed/jdk1.8.0_131
3838
fi
39+
3940
JAVA=${JAVA_HOME}/bin/java
4041
JAVA_VER=$(${JAVA} -version 2>&1 | sed 's/.* version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q' | cut -f1 -d " ")
4142
if [ $JAVA_VER -lt 18 ]; then
4243
echo "Require JAVA with JDK version at least 1.8"
4344
exit 1
4445
fi
4546

47+
ANT=ant
4648
# Check ant
47-
if ! ant -version; then
48-
echo "ant is not found."
49-
exit 1
49+
if ! ${ANT} -version; then
50+
echo "ant is not found, use thirdparty/installed/ant"
51+
ANT=${PALO_HOME}/thirdparty/installed/ant/bin/ant
5052
fi
5153

52-
cd ${PALO_HOME}
54+
# check python
55+
export PYTHON=python
56+
if ! ${PYTHON} --version; then
57+
export PYTHON=python2.7
58+
if ! ${PYTHON} --version; then
59+
echo "python is not found"
60+
exit
61+
fi
62+
fi
5363

5464
# Check args
5565
usage() {
@@ -160,9 +170,9 @@ if [ ${BUILD_FE} -eq 1 ] ; then
160170
echo "Build Frontend"
161171
cd ${PALO_HOME}/fe
162172
if [ ${CLEAN} -eq 1 ]; then
163-
ant clean
173+
${ANT} clean
164174
fi
165-
ant install
175+
${ANT} install
166176
cd ${PALO_HOME}
167177
fi
168178

‎gensrc/parser/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif
2828
BUILD_DIR = ${CURDIR}/../build/
2929

3030
OUTPUT_DIR = ${BUILD_DIR}/java/com/baidu/palo/analysis
31-
JAVA = java
31+
JAVA = ${JAVA_HOME}/bin/java
3232
PARSER_ARGS = -jar ${BUILD_DIR}/../../thirdparty/installed/lib/jar/java-cup-0.11a.jar \
3333
-destdir ${OUTPUT_DIR} \
3434
-parser SqlParser -symbols SqlParserSymbols -expect 20

‎gensrc/script/Makefile‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
BUILD_DIR = ${CURDIR}/../build/
2424

25-
PYTHON=python
26-
2725
# Prerequisites on the right side of '|' is only order
2826
all: gen_opcode gen_version gen_builtins
2927
.PHONY: all

‎thirdparty/build-thirdparty.sh‎

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ mkdir -p $TP_DIR/installed
5151
export LD_LIBRARY_PATH=$TP_DIR/installed/lib:$LD_LIBRARY_PATH
5252

5353
if [ -f $PALO_HOME/palo-toolchain/gcc730/bin/gcc ]; then
54-
export GCC_HOME=$curdir/../palo-toolchain/gcc730
54+
GCC_HOME=$curdir/../palo-toolchain/gcc730
55+
export CC=${GCC_HOME}/bin/gcc
56+
export CPP=${GCC_HOME}/bin/cpp
57+
export CXX=${GCC_HOME}/bin/g++
58+
else
59+
export CC=gcc
60+
export CPP=cpp
61+
export CXX=g++
5562
fi
56-
export CC=${GCC_HOME}/bin/gcc
57-
export CPP=${GCC_HOME}/bin/cpp
58-
export CXX=${GCC_HOME}/bin/g++
5963

6064
# Download thirdparties.
61-
sh $TP_DIR/download-thirdparty.sh $@
65+
$TP_DIR/download-thirdparty.sh $@
6266

6367
check_prerequest() {
6468
local CMD=$1
@@ -145,7 +149,7 @@ build_libevent() {
145149
check_if_source_exist $LIBEVENT_SOURCE
146150
cd $TP_SOURCE_DIR/$LIBEVENT_SOURCE
147151
if [ ! -f configure ]; then
148-
sh autogen.sh
152+
./autogen.sh
149153
fi
150154

151155
CFLAGS="-std=c99 -fPIC -D_BSD_SOURCE -fno-omit-frame-pointer -g -ggdb -O2 -I${TP_INCLUDE_DIR}" \
@@ -154,26 +158,15 @@ build_libevent() {
154158
make -j2 && make install
155159
}
156160

157-
# python
158-
build_python() {
159-
check_if_source_exist $PYTHON_SOURCE
160-
cd $TP_SOURCE_DIR/$PYTHON_SOURCE
161-
162-
CPPFLAGS="-I${TP_INCLUDE_DIR} -I${TP_INCLUDE_DIR}/ncurses/" \
163-
LDFLAGS="-L${TP_LIB_DIR}" \
164-
CFLAGS="-fPIC" \
165-
./configure --prefix=$TP_INSTALL_DIR
166-
make -j2 && make install
167-
}
168-
169161
build_openssl() {
170162
check_if_source_exist $OPENSSL_SOURCE
171163
cd $TP_SOURCE_DIR/$OPENSSL_SOURCE
172164

173-
CPPFLAGS="-I${TP_INCLUDE_DIR}" \
165+
CPPFLAGS="-I${TP_INCLUDE_DIR} -fPIC" \
166+
CXXFLAGS="-I${TP_INCLUDE_DIR} -fPIC" \
174167
LDFLAGS="-L${TP_LIB_DIR}" \
175168
CFLAGS="-fPIC" \
176-
./Configure --prefix=$TP_INSTALL_DIR shared linux-x86_64
169+
./Configure --prefix=$TP_INSTALL_DIR -zlib -shared linux-x86_64
177170
make -j2 && make install
178171
}
179172

@@ -183,11 +176,16 @@ build_thrift() {
183176
cd $TP_SOURCE_DIR/$THRIFT_SOURCE
184177

185178
if [ ! -f configure ]; then
186-
sh bootstrap.sh
179+
./bootstrap.sh
187180
fi
188181

189182
echo ${TP_LIB_DIR}
190-
./configure CPPFLAGS="-I${TP_INCLUDE_DIR}" LDFLAGS="-L${TP_LIB_DIR}" LIBS="-lcrypto" CFLAGS="-fPIC" --prefix=$TP_INSTALL_DIR --docdir=$TP_INSTALL_DIR/doc --enable-static --disable-tests --disable-tutorial --without-qt4 --without-qt5 --without-csharp --without-erlang --without-nodejs --without-lua --without-perl --without-php --without-php_extension --without-dart --without-ruby --without-haskell --without-go --without-haxe --without-d --without-python -without-java --with-cpp --with-libevent=$TP_INSTALL_DIR --with-boost=$TP_INSTALL_DIR --with-openssl=$TP_INSTALL_DIR
183+
./configure CPPFLAGS="-I${TP_INCLUDE_DIR}" LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" LIBS="-lcrypto -ldl -lssl" CFLAGS="-fPIC" \
184+
--prefix=$TP_INSTALL_DIR --docdir=$TP_INSTALL_DIR/doc --enable-static --disable-shared --disable-tests \
185+
--disable-tutorial --without-qt4 --without-qt5 --without-csharp --without-erlang --without-nodejs \
186+
--without-lua --without-perl --without-php --without-php_extension --without-dart --without-ruby \
187+
--without-haskell --without-go --without-haxe --without-d --without-python -without-java --with-cpp \
188+
--with-libevent=$TP_INSTALL_DIR --with-boost=$TP_INSTALL_DIR --with-openssl=$TP_INSTALL_DIR
191189

192190
if [ -f compiler/cpp/thrifty.hh ];then
193191
mv compiler/cpp/thrifty.hh compiler/cpp/thrifty.h
@@ -229,10 +227,10 @@ build_protobuf() {
229227
cd $TP_SOURCE_DIR/$PROTOBUF_SOURCE
230228
rm -fr gmock
231229
mkdir gmock && cd gmock && tar xf ${TP_SOURCE_DIR}/googletest-release-1.8.0.tar.gz \
232-
&& mv googletest-release-1.8.0 gtest && cd $TP_SOURCE_DIR/$PROTOBUF_SOURCE && sh autogen.sh
233-
CXXFLAGS="-fPIC -O2" \
230+
&& mv googletest-release-1.8.0 gtest && cd $TP_SOURCE_DIR/$PROTOBUF_SOURCE && ./autogen.sh
231+
CXXFLAGS="-fPIC -O2 -I ${TP_INCLUDE_DIR}" \
234232
LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \
235-
./configure --prefix=${TP_INSTALL_DIR} --disable-shared --enable-static
233+
./configure --prefix=${TP_INSTALL_DIR} --disable-shared --enable-static --with-zlib=${TP_INSTALL_DIR}/include
236234
cd src
237235
sed -i 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile
238236
make -j$PARALLEL
@@ -310,7 +308,7 @@ build_gperftools() {
310308
check_if_source_exist $GPERFTOOLS_SOURCE
311309
cd $TP_SOURCE_DIR/$GPERFTOOLS_SOURCE
312310
if [ ! -f configure ]; then
313-
sh autogen.sh
311+
./autogen.sh
314312
fi
315313

316314
CPPFLAGS="-I${TP_INCLUDE_DIR}" \
@@ -362,18 +360,6 @@ build_lzo2() {
362360
make -j$PARALLEL && make install
363361
}
364362

365-
# ncurses
366-
build_ncurses() {
367-
check_if_source_exist $NCURSES_SOURCE
368-
cd $TP_SOURCE_DIR/$NCURSES_SOURCE
369-
370-
CPPFLAGS="-I${TP_INCLUDE_DIR} -P" \
371-
LDFLAGS="-L${TP_LIB_DIR}" \
372-
CFLAGS="-fPIC" \
373-
./configure --prefix=$TP_INSTALL_DIR
374-
make -j$PARALLEL && make install
375-
}
376-
377363
# curl
378364
build_curl() {
379365
check_if_source_exist $CURL_SOURCE
@@ -402,7 +388,7 @@ build_boost() {
402388
cd $TP_SOURCE_DIR/$BOOST_SOURCE
403389

404390
echo "using gcc : $GCC_VERSION : $CXX ; " > tools/build/src/user-config.jam
405-
sh bootstrap.sh --prefix=$TP_INSTALL_DIR
391+
./bootstrap.sh --prefix=$TP_INSTALL_DIR
406392
./b2 link=static -d0 -j$PARALLEL --without-mpi --without-graph --without-graph_parallel --without-python cxxflags="-std=c++11 -fPIC -I$TP_INCLUDE_DIR -L$TP_LIB_DIR" install
407393
}
408394

@@ -424,7 +410,6 @@ build_mysql() {
424410
fi
425411

426412
$CMAKE_CMD ../ -DWITH_BOOST=`pwd`/$BOOST_FOR_MYSQL_SOURCE -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR/mysql/ \
427-
-DNCURSES_LIBRARY=$TP_LIB_DIR/libncurses.a -DNCURSES_INCLUDE_PATH=$TP_INCLUDE_DIR/ncurses/ \
428413
-DCMAKE_INCLUDE_PATH=$TP_INCLUDE_DIR -DCMAKE_LIBRARY_PATH=$TP_LIB_DIR -DWITHOUT_SERVER=1 \
429414
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -std=gnu++11" \
430415
-DDISABLE_SHARED=1 -DBUILD_SHARED_LIBS=0
@@ -464,11 +449,16 @@ build_brpc() {
464449
cd $TP_SOURCE_DIR/$BRPC_SOURCE
465450
mkdir build -p && cd build
466451
rm -rf CMakeCache.txt CMakeFiles/
452+
LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \
467453
$CMAKE_CMD -v -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR \
468454
-DBRPC_WITH_GLOG=ON -DCMAKE_INCLUDE_PATH="$TP_INSTALL_DIR/include" \
469455
-DCMAKE_LIBRARY_PATH="$TP_INSTALL_DIR/lib;$TP_INSTALL_DIR/lib64" \
470-
-DPROTOBUF_PROTOC_EXECUTABLE=$TP_INSTALL_DIR/bin/protoc ..
456+
-DPROTOBUF_PROTOC_EXECUTABLE=$TP_INSTALL_DIR/bin/protoc \
457+
-DProtobuf_PROTOC_EXECUTABLE=$TP_INSTALL_DIR/bin/protoc ..
471458
make -j$PARALLEL && make install
459+
if [ -f $TP_INSTALL_DIR/lib/libbrpc.a ]; then
460+
mkdir -p $TP_INSTALL_DIR/lib64 && ln -s $TP_INSTALL_DIR/lib/libbrpc.a $TP_INSTALL_DIR/lib64/libbrpc.a
461+
fi
472462
}
473463

474464
# java
@@ -499,13 +489,12 @@ build_ant() {
499489

500490
build_llvm
501491
build_libevent
502-
build_openssl
503492
build_zlib
504493
build_lz4
505494
build_bzip
506495
build_lzo2
496+
build_openssl
507497
build_boost # must before thrift
508-
build_ncurses
509498
build_protobuf
510499
build_gflags
511500
build_glog

‎thirdparty/download-thirdparty.sh‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ cd -
195195
echo "Finished patching $LIBEVENT_SOURCE"
196196

197197
# thrift patch
198-
cd $TP_SOURCE_DIR/$THRIFT_SOURCE
199-
if [ ! -f $PATCHED_MARK ]; then
200-
patch -p0 < $TP_PATCH_DIR/thrift-0.9.3-aclocal.patch
201-
touch $PATCHED_MARK
202-
fi
203-
cd -
204-
echo "Finished patching $THRIFT_SOURCE"
198+
# cd $TP_SOURCE_DIR/$THRIFT_SOURCE
199+
# if [ ! -f $PATCHED_MARK ]; then
200+
# patch -p0 < $TP_PATCH_DIR/thrift-0.9.3-aclocal.patch
201+
# touch $PATCHED_MARK
202+
# fi
203+
# cd -
204+
# echo "Finished patching $THRIFT_SOURCE"
205205

206206
if test "x$REPOSITORY_URL" != x; then
207207
cd $TP_SOURCE_DIR/$COMPILER_RT_SOURCE

‎thirdparty/vars.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ LZ4_NAME=lz4-1.7.5.tar.gz
124124
LZ4_SOURCE=lz4-1.7.5
125125

126126
# bzip
127-
BZIP_DOWNLOAD="http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
127+
# BZIP_DOWNLOAD="http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
128+
BZIP_DOWNLOAD="https://fossies.org/linux/misc/bzip2-1.0.6.tar.gz"
128129
BZIP_NAME=bzip2-1.0.6.tar.gz
129130
BZIP_SOURCE=bzip2-1.0.6
130131

0 commit comments

Comments
 (0)