李士朝
发布于

编译源码包

1.基础环境准备

1.1.下载 docker image

找项目负责人提供

1.2.准备 code 和三方库

#准备好三方库安装包dependency-clang-x86_64-Linux.tar.xz
#准备好CHAWQ源代码安装包oushudb.tar.gz
mkdir -p /data1/code/
mkdir -p /data1/code/res_hawq
tar -xzvf oushudb.tar.gz -C /data1/code/
xz -d dependency-clang-x86_64-Linux.tar.xz
tar -xvf dependency-clang-x86_64-Linux.tar -C /data1/code/

1.3.安装 docker

#安装docker服务并启动
yum install -y   docker
systemctl start  docker
systemctl status docker

1.4.导入镜像

docker load < hawq_compile.tar.gz
#查看镜像
docker ps -a

2.编译

2.1.启动编译 docker

#启动编译的docker
sudo docker run -it \
-v /data1/code/oushudb:/root/hawq \
-v /data1/code/dependency-clang-x86_64-Linux:/opt/dependency-clang-x86_64-Linux   \
-v /data1/code/res_hawq:/usr/local \
--privileged=true  -e BUILD_NUMBER=27246 -e DB_VERSION=4.0.5.0 --entrypoint /bin/bash hub.oushu-tech.com/hawq_compile:v4.0.0.2

2.2.配置环境变量

#进行环境变量配置
export PATH=/opt/clang/bin:/opt/cmake/bin:$PATH
export LD_LIBRARY_PATH=/opt/clang/lib:$LD_LIBRARY_PATH
export DEPENDENCY_PATH=/opt/dependency-clang-x86_64-Linux/package/
export CPATH=/opt/clang/include/c++/v1/
export LIBRARY_PATH=/opt/clang/lib
unset CPPFLAGS
unset CFLAGS
export CXXFLAGS='-stdlib=libc++'
export LDFLAGS='-rtlib=compiler-rt -lgcc_s'
export CC=clang
export CXX=clang++
export LD=ld.lld
source /opt/dependency-clang-x86_64-Linux/package/env.sh

2.3.编译 CHAWQ

#进行编译
cd /root/hawq
./configure --prefix=${HAWQINSTALLPATH} --with-orc --without-oushudb-extension \
  --with-includes=${DEPENDENCYPATH}/include \
  --with-libraries=${DEPENDENCYPATH}/lib:/usr/java/default/jre/lib/amd64/server
make

make install

2.4.将其他运行需要的三方库拷贝到目标文件夹

#进行拷贝
export HAWQINSTALLPATH=/usr/local/hawq
echo "Packaging oushudb built libraries"
cp -rf /opt/dependency/package/lib/* ${HAWQINSTALLPATH}/lib/
echo "Packaging prebuilt libc++"
cp -rf /opt/clang/lib/*c++*so* ${HAWQINSTALLPATH}/lib/
echo "Packaging prebuilt libraries"
cp -rf /opt/dependency-clang-x86_64-Linux/package/lib/* ${HAWQINSTALLPATH}/lib/
echo "Packaging prebuilt LLDB"
cp -f /opt/dependency-clang-x86_64-Linux/package/bin/lldb ${HAWQINSTALLPATH}/bin/
cp -f /opt/dependency-clang-x86_64-Linux/package/bin/lldb-server ${HAWQINSTALLPATH}/bin/
echo "Packaging prebuilt ORC tools"
cp -f /opt/dependency-clang-x86_64-Linux/package/bin/orc-* ${HAWQINSTALLPATH}/bin/
echo "Packaging prebuilt PYTHON2.7"
cp -f /opt/dependency-clang-x86_64-Linux/package/bin/python ${HAWQINSTALLPATH}/bin/

3.测试

3.1.测试 lib 的完整性

#有返回结果说明完整
nm /usr/local/hawq/lib/libdbcommon.so| grep __muloti4

3.2.初始化进行测试

cd /usr/local/
tar -czvf chawq.tar.gz hawq
cp chawq.tar.gz /root/hawq/
#退出docker
exit
#进行安装初始化
tar -xzvf /data1/code/oushudb/chawq.tar.gz -C /usr/local/
#进行配置修改,初始化
#前提已部署好HDFS
su - gpadmin
source /usr/local/hawq/greenplum_path.sh
hawq init cluster -a
#进行TPCH和update/delete验证
评论(3)
  • 李士朝
    李士朝 回复
    亚平宁的眼泪 亚平宁的眼泪 2022-01-18 17:01:27

    整个编译过程对操作系统有什么要求呢?

    没有特殊的要求,4 核 8GB 内存,50GB 存储足够了,编译是在 docker 中进行的,基础环境配置都包含了,操作系统需要支持安装 docker

  • 亚平宁的眼泪
    亚平宁的眼泪 回复

    整个编译过程对操作系统有什么要求呢?

  • 偶数派
    偶数派 回复

    很赞啊

test