# build pip package
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
# build cc library
bazel build --config=opt --config=cuda //tensorflow:libtensorflow_cc.so
# build c library
bazel build --config=opt --config=cuda //tensorflow:libtensorflow.so
- build only ONE library
libtensorflow_cc.so
- stackoverflow
- DO NOT use
--config=monolithic
unless you don't need custom op
- DO Not install built pip package in source code folder, install it in
~
is OK [Not Sure reason]
- stackoverflow
- DO NOT use "using namespace std;"
- The binary pip packages available on the TensorFlow website are built with gcc4 that uses the older ABI. If you compile your op library with gcc>=5, add
-D_GLIBCXX_USE_CXX11_ABI=0
to the command line to make the library compatible with the older abi. tensorflow- compile simple custom op library
libzero_out.so
using gcc with pip package from tf website,-D_GLIBCXX_USE_CXX11_ABI=0
need to be set. - compile simple custom op library
libzero_out.so
using gcc with self-built pip package, DO NOT set D_GLIBCXX_USE_CXX11_ABI=0, and in this situation, c++ code can call the custom op library withTF_LoadLibrary
- compile simple custom op library