这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来。供大家想源码安装的参考。

安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像。

Build Bazel<v0.1.0> for IBM POWER8 CPU from Source Code

My computer's os is ubuntu 14.04 , and I want to install bazel, There is only java7 available, so I choose bazel 0.1.0.
Here are the steps that I succeed to install bazel 0.1.0 on my computer:

1. Get source code
  git clone https://github.com/bazelbuild/bazel.git
  git checkout 0.1.0

2. Install protobuf
  Check which version is needed:

  opuser@nova:~/tensorflow/bazel-0.1.0$ ls third_party/protobuf/
  LICENSE protobuf-java-3.0.0-alpha-3.jar protoc-linux-x86_64.exe protoc-osx-x86_32.exe protoc-windows-x86_32.exe
  README.md protoc-linux-x86_32.exe protoc-linux-x86_64.real protoc-osx-x86_64.exe protoc-windows-x86_64.exe

  protobuf-java-3.0.0-alpha-3.jar is the jar file bazel uses. so we need to install protobuf with version <3.0.0-alpha-3> , you can refer to "Build Protobuf<v3.0.0-alpha-3> for IBM POWER8 CPU from Source Code" to build protobuf .

3. Create a link protoc-linux-x86_64.exe to protoc binary file
  such as : ln -s /usr/bin/protoc $(pwd)/ third_party/protobuf/protoc-linux-x86_64.exe

4. Install other dependencies
4.1 sudo apt-get install zlib1g-dev zip unzip openjdk-7-jre openjdk-7-jdk
4.2 add java path to ~/.bashrc
  export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-ppc64el
  export JRE_HOME=${JAVA_HOME}/jre
  export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
  export PATH=${JAVA_HOME}/bin:$PATH

5. Modify bazel source code to support POWER cpu
5.1 in src/main/java/com/google/devtools/build/lib/util/CPU.java
  in enum "public enum CPU" add
  POWER("power", ImmutableSet.of("power", "power64le", "power64be", "ppc")),

5.2 in /src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
  in function "public static class HostCpuConverter implements Converter<String>"add:
  case POWER:
  return "power";
5.3 in tools/cpp/CROSSTOOL, add
  default_toolchain {
  cpu: "power"
  toolchain_identifier: "local_linux"
  }
5.4 in third_party/BUILD, add
  config_setting(
  name = "power",
  values = {"host_cpu": "power"},
  )
5.5 in scripts/bootstrap/buildenv.sh, add
  MACHINE_IS_64BIT='yes'

6. Compile bazel
  ./compile // better to see step 7 before run ./compile
  after a long time, a message displayed:
  Build successful! Binary is here: /home/opuser/tensorflow/tools/bazel-0.1.0/output/bazel

7. Problems during compiling
  It is not easy to build bazel from source code. not to mention that I build it in a docker container. there are mainly two problems.

7.1 namespace-sandbox
  <error: mount() permission denied!>
  bazel may choose to build a sanbox which uses namespace . but there are priority strictions in container. to avoid this problem, you can choose not to build sandbox .
  I refer to dcreager's solution posted at https://github.com/bazelbuild/bazel/issues/418. create a bazelrc and use command "BAZELRC=/tmp/bazelrc ./compile.sh" to compile the code. the bazelrc file  contains:  
  startup --batch
  build --spawn_strategy=standalone --genrule_strategy=standalone

7.2 openjdk-7

  <error: unrecognized option -client!>

  The java installed on my computer does not support -client option, but -server option is ok. just as the issue  opened at

  https://github.com/bazelbuild/bazel/issues/56

   Although there is a commit about this:

  https://github.com/bazelbuild/bazel/commit/1fa163c42ee26a72c21c118ec820d677a431ee49#commitcomment-13207150.

  But it does not work to me. so I changed all the -client option to -server.

8. Reference

Can't run Bazel as part of a Docker build due to sandboxing issues
https://github.com/bazelbuild/bazel/issues/418
Compiling the Java example with SAP JVM does not work
https://github.com/bazelbuild/bazel/issues/56
Add jvm_opts attribute to the java_toolchain rule
https://github.com/bazelbuild/bazel/commit/1fa163c42ee26a72c21c118ec820d677a431ee49#commitcomment-13207150.

  

Google Tensorflow 源码编译(二):Bazel<v0.1.0>的更多相关文章

  1. Google Tensorflow 源码编译(三):tensorflow<v0.5.0>

    这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来.供大家想源码安装的参考. 安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像. Build Tens ...

  2. Google Tensorflow 源码编译(一):Protobuf<v3.0.0-alpha-3>

    这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来.供大家想源码安装的参考. 安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像. Build Prot ...

  3. tensorflow 源码编译tensorflow 1.1.0到 tensorflow 2.0,ver:1.1.0rc1、1.4.0rc1、1.14.0-rc1、2.0.0b1

    目录 tensorflow-build table 更多详细过程信息及下载: tensorflow-build tensorflow 源码编译,提升硬件加速,支持cpu加速指令,suport SSE4 ...

  4. Tensorflow[源码安装时bazel行为解析]

    0. 引言 通过源码方式安装,并进行一定程度的解读,有助于理解tensorflow源码,本文主要基于tensorflow v1.8源码,并借鉴于如何阅读TensorFlow源码. 首先,自然是需要去b ...

  5. Tensorflow源码编译常见问题点总结

    Tensorflow源码编译分两种:一种是本地源码编译,另一种是针对ARM平台的源码编译. 接下来分别介绍: 一.本地编译 本地编译时,使用的编译工具是本地GCC. 一般会碰到以下问题: 第1个:ex ...

  6. jmeter4.0 源码编译 二次开发

    准备: 1.jmeter4.0源码 - apache-jmeter-4.0_src.zip 2.IDE Eclipse - Oxygen.3 Release (4.7.3) 3.JDK - 1.8.0 ...

  7. TensorFlow 源码编译安装

    ## Install prerequisites (rhel) yum install numpy python-devel python-wheel python-mock ## Install B ...

  8. Ubuntu 16.04源码编译安装nginx 1.10.0

    一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...

  9. Centos7下源码编译安装与配置redis5.0

    1.下载redis5.0源码包 wget http://download.redis.io/releases/redis-5.0.5.tar.gz 2.检查是否安装过之前的历史版本 rpm -qa|g ...

随机推荐

  1. (zhuan)Python 虚拟环境:Virtualenv

    Python 虚拟环境:Virtualenv zhuanzi: http://liuzhijun.iteye.com/blog/1872241 virtualenv virtualenv用于创建独立的 ...

  2. SharePoint 2013配置 Workflow Manager

    折腾了好几天,用Windows Server 2012 R2安装 SharePoint Server 2013都没装上去.最后发现必须安装带SP1的SharePoint 2013,不然那一步IIS永远 ...

  3. IOS-当遇到tableView整体上移时的解决方案

    方案一在使用了navigationController后,当界面进行跳转往返后,时而会出现tableView或collectionView上移的情况,通常会自动上移64个像素,那么这种情况,我们可以关 ...

  4. javscript创建Emitter

    本文简单叙述下javascript是如何建立一个Emitter构造函数的. /** * 定义Emitter构造函数 */ function Emitter() { } /** * 添加监听事件 */ ...

  5. 105 董婷婷 第二次Sprint总结

    总结: 第二次冲刺结束了,这次冲刺的主要任务是建立数据库.项目进行到现在也基本定型了,满满的成就感啊.经过一段时间的合作,团队成员间的默契大大提高,还有最后一次冲刺,队友们,加油哦!

  6. C(++) Websocket实现扫码二维码登录---GoEasy

    最近在做一个扫码登录功能,为此我还在网上搜了一下关于微信的扫描登录的实现方式.当这个功能完成了后,我决定将整个实现思路整理出来,方便自己以后查看也方便其他有类似需求的程序猿些. 要实现扫码登录我们需要 ...

  7. Android.os.NetworkOnMainThreadException

    出现Android.os.NetworkOnMainThreadException错误提示的原因原因:不允许在主线程中进行网络访问解决办法:将网络访问的操作单独放到一个线程中

  8. final关键字

    1.final类不能被继承,因此final类的成员方法没有机会被覆盖,默认都是final的.在设计类时候,如果这个类不需要有子类,类的实现细节不允许改变,并且确信这个类不会再 被扩展,那么就设计为fi ...

  9. Spark RDD API详解(一) Map和Reduce

    RDD是什么? RDD是Spark中的抽象数据结构类型,任何数据在Spark中都被表示为RDD.从编程的角度来看,RDD可以简单看成是一个数组.和普通数组的区别是,RDD中的数据是分区存储的,这样不同 ...

  10. 使用bat脚本添加JAVA_HOME和修改PATH

    add_jre.bat ::添加环境变量JAVA_HOME @echo off echo 添加java环境变量 set regpath=HKEY_LOCAL_MACHINE\SYSTEM\Curren ...