mediapipe as dependency using bazel

Created on 19 Nov 2019  路  4Comments  路  Source: google/mediapipe

Hi,
I am building a C++ Application on Ubuntu which should use mediapipe.
How do I configure the mediapipe framework as a remote dependency in a bazel project?

desktop

Most helpful comment

The hello_world example works just fine.
I am trying to build the hand tracking with GPU support enabled but I cannot build the @mediapipe//mediapipe/graphs/hand_tracking:mobile_calculators. In my application I want to use this feature. I run into the following issue:

In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::{anonymous}::GetConfig(EGLDisplay, const EGLint, void)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:33:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:35:69: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglChooseConfig failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:37:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::{anonymous}::CreateContext(EGLDisplay, EGLContext, EGLConfig, tflite::gpu::gl::EglContext
)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:50:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^
~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:52:70: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglCreateContext failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:55:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In member function 'int tflite::gpu::gl::EglContext::MakeCurrent(EGLSurface, EGLSurface)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:98:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:100:68: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglMakeCurrent failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:102:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreateConfiglessContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:112:70: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_no_config_context not supported");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreateSurfacelessContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext
)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:120:67: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_create_context not supported");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:123:72: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_surfaceless_context not supported");
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:128:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetConfig(display, attributes, &config));
^
~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreatePBufferContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext*)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:146:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetConfig(display, attributes, &config));

I was trying to build it with several different tensorflow versions but no success.
Building the provided examples works just fine
Any idea how to fix this?

All 4 comments

@davidakr Pls check out the helloworld example in the mediapipe_addon repo of how to create C++ app with MediaPipe as remote dependency in bazel

The hello_world example works just fine.
I am trying to build the hand tracking with GPU support enabled but I cannot build the @mediapipe//mediapipe/graphs/hand_tracking:mobile_calculators. In my application I want to use this feature. I run into the following issue:

In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::{anonymous}::GetConfig(EGLDisplay, const EGLint, void)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:33:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:35:69: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglChooseConfig failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:37:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::{anonymous}::CreateContext(EGLDisplay, EGLContext, EGLConfig, tflite::gpu::gl::EglContext
)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:50:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^
~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:52:70: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglCreateContext failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:55:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In member function 'int tflite::gpu::gl::EglContext::MakeCurrent(EGLSurface, EGLSurface)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:98:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetOpenGlErrors());
^~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:100:68: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return InternalError("No EGL error, but eglMakeCurrent failed.");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:102:19: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return OkStatus();
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreateConfiglessContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:112:70: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_no_config_context not supported");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreateSurfacelessContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext
)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:120:67: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_create_context not supported");
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:123:72: error: cannot convert 'tflite::gpu::Status' to 'int' in return
return UnavailableError("EGL_KHR_surfaceless_context not supported");
^
In file included from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.h:21:0,
from external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:16:
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:128:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetConfig(display, attributes, &config));
^
~~~~
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc: In function 'int tflite::gpu::gl::CreatePBufferContext(EGLDisplay, EGLContext, tflite::gpu::gl::EglContext*)':
external/org_tensorflow/tensorflow/lite/delegates/gpu/common/status.h:68:18: error: request for member 'ok' in 'status2', which is of non-class type 'const int'
if (!status2.ok()) return status2;
^
external/org_tensorflow/tensorflow/lite/delegates/gpu/gl/egl_context.cc:146:3: note: in expansion of macro 'RETURN_IF_ERROR'
RETURN_IF_ERROR(GetConfig(display, attributes, &config));

I was trying to build it with several different tensorflow versions but no success.
Building the provided examples works just fine
Any idea how to fix this?

Regrading your issue, this discussion is somehow related: https://github.com/google/mediapipe/issues/305#issuecomment-563382801

this solved my issue.

Was this page helpful?
0 / 5 - 0 ratings