Skip to content

Commit

Permalink
build on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 28, 2020
1 parent 11c0aaf commit 61c7d03
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
10 changes: 10 additions & 0 deletions contrib/udf/src/udf_samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples")
# where to put generated binaries
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples")

if(POLICY CMP0042)
# https://cmake.org/cmake/help/v3.9/policy/CMP0042.html
cmake_policy(SET CMP0042 NEW)
endif()

if(POLICY CMP0068)
# https://cmake.org/cmake/help/v3.9/policy/CMP0068.html
cmake_policy(SET CMP0068 NEW)
endif()

add_library(udfsample SHARED udf_sample.cpp)
target_link_libraries(udfsample
-static-libstdc++
Expand Down
22 changes: 11 additions & 11 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ if [[ -z ${DORIS_HOME} ]]; then
fi

# check OS type
if [[ ! -z "$OSTYPE" ]]; then
if [[ "$OSTYPE" != "linux-gnu" ]]; then
echo "Error: Unsupported OS type: $OSTYPE"
exit 1
fi
fi
#if [[ ! -z "$OSTYPE" ]]; then
# if [[ "$OSTYPE" != "linux-gnu" ]]; then
# echo "Error: Unsupported OS type: $OSTYPE"
# exit 1
# fi
#fi

# include custom environment variables
if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then
Expand Down Expand Up @@ -84,11 +84,11 @@ MVN_CMD=mvn
if [[ ! -z ${CUSTOM_MVN} ]]; then
MVN_CMD=${CUSTOM_MVN}
fi
if ! ${MVN_CMD} --version; then
echo "Error: mvn is not found"
exit 1
fi
export MVN_CMD
#if ! ${MVN_CMD} --version; then
# echo "Error: mvn is not found"
# exit 1
#fi
#export MVN_CMD

CMAKE_CMD=cmake
if [[ ! -z ${CUSTOM_CMAKE} ]]; then
Expand Down
39 changes: 20 additions & 19 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ check_prerequest "automake --version" "automake"

# sudo apt-get install libtool
# sudo yum install libtool
check_prerequest "libtoolize --version" "libtool"
#check_prerequest "libtool --version" "libtool"

# sudo apt-get install binutils-dev
# sudo yum install binutils-devel
Expand Down Expand Up @@ -210,7 +210,7 @@ build_thrift() {
fi

echo ${TP_LIB_DIR}
./configure CPPFLAGS="-I${TP_INCLUDE_DIR}" LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" LIBS="-lcrypto -ldl -lssl" CFLAGS="-fPIC" \
./configure CPPFLAGS="-I${TP_INCLUDE_DIR} -I/usr/local/opt/openssl/include" LDFLAGS="-L${TP_LIB_DIR} -L/usr/local/opt/openssl/lib -L/usr/local/opt/bison/lib -static-libstdc++ -static-libgcc" LIBS="-lcrypto -ldl -lssl" CFLAGS="-fPIC" \
--prefix=$TP_INSTALL_DIR --docdir=$TP_INSTALL_DIR/doc --enable-static --disable-shared --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 \
Expand Down Expand Up @@ -257,13 +257,13 @@ build_protobuf() {
check_if_source_exist $PROTOBUF_SOURCE
cd $TP_SOURCE_DIR/$PROTOBUF_SOURCE
rm -fr gmock
mkdir gmock && cd gmock && tar xf ${TP_SOURCE_DIR}/googletest-release-1.8.0.tar.gz \
mkdir -p gmock && cd gmock && tar xf ${TP_SOURCE_DIR}/googletest-release-1.8.0.tar.gz \
&& mv googletest-release-1.8.0 gtest && cd $TP_SOURCE_DIR/$PROTOBUF_SOURCE && ./autogen.sh
CXXFLAGS="-fPIC -O2 -I ${TP_INCLUDE_DIR}" \
LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \
./configure --prefix=${TP_INSTALL_DIR} --disable-shared --enable-static --with-zlib=${TP_INSTALL_DIR}/include
cd src
sed -i 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile
sed -i '.bak' 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile
cd -
make -j$PARALLEL && make install
}
Expand Down Expand Up @@ -432,7 +432,7 @@ build_boost() {

echo "using gcc : doris : ${CXX} ; " > tools/build/src/user-config.jam
./bootstrap.sh --prefix=$TP_INSTALL_DIR
./b2 --toolset=gcc-doris 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
./b2 --toolset=gcc-doris link=static -d0 --without-mpi --without-graph --without-graph_parallel --without-python cxxflags="-std=c++11 -fPIC -I$TP_INCLUDE_DIR -L$TP_LIB_DIR" install
}

# mysql
Expand All @@ -456,7 +456,7 @@ build_mysql() {

# copy headers manually
rm -rf ../../../installed/include/mysql/
mkdir ../../../installed/include/mysql/ -p
mkdir -p ../../../installed/include/mysql/
cp -R ./include/* ../../../installed/include/mysql/
cp -R ../include/* ../../../installed/include/mysql/
cp ../libbinlogevents/export/binary_log_types.h ../../../installed/include/mysql/
Expand Down Expand Up @@ -514,7 +514,7 @@ build_librdkafka() {
cd $TP_SOURCE_DIR/$LIBRDKAFKA_SOURCE

CPPFLAGS="-I${TP_INCLUDE_DIR}" \
LDFLAGS="-L${TP_LIB_DIR}" \
LDFLAGS="-L${TP_LIB_DIR} -L/usr/local/opt/openssl/lib" \
CFLAGS="-fPIC" \
./configure --prefix=$TP_INSTALL_DIR --enable-static --disable-sasl
make -j$PARALLEL && make install
Expand Down Expand Up @@ -592,14 +592,15 @@ build_s2() {
mkdir -p $BUILD_DIR && cd $BUILD_DIR
rm -rf CMakeCache.txt CMakeFiles/
CXXFLAGS="-O3" \
LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \
LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc -L/usr/local/opt/openssl/lib" \
$CMAKE_CMD -v -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR \
-DCMAKE_INCLUDE_PATH="$TP_INSTALL_DIR/include" \
-DBUILD_SHARED_LIBS=OFF \
-DGFLAGS_ROOT_DIR="$TP_INSTALL_DIR/include" \
-DWITH_GFLAGS=ON \
-DGLOG_ROOT_DIR="$TP_INSTALL_DIR/include" \
-DWITH_GLOG=ON \
-DOPENSSL_INCLUDE_DIR="/usr/local/opt/openssl/include" \
-DCMAKE_LIBRARY_PATH="$TP_INSTALL_DIR/lib;$TP_INSTALL_DIR/lib64" ..
make -j$PARALLEL && make install
}
Expand Down Expand Up @@ -726,30 +727,30 @@ build_zlib
build_lz4
build_bzip
build_lzo2
build_openssl
build_boost # must before thrift
#build_openssl
#build_boost # must before thrift
build_protobuf
build_gflags
build_gtest
build_glog
build_rapidjson
build_snappy
build_gperftools
build_curl
#build_curl
build_re2
build_mysql
#build_mysql
build_thrift
build_leveldb
build_brpc
#build_brpc
build_rocksdb
build_librdkafka
build_flatbuffers
build_arrow
build_s2
build_bitshuffle
#build_librdkafka
#build_flatbuffers
#build_arrow
#build_s2 ldld:: cannotcannot linklink directlydirectly withwith dylibdylib//frameworkframework,, youryour binarybinary isis notnot anan allowedallowed clientclient ofof //usrusr//liblib//libcrypto.dyliblibcrypto.dylib forfor architecturearchitecture x86_64x86_64
#build_bitshuffle objcopy
build_croaringbitmap
build_orc
build_cctz
build_js_and_css
#build_cctz

echo "Finihsed to build all thirdparties"

0 comments on commit 61c7d03

Please sign in to comment.