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

tensorflow/core/framework/op_def.pb.h:10:40: fatal error: google/protobuf/port_def.inc: No such file or directory #27697

Closed
alsrgv opened this issue Apr 9, 2019 · 47 comments
Assignees
Labels
subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues type:bug Bug type:build/install Build and install issues

Comments

@alsrgv
Copy link
Contributor

alsrgv commented Apr 9, 2019

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): use plugin
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): tensorflow/tensorflow:latest-gpu-py3
  • TensorFlow version (use command below): 1.14.1-dev20190409
  • Python version: 3.5
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

You can collect some of this information using our environment capture script
You can also obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the current behavior
As of 1.14.1-dev20190409, custom plugins fail to build with the following error:

  In file included from /usr/local/lib/python2.7/dist-packages/tensorflow/include/tensorflow/core/framework/op_def_builder.h:24:0,
                   from /usr/local/lib/python2.7/dist-packages/tensorflow/include/tensorflow/core/framework/op.h:23,
                   from horovod/tensorflow/mpi_ops.cc:22:
  /usr/local/lib/python2.7/dist-packages/tensorflow/include/tensorflow/core/framework/op_def.pb.h:10:40: fatal error: google/protobuf/port_def.inc: No such file or directory
   #include <google/protobuf/port_def.inc>
                                          ^
  compilation terminated.

This seems to be related to 6168f47. It appears that not all the files are placed in the proper locations after the installation.

Describe the expected behavior
Plugins should build successfully.

Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.

$ docker run -it --rm tensorflow/tensorflow:latest-gpu-py3
# apt install -y mpich
# HOROVOD_WITH_TENSORFLOW=1 pip install -v horovod

Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

cc @martinwicke @gunan

@qlzh727
Copy link
Member

qlzh727 commented Apr 10, 2019

Assigning to @yifeif who reviewed cl/242492263, and also cc @gunan.

@angerson
Copy link
Contributor

angerson commented Apr 10, 2019

Un-assigning so this'll get into our GitHub triaging system (pinging @rthadur for this).

@angerson
Copy link
Contributor

Also: @meteorcloudy

@rthadur rthadur self-assigned this Apr 10, 2019
@rthadur rthadur added type:build/install Build and install issues subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues type:bug Bug labels Apr 10, 2019
@meteorcloudy
Copy link
Member

@seanpmorgan @gunan Is tf addons somehow using this BUILD file?

HEADERS = [
"google/protobuf/any.pb.h",
"google/protobuf/any.proto",
"google/protobuf/arena.h",
"google/protobuf/compiler/importer.h",
"google/protobuf/descriptor.h",
"google/protobuf/descriptor.pb.h",
"google/protobuf/descriptor.proto",
"google/protobuf/duration.pb.h",
"google/protobuf/duration.proto",
"google/protobuf/dynamic_message.h",

@acozzette Dose it make sense to you to add google/protobuf/port_def.inc here?

@seanpmorgan
Copy link
Member

We don't use the BUILD file itself. We link to the pre-compiled libtensorflow_framework.

It looks like the op_def.pb header file is referencinng a file which is not where it is expected after the new protobuf install.

tensorflow/core/framework/op_def.pb.h:10:40: fatal error: google/protobuf/port_def.inc: No such file or directory
 #include <google/protobuf/port_def.inc>

@alsrgv
Copy link
Contributor Author

alsrgv commented Apr 10, 2019

Same here, we're not using Bazel.

@meteorcloudy
Copy link
Member

Looks like the problem is when creating the pip package, we missed to copy header files that has .inc extension.

for header in $(find protobuf_archive -name \*.h); do
mkdir -p "${TMPDIR}/google/$(dirname ${header})"
cp "$header" "${TMPDIR}/google/$(dirname ${header})/"

I'll send a fix for this.

@tensorflow-bot
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@seanpmorgan
Copy link
Member

seanpmorgan commented Apr 12, 2019

Still seeing this issue in the 20190412 nightly. Was this merged in for that nightly? If so I'm not sure the correct fix is in place.

https://files.pythonhosted.org/packages/d4/c9/0fb753c0d182cfa10294edaa610d19f236da0396c636c24dccaa669bc81d/tf_nightly_2.0_preview-2.0.0.dev20190412-cp34-cp34m-manylinux1_x86_64.whl (86.5MB)

bazel-out/k8-opt/genfiles/external/local_config_tf/include/tensorflow/core/framework/types.pb.h:10:40: fatal error: google/protobuf/port_def.inc: No such file or directory

https://source.cloud.google.com/results/invocations/fb7847e9-3cd6-4b07-9394-efe9f948f42e/targets/tensorflow_addons%2Fubuntu%2Fgpu%2Fpy3%2Fcontinuous/log

@alsrgv
Copy link
Contributor Author

alsrgv commented Apr 13, 2019

+1, it's still broken in the current tf-nightly.

@meteorcloudy
Copy link
Member

Turned out we also need to fix steup.py:

list(find_files('*.h', 'google/protobuf_archive/src')) + list(

@meteorcloudy
Copy link
Member

I verified on my local machine, fixing this file works. Sending a fix from internal.

@meteorcloudy
Copy link
Member

Can anyone verify find protobuf_archive -name "*.h" -o -name "*.inc" works for their platform?

@alsrgv
Copy link
Contributor Author

alsrgv commented Apr 26, 2019

It worked on my Mac, Ubuntu 18.04 and your devel container, so seems promising :-)

@meteorcloudy
Copy link
Member

@alsrgv Thanks! Hopefully this time it will work

pull bot pushed a commit to testkevinbonz/tensorflow that referenced this issue Apr 26, 2019
Removing -type flag because it is unnecessary and on some platform it doesn't accepted multiple types, which caused:
find: Arguments to -type should contain only one letter

Fourth try to fix tensorflow#27697#issuecomment-486956391

PiperOrigin-RevId: 245433173
@alsrgv
Copy link
Contributor Author

alsrgv commented Apr 28, 2019

@meteorcloudy, I can confirm that both Mac and Linux nightly builds are operational. Could you pick this fix to the 1.4 branch?

@meteorcloudy
Copy link
Member

@gunan @yifeif Can you help pick this fix to 1.4 branch?

@martinwicke
Copy link
Member

@bananabowl can you cherry-pick this fix?

@bananabowl
Copy link
Contributor

Sure - this is part of #28296

@andreyhristov
Copy link

Hi,
I experience this problem with 1.14.0 . From what I see in the sources, as well as bananabowl's comment / reference to the cherry picks, the needed changes are in 1.14.0. Still getting the problem.
Here is the error:

In file included from ./deps/tensorflow-headers-1.14.0/tensorflow/core/framework/tensor_shape.h:22:0,
                 from ./deps/tensorflow-headers-1.14.0/tensorflow/core/framework/tensor.h:23,
                 from ./deps/tensorflow-headers-1.14.0/tensorflow/cc/framework/ops.h:21,
                 from ./deps/tensorflow-headers-1.14.0/tensorflow/cc/client/client_session.h:24,
                 from ./include/detect_tensorflow.hpp:5,
                 from src/detect_tensorflow.cpp:1:
./deps/tensorflow-headers-1.14.0/tensorflow/core/framework/types.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory
 #include <google/protobuf/port_def.inc>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am using the headers generated by //tensorflow:install_headers .
Platform : AARCH64
OS : Ubuntu 18.04 LTS
Hardware: Nvidia Xavier AGX
Software: TensorFlow 1.14.0 from a source release. Compiled with Bazel 0.24.1 (from a dist package).

@bananabowl
Copy link
Contributor

bananabowl commented Jun 24, 2019 via email

@mihaimaruseac
Copy link
Collaborator

Hi, the fd5d844 change is for virtual pip, should be on master only, not on a release branch.

There's also some changes related with moving protobuf definitions around, but again, that should only be on master.

@mihaimaruseac
Copy link
Collaborator

So, the commits that I know can affect this are fd5d844, 338c2f2 and 508f76b

Could try patching each one of these manually and see which works

@andreyhristov
Copy link

I tried the master branch. Interestingly it seems to be 1.13.1 (because the generated PIP file is tensorflow-1.13.1-cp36-cp36m-linux_aarch64.whl). The problem persist but it could be that master is not the right branch (is not actively used). Is it?

@meteorcloudy
Copy link
Member

@andreyhristov The master branch is the develop branch.
I tried to build //tensorflow:include_headers on the latest master branch, it does contain the port_def.inc

$ bazel build --config=opt //tensorflow:install_headers
...
Target //tensorflow:install_headers up-to-date:
  bazel-genfiles/tensorflow/include
INFO: Elapsed time: 0.239s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
$ ls ./bazel-genfiles/tensorflow/include/external/com_google_protobuf/src/google/protobuf/port_def.inc
./bazel-genfiles/tensorflow/include/external/com_google_protobuf/src/google/protobuf/port_def.inc

@meteorcloudy
Copy link
Member

And in 1.14 branch, the ".inc" file headers also exist but under external/protobuf_archive directory.

ls ./bazel-genfiles/tensorflow/include/external/protobuf_archive/src/google/protobuf/port_def.inc
./bazel-genfiles/tensorflow/include/external/protobuf_archive/src/google/protobuf/port_def.inc

@andreyhristov
Copy link

andreyhristov commented Jun 25, 2019

ok guys, right, I found the file. The problem was that I needed to add the path to protobuf_archive to the include path of the compiler. I compiles now and it works! (I had asserts with 1.12.0 on batch inference which are gone).

Last question, why does master seem to be with version 1.13.1 ? Do you guys change the version after branching for release?

@meteorcloudy
Copy link
Member

Yes, it's embedded here:

@gunan Is this intentionally?

@tensorflow-bot
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@mihaimaruseac
Copy link
Collaborator

Fixed the version number in 4a017ec

@andreyhristov
Copy link

Hi,
what I did for my program was to pass a -I param to the compiler, so it does know where to look for the files.
I use a Makefile, and also export a TENSORFLOW_PATH variable, which contains the path to the headers. The headers can be extracted with a bazel target. For me the flag to gcc is :
-I$(TENSORFLOW_PATH)/external/protobuf_archive/src

@suyashbakshi
Copy link

suyashbakshi commented Aug 1, 2019

Hello, I'm still seeing this issue with tf1.14.0 while compiling a custom op kernel.
site-packages/tensorflow/include/tensorflow/core/framework/op_def.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory #include <google/protobuf/port_def.inc> compilation terminated.

I'm on windows, installed TF using pip.
The .inc files still reside in "site-packages\tensorflow\include\google\protobuf_archive\src\google\protobuf".

Is there a way to fix this issue without building the sources manually (by using bazel)?

Any help is appreciated. Thanks!

@megazone87
Copy link

Hello, I'm still seeing this issue with tf1.14.0 while compiling a custom op kernel.
site-packages/tensorflow/include/tensorflow/core/framework/op_def.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory #include <google/protobuf/port_def.inc> compilation terminated.

I'm on windows, installed TF using pip.
The .inc files still reside in "site-packages\tensorflow\include\google\protobuf_archive\src\google\protobuf".

Is there a way to fix this issue without building the sources manually (by using bazel)?

Any help is appreciated. Thanks!

try include the dir solve this issue? like: -I..\site-packages\tensorflow\include\google\protobuf_archive\src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues type:bug Bug type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests