google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.6k stars 5.16k forks source link

C++ compilation of rule '//mediapipe/calculators/tensorflow:tensorflow_inference_calculator' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command #1983

Closed I-aashishM closed 3 years ago

I-aashishM commented 3 years ago

I am trying to use tensorflow GPU inference with CUDA here,

System information

I did all the step mention in the above link then I did,

bazel build -c opt --config=cuda --spawn_strategy=local --define no_aws_support=true --copt -DMESA_EGL_NO_X11_HEADERS mediapipe/examples/desktop/object_detection:object_detection_tensorflow --verbose_failures

and I got the error:

WARNING: The following configs were expanded more than once: [using_cuda]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior. INFO: SHA256 (https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip) = c2cdcf55ffaf49366725639e45dedd449b8c3fe22b54e31625eb80ce3a240f1e DEBUG: Rule 'rules_foreign_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c2cdcf55ffaf49366725639e45dedd449b8c3fe22b54e31625eb80ce3a240f1e" DEBUG: Repository rules_foreign_cc instantiated at: /home/t/mediapipe/WORKSPACE:42:13: in Repository rule http_archive defined at: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_absl' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_protobuf' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_googletest' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'rules_cc' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_apple_support' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'bazel_skylib' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'pybind11' because it already exists. INFO: Build options --@local_config_cuda//:enable_cuda, --action_env, --define, and 1 more have changed, discarding analysis cache. INFO: SHA256 (https://github.com/bazelbuild/rules_cc/archive/master.zip) = 66af5b045d30b49a61faaf063ba5da7e47b9b393e3d64b40035f66ec1ade8f34 DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "66af5b045d30b49a61faaf063ba5da7e47b9b393e3d64b40035f66ec1ade8f34" DEBUG: Repository rules_cc instantiated at: /home/t/mediapipe/WORKSPACE:36:13: in Repository rule http_archive defined at: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in DEBUG: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/local_config_cuda/cuda/build_defs.bzl:104:14: Warning: '--define=using_cuda_nvcc' will be unsupported soon. Use '--@local_config_cuda//:enable_cuda' instead. WARNING: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/tensorflow/core/lib/gtl/BUILD:129:11: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core/lib/gtl:map_util: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'cc_library', the error might have been caused by the macro implementation WARNING: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/tensorflow/core/BUILD:1227:11: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core:lib_internal: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'cc_library', the error might have been caused by the macro implementation WARNING: /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/external/org_tensorflow/tensorflow/core/BUILD:1546:16: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core:framework_internal: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'tf_cuda_library', the error might have been caused by the macro implementation INFO: Analyzed target //mediapipe/examples/desktop/object_detection:object_detection_tensorflow (206 packages loaded, 11848 targets configured). INFO: Found 1 target... ERROR: /home/t/mediapipe/mediapipe/calculators/tensorflow/BUILD:438:11: C++ compilation of rule '//mediapipe/calculators/tensorflow:tensorflow_inference_calculator' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command (cd /home/t/.cache/bazel/_bazel_t/047c8b44ca5f7198ccab9924a75f3174/execroot/mediapipe && \ exec env - \ LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64,/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/lib64 \ PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1:/home/t/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \ PWD=/proc/self/cwd \ TF_NEED_CUDA=1 \ external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -MD -MF bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/tensorflow_inference_calculator/tensorflow_inference_calculator.d '-frandom-seed=bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/tensorflow_inference_calculator/tensorflow_inference_calculator.o' -DCURL_STATICLIB -DMEDIAPIPE_PROFILER_AVAILABLE -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' -iquote . -iquote bazel-out/k8-opt/bin -iquote external/org_tensorflow -iquote bazel-out/k8-opt/bin/external/org_tensorflow -iquote external/com_google_absl -iquote bazel-out/k8-opt/bin/external/com_google_absl -iquote external/nsync -iquote bazel-out/k8-opt/bin/external/nsync -iquote external/eigen_archive -iquote bazel-out/k8-opt/bin/external/eigen_archive -iquote external/gif -iquote bazel-out/k8-opt/bin/external/gif -iquote external/libjpeg_turbo -iquote bazel-out/k8-opt/bin/external/libjpeg_turbo -iquote external/com_google_protobuf -iquote bazel-out/k8-opt/bin/external/com_google_protobuf -iquote external/zlib -iquote bazel-out/k8-opt/bin/external/zlib -iquote external/com_googlesource_code_re2 -iquote bazel-out/k8-opt/bin/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/k8-opt/bin/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/k8-opt/bin/external/fft2d -iquote external/highwayhash -iquote bazel-out/k8-opt/bin/external/highwayhash -iquote external/double_conversion -iquote bazel-out/k8-opt/bin/external/double_conversion -iquote external/snappy -iquote bazel-out/k8-opt/bin/external/snappy -iquote external/curl -iquote bazel-out/k8-opt/bin/external/curl -iquote external/boringssl -iquote bazel-out/k8-opt/bin/external/boringssl -iquote external/jsoncpp_git -iquote bazel-out/k8-opt/bin/external/jsoncpp_git -iquote external/local_config_cuda -iquote bazel-out/k8-opt/bin/external/local_config_cuda -iquote external/local_config_tensorrt -iquote bazel-out/k8-opt/bin/external/local_config_tensorrt -iquote external/com_github_glog_glog -iquote bazel-out/k8-opt/bin/external/com_github_glog_glog -iquote external/com_github_gflags_gflags -iquote bazel-out/k8-opt/bin/external/com_github_gflags_gflags -Ibazel-out/k8-opt/bin/external/local_config_cuda/cuda/_virtual_includes/cuda_headers_virtual -Ibazel-out/k8-opt/bin/external/local_config_tensorrt/_virtual_includes/tensorrt_headers -Ibazel-out/k8-opt/bin/external/com_github_glog_glog/_virtual_includes/default_glog_headers -Ibazel-out/k8-opt/bin/external/com_github_gflags_gflags/_virtual_includes/gflags -isystem external/nsync/public -isystem bazel-out/k8-opt/bin/external/nsync/public -isystem external/org_tensorflow/third_party/eigen3/mkl_include -isystem bazel-out/k8-opt/bin/external/org_tensorflow/third_party/eigen3/mkl_include -isystem external/eigen_archive -isystem bazel-out/k8-opt/bin/external/eigen_archive -isystem external/gif -isystem bazel-out/k8-opt/bin/external/gif -isystem external/com_google_protobuf/src -isystem bazel-out/k8-opt/bin/external/com_google_protobuf/src -isystem external/zlib -isystem bazel-out/k8-opt/bin/external/zlib -isystem external/farmhash_archive/src -isystem bazel-out/k8-opt/bin/external/farmhash_archive/src -isystem external/double_conversion -isystem bazel-out/k8-opt/bin/external/double_conversion -isystem external/curl/include -isystem bazel-out/k8-opt/bin/external/curl/include -isystem external/boringssl/src/include -isystem bazel-out/k8-opt/bin/external/boringssl/src/include -isystem external/jsoncpp_git/include -isystem bazel-out/k8-opt/bin/external/jsoncpp_git/include -isystem external/local_config_cuda/cuda -isystem bazel-out/k8-opt/bin/external/local_config_cuda/cuda -isystem external/local_config_cuda/cuda/cuda/include -isystem bazel-out/k8-opt/bin/external/local_config_cuda/cuda/cuda/include -Wno-builtin-macro-redefined '-DDATE="redacted"' '-DTIMESTAMP="redacted"' '-DTIME="redacted"' -fPIE -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer -no-canonical-prefixes -fno-canonical-system-headers -DNDEBUG -g0 -O2 -ffunction-sections -fdata-sections -w -w -DMESA_EGL_NO_X11_HEADERS '-std=c++17' '-std=c++17' -c mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc -o bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/tensorflow_inference_calculator/tensorflow_inference_calculator.o) Execution platform: @local_execution_config_platform//:platform mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:103:1: error: 'cc' does not name a type cc->InputSidePackets().Tag("SESSION").Set(); ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:104:1: error: expected unqualified-id before 'if' if (cc->InputSidePackets().HasTag("RECURRENT_INIT_TENSORS")) { ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:109:1: error: expected unqualified-id before 'return' return absl::OkStatus(); ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:17: error: 'InferenceState' was not declared in this scope std::unique_ptr CreateInferenceState(CalculatorContext cc) ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:17: note: suggested alternatives: mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' class InferenceState { ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:31: error: template argument 1 is invalid std::unique_ptr CreateInferenceState(CalculatorContext cc) ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:31: error: template argument 2 is invalid mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:54: error: 'CalculatorContext' was not declared in this scope std::unique_ptr CreateInferenceState(CalculatorContext cc) ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:54: note: suggested alternative: In file included from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28:0: ./mediapipe/framework/calculator_context.h:44:7: note: 'mediapipe::CalculatorContext' class CalculatorContext { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:112:73: error: 'cc' was not declared in this scope std::unique_ptr CreateInferenceState(CalculatorContext cc) ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:128:19: error: 'CalculatorContext' was not declared in this scope absl::Status Open(CalculatorContext cc) override { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:128:19: note: suggested alternative: In file included from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28:0: ./mediapipe/framework/calculator_context.h:44:7: note: 'mediapipe::CalculatorContext' class CalculatorContext { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:128:38: error: 'cc' was not declared in this scope absl::Status Open(CalculatorContext cc) override { ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:128:42: error: expected ',' or ';' before 'override' absl::Status Open(CalculatorContext cc) override { ^~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc: In function 'absl::lts_2020_09_23::Status AddBatchDimension(tensorflow::Tensor)': mediapipe/calculators/tensorflow/tensorflow_inferencecalculator.cc:188:7: error: 'options' was not declared in this scope if (options_.add_batch_dim_to_tensors()) { ^~~~ mediapipe/calculators/tensorflow/tensorflow_inferencecalculator.cc:188:7: note: suggested alternative: 'optind' if (options.add_batch_dim_to_tensors()) { ^~~~ optind mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc: At global scope: mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:199:40: error: 'Packet' does not name a type; did you mean 'stack_t'? const std::string& tag_name, const Packet& packet, ^~ stack_t mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:200:14: error: 'Timestamp' was not declared in this scope std::map<Timestamp, std::map<std::string, tf::Tensor>> ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:200:14: note: suggested alternative: In file included from ./mediapipe/framework/packet.h:40:0, from ./mediapipe/framework/graph_service_manager.h:8, from ./mediapipe/framework/calculator_state.h:30, from ./mediapipe/framework/calculator_context.h:23, from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28: ./mediapipe/framework/timestamp.h:67:7: note: 'mediapipe::Timestamp' class Timestamp { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:200:57: error: template argument 1 is invalid std::map<Timestamp, std::map<std::string, tf::Tensor>> ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:200:57: error: template argument 3 is invalid mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:200:57: error: template argument 4 is invalid mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:202:5: error: 'InferenceState' has not been declared InferenceState inference_state) ABSL_EXCLUSIVE_LOCKSREQUIRED(mutex) { ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc: In function 'absl::lts_2020_09_23::Status AggregateTensorPacket(const string&, const int&, int, int)': mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:203:34: error: request for member 'Get' in 'packet', which is of non-class type 'const int' tf::Tensor input_tensor(packet.Get()); ^~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:203:48: error: expected primary-expression before '>' token tf::Tensor input_tensor(packet.Get()); ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:203:50: error: expected primary-expression before ')' token tf::Tensor input_tensor(packet.Get()); ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:205:30: error: 'recurrent_feedtags' was not declared in this scope if (mediapipe::ContainsKey(recurrent_feedtags, tag_name)) { ^~~~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:209:5: error: 'inferencestate' was not declared in this scope inferencestate->input_tensorbatches[tag_name].clear(); ^~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:209:5: note: suggested alternative: 'inference_state' inferencestate->input_tensorbatches[tag_name].clear(); ^~~~ inference_state mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:211:47: error: request for member 'Timestamp' in 'packet', which is of non-class type 'const int' (input_tensors_by_tag_by_timestamp)[packet.Timestamp()].insert( ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc: In function 'absl::lts_2020_09_23::Status RemoveBatchDimension(tensorflow::Tensor)': mediapipe/calculators/tensorflow/tensorflow_inferencecalculator.cc:219:7: error: 'options' was not declared in this scope if (options_.add_batch_dim_to_tensors()) { ^~~~ mediapipe/calculators/tensorflow/tensorflow_inferencecalculator.cc:219:7: note: suggested alternative: 'optind' if (options.add_batch_dim_to_tensors()) { ^~~~ optind mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc: At global scope: mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:230:22: error: 'CalculatorContext' was not declared in this scope absl::Status Process(CalculatorContext cc) override { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:230:22: note: suggested alternative: In file included from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28:0: ./mediapipe/framework/calculator_context.h:44:7: note: 'mediapipe::CalculatorContext' class CalculatorContext { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:230:41: error: 'cc' was not declared in this scope absl::Status Process(CalculatorContext cc) override { ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:230:45: error: expected ',' or ';' before 'override' absl::Status Process(CalculatorContext cc) override { ^~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:295:20: error: 'CalculatorContext' was not declared in this scope absl::Status Close(CalculatorContext cc) override { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:295:20: note: suggested alternative: In file included from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28:0: ./mediapipe/framework/calculator_context.h:44:7: note: 'mediapipe::CalculatorContext' class CalculatorContext { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:295:39: error: 'cc' was not declared in this scope absl::Status Close(CalculatorContext cc) override { ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:295:43: error: expected ',' or ';' before 'override' absl::Status Close(CalculatorContext cc) override { ^~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:319:26: error: 'CalculatorContext' was not declared in this scope absl::Status OutputBatch(CalculatorContext cc, ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:319:26: note: suggested alternative: In file included from mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:28:0: ./mediapipe/framework/calculator_context.h:44:7: note: 'mediapipe::CalculatorContext' class CalculatorContext { ^~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:319:45: error: 'cc' was not declared in this scope absl::Status OutputBatch(CalculatorContext cc, ^~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:320:42: error: 'InferenceState' was not declared in this scope std::unique_ptr inference_state) { ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:320:42: note: suggested alternatives: mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' class InferenceState { ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:320:56: error: template argument 1 is invalid std::unique_ptr inference_state) { ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:320:56: error: template argument 2 is invalid mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:320:75: error: expected ',' or ';' before '{' token std::unique_ptr inference_state) { ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:452:1: error: expected unqualified-id before 'private' private: ^~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:462:17: error: 'InferenceState' was not declared in this scope std::unique_ptr inferencestate ABSL_GUARDEDBY(mutex); ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:462:17: note: suggested alternatives: mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' class InferenceState { ^~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:87:7: note: 'mediapipe::{anonymous}::InferenceState' mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:462:31: error: template argument 1 is invalid std::unique_ptr inferencestate ABSL_GUARDEDBY(mutex); ^ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:462:31: error: template argument 2 is invalid mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:465:1: error: 'TensorFlowInferenceCalculatorOptions' does not name a type; did you mean 'ZTIN9mediapipe36TensorFlowInferenceCalculatorOptionsE'? TensorFlowInferenceCalculatorOptions options; ^~~~~~~~ _ZTIN9mediapipe36TensorFlowInferenceCalculatorOptionsE mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:475:8: error: 'SimpleSemaphore' does not name a type static SimpleSemaphore get_session_run_throttle( ^~~~~~~ mediapipe/calculators/tensorflow/tensorflow_inference_calculator.cc:481:1: error: expected declaration before '}' token } ^ Target //mediapipe/examples/desktop/object_detection:object_detection_tensorflow failed to build INFO: Elapsed time: 244.658s, Critical Path: 236.00s INFO: 296 processes: 132 internal, 164 local. FAILED: Build did NOT complete successfully

Any suggestion, where am I getting wrong??

jiuqiant commented 3 years ago

There was an issue in the source code of tensorflow_inference_calculator.cc. Please pull the latest version of MediaPipe and retry.

I-aashishM commented 3 years ago

I pull the latest mediapipe and did all the steps mention above link and did this,

bazel build -c opt --config=cuda --spawn_strategy=local --define no_aws_support=true --copt -DMESA_EGL_NO_X11_HEADERS mediapipe/examples/desktop/object_detection:object_detection_tensorflow --verbose_failures

I got another error:

WARNING: The following configs were expanded more than once: [using_cuda]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior. DEBUG: Rule 'rules_foreign_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c2cdcf55ffaf49366725639e45dedd449b8c3fe22b54e31625eb80ce3a240f1e" DEBUG: Repository rules_foreign_cc instantiated at: /home/t/media-pipe/mediapipe/WORKSPACE:42:13: in Repository rule http_archive defined at: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_absl' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_protobuf' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_google_googletest' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'build_bazel_apple_support' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'bazel_skylib' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/third_party/repo.bzl:108:14: Warning: skipping import of repository 'pybind11' because it already exists. DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/tf_runtime/third_party/cuda/dependencies.bzl:51:10: The following command will download NVIDIA proprietary software. By using the software you agree to comply with the terms of the license agreement that accompanies the software. If you do not agree to the terms of the license agreement, do not use the software. DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "66af5b045d30b49a61faaf063ba5da7e47b9b393e3d64b40035f66ec1ade8f34" DEBUG: Repository rules_cc instantiated at: /home/t/media-pipe/mediapipe/WORKSPACE:36:13: in Repository rule http_archive defined at: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:118:10: Auto-Configuration Warning: 'TMP' environment variable is not set, using 'C:\Windows\Temp' as default DEBUG: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/local_config_cuda/cuda/build_defs.bzl:104:14: Warning: '--define=using_cuda_nvcc' will be unsupported soon. Use '--@local_config_cuda//:enable_cuda' instead. WARNING: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/tensorflow/core/lib/gtl/BUILD:129:11: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core/lib/gtl:map_util: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'cc_library', the error might have been caused by the macro implementation WARNING: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/tensorflow/core/BUILD:1237:11: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core:lib_internal: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'cc_library', the error might have been caused by the macro implementation WARNING: /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/external/org_tensorflow/tensorflow/core/BUILD:1556:16: in linkstatic attribute of cc_library rule @org_tensorflow//tensorflow/core:framework_internal: setting 'linkstatic=1' is recommended if there are no object files. Since this rule was created by the macro 'tf_cuda_library', the error might have been caused by the macro implementation INFO: Analyzed target //mediapipe/examples/desktop/object_detection:object_detection_tensorflow (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/t/media-pipe/mediapipe/mediapipe/calculators/tensorflow/BUILD:374:11: C++ compilation of rule '//mediapipe/calculators/tensorflow:object_detection_tensors_to_detections_calculator' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command (cd /home/t/.cache/bazel/_bazel_t/4727bb276306ef612ddae51b6f38fd13/execroot/mediapipe && \ exec env - \ LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64,/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/lib64 \ PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1:/home/t/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \ PWD=/proc/self/cwd \ TF_NEED_CUDA=1 \ external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -MD -MF bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/object_detection_tensors_to_detections_calculator/object_detection_tensors_to_detections_calculator.d '-frandom-seed=bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/object_detection_tensors_to_detections_calculator/object_detection_tensors_to_detections_calculator.o' -DMEDIAPIPE_PROFILER_AVAILABLE -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' -iquote . -iquote bazel-out/k8-opt/bin -iquote external/com_google_protobuf -iquote bazel-out/k8-opt/bin/external/com_google_protobuf -iquote external/zlib -iquote bazel-out/k8-opt/bin/external/zlib -iquote external/com_github_glog_glog -iquote bazel-out/k8-opt/bin/external/com_github_glog_glog -iquote external/com_github_gflags_gflags -iquote bazel-out/k8-opt/bin/external/com_github_gflags_gflags -iquote external/com_google_absl -iquote bazel-out/k8-opt/bin/external/com_google_absl -iquote external/linux_opencv -iquote bazel-out/k8-opt/bin/external/linux_opencv -iquote external/org_tensorflow -iquote bazel-out/k8-opt/bin/external/org_tensorflow -iquote external/nsync -iquote bazel-out/k8-opt/bin/external/nsync -iquote external/eigen_archive -iquote bazel-out/k8-opt/bin/external/eigen_archive -iquote external/gif -iquote bazel-out/k8-opt/bin/external/gif -iquote external/libjpeg_turbo -iquote bazel-out/k8-opt/bin/external/libjpeg_turbo -iquote external/com_googlesource_code_re2 -iquote bazel-out/k8-opt/bin/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/k8-opt/bin/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/k8-opt/bin/external/fft2d -iquote external/highwayhash -iquote bazel-out/k8-opt/bin/external/highwayhash -iquote external/double_conversion -iquote bazel-out/k8-opt/bin/external/double_conversion -iquote external/snappy -iquote bazel-out/k8-opt/bin/external/snappy -Ibazel-out/k8-opt/bin/external/com_github_glog_glog/_virtual_includes/default_glog_headers -Ibazel-out/k8-opt/bin/external/com_github_gflags_gflags/_virtual_includes/gflags -isystem external/com_google_protobuf/src -isystem bazel-out/k8-opt/bin/external/com_google_protobuf/src -isystem external/zlib -isystem bazel-out/k8-opt/bin/external/zlib -isystem external/linux_opencv/include -isystem bazel-out/k8-opt/bin/external/linux_opencv/include -isystem external/nsync/public -isystem bazel-out/k8-opt/bin/external/nsync/public -isystem external/org_tensorflow/third_party/eigen3/mkl_include -isystem bazel-out/k8-opt/bin/external/org_tensorflow/third_party/eigen3/mkl_include -isystem external/eigen_archive -isystem bazel-out/k8-opt/bin/external/eigen_archive -isystem external/gif -isystem bazel-out/k8-opt/bin/external/gif -isystem external/farmhash_archive/src -isystem bazel-out/k8-opt/bin/external/farmhash_archive/src -isystem external/double_conversion -isystem bazel-out/k8-opt/bin/external/double_conversion -Wno-builtin-macro-redefined '-DDATE="redacted"' '-DTIMESTAMP="redacted"' '-DTIME="redacted"' -fPIE -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer -no-canonical-prefixes -fno-canonical-system-headers -DNDEBUG -g0 -O2 -ffunction-sections -fdata-sections -w -w -DMESA_EGL_NO_X11_HEADERS '-std=c++17' '-std=c++17' -c mediapipe/calculators/tensorflow/object_detection_tensors_to_detections_calculator.cc -o bazel-out/k8-opt/bin/mediapipe/calculators/tensorflow/_objs/object_detection_tensors_to_detections_calculator/object_detection_tensors_to_detections_calculator.o) Execution platform: @local_execution_config_platform//:platform In file included from /usr/include/c++/7/ext/string_conversions.h:41:0, from /usr/include/c++/7/bits/basic_string.h:6361, from /usr/include/c++/7/string:52, from /usr/include/c++/7/stdexcept:39, from /usr/include/c++/7/optional:38, from /usr/include/c++/7/bits/node_handle.h:39, from /usr/include/c++/7/bits/stl_tree.h:72, from /usr/include/c++/7/map:60, from mediapipe/calculators/tensorflow/object_detection_tensors_to_detections_calculator.cc:15: /usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory

include_next

           ^~~~~~~~~~

compilation terminated. Target //mediapipe/examples/desktop/object_detection:object_detection_tensorflow failed to build INFO: Elapsed time: 0.401s, Critical Path: 0.10s INFO: 20 processes: 20 internal. FAILED: Build did NOT complete successfully

I-aashishM commented 3 years ago

I got the solution. There was something wrong in tensorflow_inference_calculator.cc file. So i replace the same file with different version of mediapipe. Now I'm able to build the tensorflow with cuda.

Closing this issue.