如何在CentOS 6.x上编译Bazel?

时间:2017-03-23 17:14:33

标签: centos bazel

截至今天,只有Ubuntu软件包可用。

Bazel可以在CentOS 6.x上编译吗?

1 个答案:

答案 0 :(得分:7)

Bazel经过测试,能够使用this docker file生成的泊坞窗图像在CentOS 6.7上进行编译。 CentOS 6.7附带的C ++编译器太旧了,无法编译Bazel,所以诀窍就是使用a newer one

# Install the dependencies of Bazel
yum install java-1.8.0-openjdk-devel wget which findutils binutils gcc tar gzip zip unzip java java-devel git clang zlib-devel gcc-c++
# Install a newer gcc
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils
# Set the path to java and gcc
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
# Clone the repository
git clone https://github.com/bazelbuild/bazel /tmp/bazel
# Compile bazel
cd /tmp/bazel; ./compile.sh
# Copy the bazel binary to some binary directory
cp /tmp/bazel/output/bazel ~/bin