Build Tensorflow r1.0 c++ API - c++

I trying to build Tensorflow r1.0 for c++
I was able to compile the libtensorflow.so but not all the headers generated.
All the ops headers missing except from standard_ops.h and const_ops.h which include in them all the ops headers that missing.
Im using Ubuntu 16.04.

Code for most ops is generated during the build. When using bazel, you should fine the generated header files in: bazel-genfiles/tensorflow/cc/ops, e.g., bazel-genfiles/tensorflow/cc/ops/math_ops.h.
Hope that helps.

If you don't mind using CMake, you can use tensorflow_cc project. It builds and installs TF C++ API for you, along with convenient CMake targets you can link against.

Related

How can I add and compile mongoc source code in projects and using locally (CMakeList config)

I want to add mongoc source code to My project then compile, build and use it locally without installing libmongoc on the system(Ubuntu). I want My project source code to be portable without having to install any library dependencies like mongoc in the target development system and be a cross platform project.
How to configure the CMakeList file (or any other)?
Thanks for your help in advance!

AWS SDK C++: Compile with CPP_FLAGS

Is it possible to compile a program using the AWS SDK C++ with CPP_FLAGS instead of using cmake?
In my case, I only want to add the aws-cpp-sdk-s3 libraries to my program.
It is difficult to build the SDK without CMake, but once it is built you can use whatever build system you would like to use. All you need is the path to the header files, the libraries, and the cflags that were used to build the library.

Is there way to package Tensorflow for c++ api?

I've been developing c++ project using a Tensorflow c++ api. it just execute created tensorflow's graph from Python. I build it using bazel with Tensorflow code now. But I think it's inefficient way.
I want just Tensorflow library and header files, and Just compile my project only using Cmake.
I know how to build shared library.
bazel build -c opt --config=cuda //tensorflow:libtensorflow.so but this command just make a libtensorflow.so file. I can't find header files for build my project.
Is there way to package tensorflow library for c++? such as mvn package command.
As far as I know, there is no official distributable C++ API package. There is, however, tensorflow_cc project that builds and installs TF C++ API for you, along with convenient CMake targets you can link against. According to your description, that may be just what you need.
If your operating system is Debian or Ubuntu, you can download unofficial prebuilt packages with the Tensorflow C/C++ libraries. This distribution can be used for C/C++ inference with CPU, GPU support is not included:
https://github.com/kecsap/tensorflow_cpp_packaging/releases
There are instructions written how to freeze a checkpoint in Tensorflow (TFLearn) and load this model for inference with the C/C++ API:
https://github.com/kecsap/tensorflow_cpp_packaging/blob/master/README.md
Beware: I am the developer of this Github project.
As Floop already mentioned, his tensorflow_cc project is also a good alternative without packaging, especially if you want GPU support for the inference.
You can build tensorflow with CMake. This also creates a TensorflowConfig.cmake, which you can integrate in your project
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake
Little hint: You have to build the shared lib, even if you do not need it.
You have two option: static linking and dynamic linking.
If you want to dynamic link your c++ project to TensorFlow, all you need is a --whole-archive linker flag. The necessary header files are provided by a pip install.
Generating the library is basically
bazel build -c opt --copt=-mfpmath=both --config=cuda //tensorflow:libtensorflow.so
bazel build -c opt --copt=-mfpmath=both --config=cuda //tensorflow:libtensorflow_cc.so
Having everything in place it is easy to run a TensorFlow graph in C, C++, Go (GitHub project). See the linked project for these working examples in C, C++, Go.
When building against the shared library, the headers I use are in $PROJECT_HOME/bazel-genfiles.
Adding $PROJECT_HOME/bazel-genfiles to the linker header list should be enough.

How do I use C libraries installed using Homebrew

I used Homebrew to install gphoto2 and libgphoto2 for use in a camera-control application using C++. I have confirmed that header files were linked in /usr/local/includes:
Screencap of includes folder on my system
Based on the sample code available at https://github.com/gphoto/libgphoto2/tree/master/examples, it seems like I should be able to use includes such as #include <gphoto2/gphoto2.h> to access the header files, but that approach has failed using both Clang and Xcode as the compiler. The files are not found. What am I doing wrong?

How do I compile libnoise on Mac OS X Mountain Lio

I am new to the Mac OS X environment when it comes to compiling linux based libraries. Whenever I used a library i just downloaded the .framework file, added it to my /Library/Frameworks and included it in my XCODE project, and all was fine.
Now I am stuck with libnoise. I want to use it on my project and I have no idea how to generate the .framework file/directory.
Can you help me please?
If you have libnoise, most likely it contains some sort of a Makefile or a configure script.
By running the
./configure
make all
you will get the library file (libnoise.a) for your platform, the OSX10.8.
Framework is essentially a folder with specific layout and a .plist file. To generate such a folder automatically, you may create an expty Xcode project of the type Framework and add the libnoise.a you've just created as a linker's input.
There is a detailed instruction on how to create the Framework from static libraries (.a files): http://www.blackdogfoundry.com/blog/creating-a-library-to-be-shared-between-ios-and-mac-os-x/
You might be missing the header files in you framework, but then can be also added to the Xcode project from libnoise sources.
This SO answer may be of use also: Difference between framework and static library in xcode4, and how to call them
Apple's documentation is also good: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html
I'm not entirely sure if this is what was meant by "with a different fork and cmake"
but I got libnoise to run in my mac using this git repo.
https://github.com/qknight/libnoise