steps to compile Bazel under Redhat Linux Enterprise 5

1,382 views
Skip to first unread message

Jack47

unread,
May 8, 2015, 11:12:41 AM5/8/15
to bazel-...@googlegroups.com, Jack47
With the help of Google Bazel team, I successfully compiled Bazel under Redhat Linux Enterprise 5.7. The steps needed is as described as below:
PS: Chinese version is there.

Bazel needs JDK 1.8 and  gcc compiler that support c++0x.
1. download Bazel code:
git clone https://github.com/google/bazel/

2. install libarchive:
wget http://libarchive.org/downloads/libarchive-3.1.2.tar.gz 
gunzip libarchive-3.1.2.tar.gz
tar libarchive-3.1.2.tar
./configure
make
sudo make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

3. install jdk 1.8
 sudo rpm -ivh jdk-8u45-linux-x64.rpm
export JAVA_HOME=/usr/java/jdk1.8.0_45/

4. install gcc 4.8 
sudo wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
scl enable devtoolset-2 bash

5. stub out sandbox compile
because linux kernel is too old to support namespace, so stub out sandbox support:
#if [[ $PLATFORM == "linux" ]]; then
# log "Compiling sandbox..."
# "${CC}" -o output/namespace-sandbox -std=c99 src/ main/tools/namespace-sandbox.c
#fi

Then Build successful! Have fun with Bazel



mjp...@gmail.com

unread,
Jan 13, 2016, 2:25:15 PM1/13/16
to bazel-discuss, csd...@126.com
Hi,

Thanks for this. Can you elaborate on Step 5? What file is that code in that has to be stubbed out? I can't find it within the bazel source (even with a grep -r).

Thanks,
Matt Post

Damien Martin-guillerez

unread,
Jan 13, 2016, 3:17:45 PM1/13/16
to mjp...@gmail.com, bazel-discuss, csd...@126.com
This is in scripts/bootstrap/compile.sh

FYI, I have some changes that I am currently integrating to remove that part and all C++ compilation from this script so it's easier to compile on various platform (only java compilation would happens outside bazel).

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/4a1fbc8a-c244-41ee-a902-ef4b81b72ad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mjp...@gmail.com

unread,
Jan 13, 2016, 4:15:48 PM1/13/16
to bazel-discuss, mjp...@gmail.com, csd...@126.com
On Wednesday, January 13, 2016 at 3:17:45 PM UTC-5, Damien Martin-guillerez wrote:
> This is in scripts/bootstrap/compile.sh
>
>
> FYI, I have some changes that I am currently integrating to remove that part and all C++ compilation from this script so it's easier to compile on various platform (only java compilation would happens outside bazel).

That would be great! I have been compiling from source to get this to work on CentOS 6.7 in order to compile Tensor Flow, with no luck so far. This worked to get bazel compiled, at least, though it still complains a bit.

Reply all
Reply to author
Forward
0 new messages