Google Tensorflow 源碼編譯(一):Protobuf


這幾天終於把tensorflow安裝上了,中間遇到過不少的問題,這里記錄下來。供大家想源碼安裝的參考。

安裝環境:POWER8處理器,Docker容器Ubuntu14.04鏡像。

Build Protobuf<v3.0.0-alpha-3> for IBM POWER8 CPU from Source Code

My computer's os is ubuntu 14.04 , and I want to install protobuf v3.0.0-alpha-3, but there is no deb package in the repository, so I need to build from source code.
Here are the steps that I succeed to install protobuf<v3.0.0-alpha-3> on my computer:

1. Get source code
1.1 Get protobuf code
  git clone https://github.com/google/protobuf
  git checkout v3.0.0-alpha-3
1.2 Get gtest code
  The latest protobuf version uses gmock, but v3.0.0-alpha-3 uses gtest. Anyway ,the following code always works!
  git clone https://github.com/franramirez688/gmock(../ is the root path of protobuf)
  cp ./gmock/gtest ../


2. Modify the code to support POWER cpu
2.1 Add g++ MACRO
  in protobuf/src/google/protobuf/stubs/platform_macros.h:
  change #elif defined(_POWER) to #elif defined(_POWER) || defined(__powerpc64__) || defined(__PPC64__).

2.2 Include power cpu header file
  in protobuf/src/google/protobuf/stubs/atomicops.h, add:
  if defined(GOOGLE_PROTOBUF_ARCH_POWER)
  #include <google/protobuf/stubs/atomicops_internals_power.h>
  endif
2.3 Add power cpu header file
  add atomicops_internals_power.h to google/protobuf/stubs folder:
  you can copy it from the latest version < v3.0.0-beta-1>

3. Compile source code
  $ ./autogen.sh
  $ ./configure
  $ make
  $ make install

4. the binary file <protoc> is saved at protobuf/src/protoc.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM