Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Bazel on CentOS 6.7 for Syntaxnet #1357

Closed
kskp opened this issue Jun 9, 2016 · 29 comments
Closed

Install Bazel on CentOS 6.7 for Syntaxnet #1357

kskp opened this issue Jun 9, 2016 · 29 comments

Comments

@kskp
Copy link

kskp commented Jun 9, 2016

Hi All,

I have tried lot of resources to install Bazel and Build Syntaxnet on my machine with the following configuration:
OS:
[sree@ds1 ~]$ cat /proc/version
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014

Python:
[sree@ds1 ~]$ python
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2

Java:
[sree@ds1 ~]$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

GCC:
[sree@ds1 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

[sree@ds1 ~]$ ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

Can someone please give me a step by step procedure on how to install and configure bazel on my system. I am not very well versed with Linux, so please consider my lack of knowledge and provide a detailed solution to my problem.

@meteorcloudy
Copy link
Member

Please refer to http://www.bazel.io/docs/install.html
You can try to install Bazel with installer or compile Bazel from source. :)

@kskp
Copy link
Author

kskp commented Jun 9, 2016

@meteorcloudy Thanks for the reply. I get the following errors when I run ./compile.sh:

[sree@ds1 bazel]$ ./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch
JAVA_HOME (/opt/jdk1.8.0_9) is not a path to a working JDK.

[sree@ds1 bazel]$ whereis java
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /opt/jdk1.8.0_91/bin/java

[sree@ds1 bazel]$ which java
/usr/bin/java

My PATH variable:
export PATH="/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:$PATH"

Can you help me why it is not able to find the correct path to working JAVA? I even tried creating a link with the instruction: sudo ln -s /opt/jdk1.8.0_91/bin /opt/jdk1.8.0_9

@meteorcloudy
Copy link
Member

Please set JAVA_HOME=/opt/jdk1.8.0_91 instead of /opt/jdk1.8.0_9

@kskp
Copy link
Author

kskp commented Jun 9, 2016

Oops, that was a typo. I have the following error now:

ERROR: /home/sree/bazel/src/main/cpp/util/BUILD:4:1: C++ compilation of rule '//src/main/cpp/util:util' failed: gcc failed: error executing command
(cd /tmp/bazel.0iZWhHCy/out/bazel &&
exec env -
PATH=JAVA_HOME/bin:/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sree/bin
/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.o' -fPIC -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/util/file.cc -o bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/file.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.

@meteorcloudy
Copy link
Member

Is there any more specific error message? I don't know why this command failed, looks good to me.

@kskp
Copy link
Author

kskp commented Jun 9, 2016

This is the entire log:

[sree@ds1 bazel]$ ./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
🍃  Building Bazel from scratch......
🍃  Building Bazel with Bazel.
.WARNING: /tmp/bazel.0iZWhHCy/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel.0iZWhHCy/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
WARNING: /home/sree/bazel/src/main/native/BUILD:52:16: in includes attribute of cc_binary rule //src/main/native:libunix.so: '.' resolves to 'src/main/native' not in 'third_party'. This will be an error in the future.
WARNING: /home/sree/bazel/src/main/protobuf/BUILD:36:1: in includes attribute of cc_library rule //src/main/protobuf:command_server_cc_proto: '.' resolves to 'src/main/protobuf' not in 'third_party'. This will be an error in the future. Since this rule was created by the macro 'cc_grpc_library', the error might have been caused by the macro implementation in /home/sree/bazel/tools/build_rules/genproto.bzl:104:18.
INFO: Found 1 target...
ERROR: /home/sree/bazel/src/main/cpp/util/BUILD:4:1: C++ compilation of rule '//src/main/cpp/util:util' failed: gcc failed: error executing command
  (cd /tmp/bazel.0iZWhHCy/out/bazel && \
  exec env - \
    PATH=JAVA_HOME/bin:/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sree/bin \
  /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/file.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/file.pic.o' -fPIC -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/util/file.cc -o bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/file.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
src/main/cpp/util/file.cc: In function 'std::string blaze_util::Which(const std::string&)':
src/main/cpp/util/file.cc:84: error: expected initializer before ':' token
src/main/cpp/util/file.cc:100: error: expected primary-expression at end of input
src/main/cpp/util/file.cc:100: error: expected ';' at end of input
src/main/cpp/util/file.cc:100: error: expected primary-expression at end of input
src/main/cpp/util/file.cc:100: error: expected ')' at end of input
src/main/cpp/util/file.cc:100: error: expected statement at end of input
src/main/cpp/util/file.cc:100: error: expected '}' at end of input
src/main/cpp/util/file.cc:100: warning: no return statement in function returning non-void
src/main/cpp/util/file.cc: At global scope:
src/main/cpp/util/file.cc:100: error: expected '}' at end of input
cc1plus: warning: unrecognized command line option "-Wno-free-nonheap-object"
Target //src:bazel failed to build
INFO: Elapsed time: 3.569s, Critical Path: 0.38s

Building output/bazel

Not even sure why it is showing syntax errors in src/main/cpp/util/file.cc.
Just for your info: I am trying to install bazel 0.2.2b. Not the latest version.

@meteorcloudy
Copy link
Member

Can you try to execute these command manually? And see what happens.

cd /tmp/bazel.0iZWhHCy/out/bazel
/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.o' -fPIC -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/util/file.cc -o bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/file.pic.o

@kskp
Copy link
Author

kskp commented Jun 9, 2016

Sorry for the delay. Here is the output:

src/main/cpp/util/file.cc: In function ‘std::string blaze_util::Which(const std::string&)’:
src/main/cpp/util/file.cc:84: error: expected initializer before ‘:’ token
src/main/cpp/util/file.cc:100: error: expected primary-expression at end of input
src/main/cpp/util/file.cc:100: error: expected ‘;’ at end of input
src/main/cpp/util/file.cc:100: error: expected primary-expression at end of input
src/main/cpp/util/file.cc:100: error: expected ‘)’ at end of input
src/main/cpp/util/file.cc:100: error: expected statement at end of input
src/main/cpp/util/file.cc:100: error: expected ‘}’ at end of input
src/main/cpp/util/file.cc:100: warning: no return statement in function returning non-void
src/main/cpp/util/file.cc: At global scope:
src/main/cpp/util/file.cc:100: error: expected ‘}’ at end of input
src/main/cpp/util/file.cc:100: fatal error: opening dependency file bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.d: No such file or directory
compilation terminated.

@kchodorow
Copy link
Contributor

What version of gcc are you using? It looks like it doesn't recognize for-each loops.

@meteorcloudy
Copy link
Member

I still have no idea why there is syntax error.
But this error

fatal error: opening dependency file 
bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/file.pic.d: No such file or directory
compilation terminated.

is probably caused by my commit 828a9e2, and I tried to fix it at cc993c2. Looks like something is still missing. I'll fix it tomorrow!

@kskp
Copy link
Author

kskp commented Jun 10, 2016

@kchodorow Hi, my GCC version is 4.8.4. I originally had 4.4.7 but I tried upgrading it to 4.8 uisng a tutorial given in: http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos.

FYI:
[sree@ds1 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

[sree@ds1 ~]$ ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

@meteorcloudy, @kchodorow is this upgrade causing any trouble? I know upgrading gcc is a dangerous thing to do, but since the answer was upvoted by so many people, I did it.

@kchodorow
Copy link
Contributor

No, that gcc should be recent enough to support auto! Just to make sure, can you try running /usr/bin/gcc -v (in case the gcc on your path is the old one?).

@kskp
Copy link
Author

kskp commented Jun 10, 2016

Looks like you are right. This does shows the old version:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

How and where do I change the path?

@kchodorow
Copy link
Contributor

Theoretically you can just replace it with the one you want: http://askubuntu.com/questions/269257/how-to-activate-gcc-4-7-version. (But rm-ing gcc always makes me nervous, so if I were you, I'd just move it to /usr/bin/gcc.bak or something.)

@kskp
Copy link
Author

kskp commented Jun 10, 2016

@kchodorow I created a link sudo ln -s /opt/centos/devtoolset-1.1/root/usr/bin/ /usr/bin/gcc to point it to the newer gcc. Now when I run ./compile.sh, i get the following:

ERROR: /home/sree/bazel/src/main/cpp/util/BUILD:4:1: C++ compilation of rule '//src/main/cpp/util:util' failed: gcc failed: error executing command
(cd /tmp/bazel.KJ4HjgOD/out/bazel &&
exec env -
PATH=/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:/opt/rh/devtoolset-2/root/usr/bin:/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sree/bin
/opt/centos/devtoolset-2/root/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/opt/centos/devtoolset-2/root/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/numbers.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/cpp/util/objs/util/src/main/cpp/util/numbers.pic.o' -fPIC -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/util/numbers.cc -o bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/util/src/main/cpp/util/numbers.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127.
/tmp/bazel.KJ4HjgOD/out/bazel/_bin/process-wrapper: line 12: /opt/centos/devtoolset-2/root/usr/bin/gcc: No such file or directory
Target //src:bazel failed to build
INFO: Elapsed time: 3.389s, Critical Path: 0.30s

@kchodorow
Copy link
Contributor

You can't use a symlink, just copy the file. Bazel creates a sandbox for each build action, so /usr/bin/gcc is in the sandbox but /opt/centos/devtoolset-2/root/usr/bin/gcc isn't. So the symlink points to a non-existent location during the build.

@kskp
Copy link
Author

kskp commented Jun 10, 2016

Sorry for my ignorance, but could you be more clear? DO you want me to move the /opt/centos/devtoolset-2/root/usr/bin/gcc to /usr/bin/?? and move usr/bin/gcc to somewhere else??

@kchodorow
Copy link
Contributor

Yeah, do something like:

sudo mv /usr/bin/gcc /usr/bin/gcc.bak
sudo cp /opt/centos/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc

@kskp
Copy link
Author

kskp commented Jun 11, 2016

Thanks. Now for some reason, my gcc version has changed to 4.7.2. Will that still work or do I have to upgrade again?

And ./compile.sh gives:
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch......
🍃 Building Bazel with Bazel.
INFO: Found 1 target...
ERROR: /home/sree/bazel/src/main/cpp/util/BUILD:31:1: C++ compilation of rule '//src/main/cpp/util:strings' failed: gcc failed: error executing command
(cd /tmp/bazel.a3NiEjYF/out/bazel &&
exec env -
PATH=/home/sree/anaconda2/bin:/home/sree/bazel:/opt/jdk1.8.0_91/bin:/opt/jdk1.8.0_91/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sree/bin
/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/strings/src/main/cpp/util/strings.pic.o' -MD -MF bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/strings/src/main/cpp/util/strings.pic.d -fPIC -c src/main/cpp/util/strings.cc -o bazel-out/local-fastbuild/bin/src/main/cpp/util/_objs/strings/src/main/cpp/util/strings.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
Target //src:bazel failed to build
INFO: Elapsed time: 3.364s, Critical Path: 0.28s

@kskp kskp closed this as completed Jun 13, 2016
@kchodorow
Copy link
Contributor

Did you intend to close this?

@kskp
Copy link
Author

kskp commented Jun 13, 2016

@kchodorow Yes, I figured it out myself. I have bazel running now. Thanks for the support. Really appreciate.

@kchodorow
Copy link
Contributor

Great, glad it worked out!

@jk1510karti
Copy link

Hi @kchodorow, I am also getting same error in CentOS 6.7 with gcc 4.4.7, Could you please update me how did you fix the issue. ?

I have 4.4.7 alone,

@DanlanChen
Copy link

@kskp how did you solve this problem in the end?

@damienmg
Copy link
Contributor

damienmg commented Oct 24, 2016

FTR, we maintain a sucessful build of Bazel on CentOS using a newer gcc, here:
https://github.com/bazelbuild/bazel/blob/master/tools/cpp/test/Dockerfile.centos6.7

With that docker file you should be able to build bazel (test command is there: https://github.com/bazelbuild/bazel/blob/master/tools/cpp/test/BUILD#L53)

So taking the current docker file, install steps for CentOS should look like:

# 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

@damienmg
Copy link
Contributor

FWIW, I added a wiki page for it: https://github.com/bazelbuild/bazel/wiki/Installing-Bazel-on-CentOS-6.7

@kodeprav
Copy link

kodeprav commented Dec 1, 2016

Seeing below error during bazel compilation.
ERROR: Must specify PROTOC if not bootstrapping from the distribution artifact;

@wangyum
Copy link

wangyum commented Dec 16, 2016

@kodeprav please download dist.

@truatpasteurdotfr
Copy link

https://gist.github.com/truatpasteurdotfr/d541cd279b9f7bf38ce967aa3743dfcb for an updated version, and the corresponding Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants