Skip to content

Commit b4e5bfc

Browse files
Improved
1 parent 77dc13e commit b4e5bfc

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

compile_tensorflow_cpp.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,46 @@ In this page I will walk you through the steps to install TensorFlow C++ API ver
66

77
## Dependencies
88

9-
- Conda environment
9+
- Conda
1010
- Python 3.9.0
11+
- GCC 5 or newer
1112
- Bazel 3.7.2
1213
- Protobuf 3.9.2 (must be compatible with the version of TensorFlow-built protobuf or protoc)
1314

15+
Check a list of supported Python version, compiler, and bazel at https://www.tensorflow.org/install/source#tested_build_configurations.
16+
1417
---
1518

1619
## Install package dependencies
1720

1821
### 1. Environment setup & install Python
19-
```
22+
```bash
2023
conda create -n tfcc
2124
conda activate tfcc
2225
conda install python==3.9
2326
conda update --all -y
2427
```
2528

2629
### 2. Install bazel
30+
31+
Add bazel repository:
32+
```bash
33+
sudo apt install apt-transport-https curl gnupg
34+
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
35+
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
36+
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
2737
```
38+
39+
Install:
40+
```bash
41+
sudo apt install bazel
42+
# or a specific version
2843
sudo apt install bazel-3.7.2
2944
```
3045

3146
### 3. Install Protobuf
3247

33-
I suggest installing protobuf after building TensorFlow so that we can check that which version of protobuf we have to use.
48+
I suggest installing protobuf after building TensorFlow so that we are able to check that which version of protobuf we should use.
3449

3550
---
3651

@@ -73,7 +88,7 @@ Note:
7388
7. Rebuild with `--config=monolithic` if you want compile all TF C++ code into a single shared object
7489

7590
**optional**
76-
```
91+
```bash
7792
bazel test --jobs=4 --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" -c opt \
7893
//tensorflow/tools/lib_package:libtensorflow_test
7994
```

0 commit comments

Comments
 (0)