Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel target to create C++ library headers #3536

Closed
hillegass opened this issue Jul 27, 2016 · 8 comments
Closed

Bazel target to create C++ library headers #3536

hillegass opened this issue Jul 27, 2016 · 8 comments
Labels
stat:awaiting response Status - Awaiting response from author

Comments

@hillegass
Copy link

Thanks to the //tensorflow:libtensorflow.so target, I can now build a shared library that I can use in my C++ programs. I want to install that library in /usr/local/lib and put the headers for it in /usr/local/include, but there is no target to build and install those headers. In particular, building the library doesn't build the headers from the proto files, so I have error_codes.proto, but not error_codes.pb.h, so I can't even use the source directory for the headers.

@michaelisard
Copy link

@martinwicke is this addressed in any planned build system changes?

@martinwicke
Copy link
Member

No

@keveman
Copy link
Contributor

keveman commented Jul 27, 2016

Is the target //tensorflow/core:framework_headers_lib not sufficient?

@michaelisard michaelisard added the stat:awaiting response Status - Awaiting response from author label Jul 27, 2016
@hillegass
Copy link
Author

The .proto files are not compiled to .pb.h files when I build the //tensorflow/core:framework_headers_lib target

$ **bazel build //tensorflow/core:framework_headers_lib**
..
WARNING: /private/var/tmp/_bazel_aaron/cd1b...c/external/protobuf/WORKSPACE:1: Workspace name in /private/var/tmp/_bazel_aaron/cd1b...c/external/protobuf/WORKSPACE (@__main__) does not match the name given in the repository's definition (@protobuf); this will cause a build error in future versions.
WARNING: /private/var/tmp/_bazel_aaron/cd1b...c/external/re2/WORKSPACE:1: Workspace name in /private/var/tmp/_bazel_aaron/cd1b...c/external/re2/WORKSPACE (@__main__) does not match the name given in the repository's definition (@re2); this will cause a build error in future versions.
WARNING: /private/var/tmp/_bazel_aaron/cd1b...c/external/highwayhash/WORKSPACE:1: Workspace name in /private/var/tmp/_bazel_aaron/cd1b...c/external/highwayhash/WORKSPACE (@__main__) does not match the name given in the repository's definition (@highwayhash); this will cause a build error in future versions.
INFO: Found 1 target...
Target //tensorflow/core:framework_headers_lib up-to-date (nothing to build)
INFO: Elapsed time: 5.460s, Critical Path: 0.01s

@michaelisard michaelisard removed the stat:awaiting response Status - Awaiting response from author label Jul 28, 2016
@keveman
Copy link
Contributor

keveman commented Jul 28, 2016

@hillegass Sorry, I misunderstood your requirement. //tensorflow/core:framework_headers_lib is meant for use within a BUILD file, when building with bazel. If you want to use libtensorflow.so in a different build system, and just want the header files, we package them up in the pip packages. For example, here is the python2 pip package. The header files go in <install path>/tensorflow/includem where <install path> is platform dependent. It usually is something like /usr/local/lib/python2.7/site-packages. Feel free to close the issue once you verify that it works for you.

@michaelisard michaelisard added the stat:awaiting response Status - Awaiting response from author label Jul 28, 2016
@hillegass
Copy link
Author

My fault. The headers were, indeed, in the python directory. (For other lost people, on a Mac the include directory is /Library/Python/2.7/site-packages/tensorflow/include/ . Thank you!

@hillegass
Copy link
Author

hillegass commented Jul 28, 2016

Quick follow up note for others: A couple of the important headers (especially those related to sessions) are not in that include directory, so you will need to copy them from the source tree:

$ cd tensorflow/tensorflow/core/public
$ sudo cp session.h session_options.h tensor_c_api.h /Library/Python/2.7/site-packages/tensorflow/include/tensorflow/core/public/

@ftokarev
Copy link

Heads-up: there is a dedicated //tensorflow:install_headers target now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author
Projects
None yet
Development

No branches or pull requests

5 participants