Mediapipe Build Fails on AGX Xavier

• Hardware Platform: Jetson AGX Xavier (32GB)
• JetPack Version: 4.6.4
• TensorRT Version: 8.2.1
• CUDA Version: 10.2
• Bazel Version : 4.2.1
• OpenCV Version : 4.1.1
• Tensorflow Version : 2.7.0
• gcc and g++ Versions : 8.4.0

Hello,

I am trying to install and usethis package on an AGX Xavier. For that, I had to install the Mediapipe which is required for the package I am trying to install. So I have followed these steps and this tutorial (option 3) to install bazel 3.7.0 (requirement of Mediapipe) and 0.8.1 version of Mediapipe. But, when i tried to build the examples in Mediapipe, builds have failed with errors and then, I have learned that it’s not supported for Jetson devices. So, first, I have removed bazel and then installed 4.2.1 version. Then, I have tried to install and build this mediapipe package developed for Jetson devices. In order to do that, I have followed the instructions specified under Compile from source (for new versions) section. After the command:

pip3 uninstall -y mediapipe && sudo python3 setup.py gen_protos && sudo python3 setup.py bdist_wheel && python3 -m pip install dist/mediapipe-0.8.9_cuda102-cp36-cp36m-linux_aarch64.whl

I got the following output:

WARNING: Skipping mediapipe as it is not installed.
/usr/local/lib/python3.6/dist-packages/setuptools/dist.py:511: UserWarning: The version specified ('0.8.9_cuda102') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % version
running gen_protos
generating proto file: mediapipe/framework/packet_generator_pb2.py
generating proto file: mediapipe/framework/stream_handler_pb2.py
generating proto file: mediapipe/framework/test_calculators_pb2.py
generating proto file: mediapipe/framework/calculator_pb2.py
generating proto file: mediapipe/framework/thread_pool_executor_pb2.py
generating proto file: mediapipe/framework/calculator_profile_pb2.py
generating proto file: mediapipe/framework/status_handler_pb2.py
generating proto file: mediapipe/framework/packet_factory_pb2.py
generating proto file: mediapipe/framework/calculator_options_pb2.py
generating proto file: mediapipe/framework/mediapipe_options_pb2.py
generating proto file: mediapipe/framework/tool/switch_container_pb2.py
generating proto file: mediapipe/framework/tool/field_data_pb2.py
generating proto file: mediapipe/framework/tool/packet_generator_wrapper_calculator_pb2.py
generating proto file: mediapipe/framework/tool/source_pb2.py
generating proto file: mediapipe/framework/tool/node_chain_subgraph_pb2.py
generating proto file: mediapipe/framework/tool/calculator_graph_template_pb2.py
generating proto file: mediapipe/framework/formats/affine_transform_data_pb2.py
generating proto file: mediapipe/framework/formats/time_series_header_pb2.py
generating proto file: mediapipe/framework/formats/matrix_data_pb2.py
generating proto file: mediapipe/framework/formats/detection_pb2.py
generating proto file: mediapipe/framework/formats/location_data_pb2.py
generating proto file: mediapipe/framework/formats/rect_pb2.py
generating proto file: mediapipe/framework/formats/landmark_pb2.py
generating proto file: mediapipe/framework/formats/body_rig_pb2.py
generating proto file: mediapipe/framework/formats/image_format_pb2.py
generating proto file: mediapipe/framework/formats/image_file_properties_pb2.py
generating proto file: mediapipe/framework/formats/classification_pb2.py
generating proto file: mediapipe/framework/formats/annotation/locus_pb2.py
generating proto file: mediapipe/framework/formats/annotation/rasterization_pb2.py
generating proto file: mediapipe/framework/formats/motion/optical_flow_field_data_pb2.py
generating proto file: mediapipe/framework/formats/object_detection/anchor_pb2.py
generating proto file: mediapipe/framework/stream_handler/default_input_stream_handler_pb2.py
generating proto file: mediapipe/framework/stream_handler/timestamp_align_input_stream_handler_pb2.py
generating proto file: mediapipe/framework/stream_handler/fixed_size_input_stream_handler_pb2.py
generating proto file: mediapipe/framework/stream_handler/sync_set_input_stream_handler_pb2.py
generating proto file: mediapipe/framework/deps/proto_descriptor_pb2.py
generating proto file: mediapipe/calculators/image/opencv_image_encoder_calculator_pb2.py
generating proto file: mediapipe/calculators/image/feature_detector_calculator_pb2.py
generating proto file: mediapipe/calculators/image/set_alpha_calculator_pb2.py
generating proto file: mediapipe/calculators/image/recolor_calculator_pb2.py
generating proto file: mediapipe/calculators/image/scale_image_calculator_pb2.py
generating proto file: mediapipe/calculators/image/warp_affine_calculator_pb2.py
generating proto file: mediapipe/calculators/image/image_transformation_calculator_pb2.py
generating proto file: mediapipe/calculators/image/image_cropping_calculator_pb2.py
generating proto file: mediapipe/calculators/image/segmentation_smoothing_calculator_pb2.py
generating proto file: mediapipe/calculators/image/image_clone_calculator_pb2.py
generating proto file: mediapipe/calculators/image/bilateral_filter_calculator_pb2.py
generating proto file: mediapipe/calculators/image/opencv_encoded_image_to_image_frame_calculator_pb2.py
generating proto file: mediapipe/calculators/image/mask_overlay_calculator_pb2.py
generating proto file: mediapipe/calculators/audio/stabilized_log_calculator_pb2.py
generating proto file: mediapipe/calculators/audio/spectrogram_calculator_pb2.py
generating proto file: mediapipe/calculators/audio/time_series_framer_calculator_pb2.py
generating proto file: mediapipe/calculators/audio/mfcc_mel_calculators_pb2.py
generating proto file: mediapipe/calculators/audio/rational_factor_resample_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/ssd_anchors_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_converter_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_tensors_to_landmarks_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_tensors_to_segmentation_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_inference_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_tensors_to_classification_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator_pb2.py
generating proto file: mediapipe/calculators/tflite/tflite_custom_op_resolver_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/inference_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/landmarks_to_tensor_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensors_to_segmentation_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensors_to_classification_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensors_to_detections_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensor_converter_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensors_to_landmarks_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/image_to_tensor_calculator_pb2.py
generating proto file: mediapipe/calculators/tensor/tensors_to_floats_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmarks_to_floats_calculator_pb2.py
generating proto file: mediapipe/calculators/util/packet_frequency_calculator_pb2.py
generating proto file: mediapipe/calculators/util/non_max_suppression_calculator_pb2.py
generating proto file: mediapipe/calculators/util/timed_box_list_id_to_label_calculator_pb2.py
generating proto file: mediapipe/calculators/util/annotation_overlay_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmark_projection_calculator_pb2.py
generating proto file: mediapipe/calculators/util/rect_transformation_calculator_pb2.py
generating proto file: mediapipe/calculators/util/timed_box_list_to_render_data_calculator_pb2.py
generating proto file: mediapipe/calculators/util/detection_label_id_to_text_calculator_pb2.py
generating proto file: mediapipe/calculators/util/visibility_smoothing_calculator_pb2.py
generating proto file: mediapipe/calculators/util/rect_to_render_scale_calculator_pb2.py
generating proto file: mediapipe/calculators/util/association_calculator_pb2.py
generating proto file: mediapipe/calculators/util/top_k_scores_calculator_pb2.py
generating proto file: mediapipe/calculators/util/collection_has_min_size_calculator_pb2.py
generating proto file: mediapipe/calculators/util/packet_frequency_pb2.py
generating proto file: mediapipe/calculators/util/local_file_contents_calculator_pb2.py
generating proto file: mediapipe/calculators/util/logic_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmarks_to_render_data_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmarks_smoothing_calculator_pb2.py
generating proto file: mediapipe/calculators/util/rect_to_render_data_calculator_pb2.py
generating proto file: mediapipe/calculators/util/labels_to_render_data_calculator_pb2.py
generating proto file: mediapipe/calculators/util/packet_latency_calculator_pb2.py
generating proto file: mediapipe/calculators/util/filter_detections_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmarks_to_detection_calculator_pb2.py
generating proto file: mediapipe/calculators/util/detections_to_render_data_calculator_pb2.py
generating proto file: mediapipe/calculators/util/visibility_copy_calculator_pb2.py
generating proto file: mediapipe/calculators/util/landmarks_refinement_calculator_pb2.py
generating proto file: mediapipe/calculators/util/detections_to_rects_calculator_pb2.py
generating proto file: mediapipe/calculators/util/refine_landmarks_from_heatmap_calculator_pb2.py
generating proto file: mediapipe/calculators/util/thresholding_calculator_pb2.py
generating proto file: mediapipe/calculators/util/latency_pb2.py
generating proto file: mediapipe/calculators/core/packet_resampler_calculator_pb2.py
generating proto file: mediapipe/calculators/core/clip_vector_size_calculator_pb2.py
generating proto file: mediapipe/calculators/core/quantize_float_vector_calculator_pb2.py
generating proto file: mediapipe/calculators/core/packet_cloner_calculator_pb2.py
generating proto file: mediapipe/calculators/core/graph_profile_calculator_pb2.py
generating proto file: mediapipe/calculators/core/concatenate_vector_calculator_pb2.py
generating proto file: mediapipe/calculators/core/gate_calculator_pb2.py
generating proto file: mediapipe/calculators/core/dequantize_byte_array_calculator_pb2.py
generating proto file: mediapipe/calculators/core/flow_limiter_calculator_pb2.py
generating proto file: mediapipe/calculators/core/sequence_shift_calculator_pb2.py
generating proto file: mediapipe/calculators/core/constant_side_packet_calculator_pb2.py
generating proto file: mediapipe/calculators/core/packet_thinner_calculator_pb2.py
generating proto file: mediapipe/calculators/core/split_vector_calculator_pb2.py
generating proto file: mediapipe/calculators/video/tracked_detection_manager_calculator_pb2.py
generating proto file: mediapipe/calculators/video/flow_packager_calculator_pb2.py
generating proto file: mediapipe/calculators/video/box_tracker_calculator_pb2.py
generating proto file: mediapipe/calculators/video/flow_to_image_calculator_pb2.py
generating proto file: mediapipe/calculators/video/opencv_video_encoder_calculator_pb2.py
generating proto file: mediapipe/calculators/video/box_detector_calculator_pb2.py
generating proto file: mediapipe/calculators/video/video_pre_stream_calculator_pb2.py
generating proto file: mediapipe/calculators/video/motion_analysis_calculator_pb2.py
generating proto file: mediapipe/calculators/video/tool/flow_quantizer_model_pb2.py
generating proto file: mediapipe/calculators/internal/callback_packet_calculator_pb2.py
generating proto file: mediapipe/gpu/gl_scaler_calculator_pb2.py
generating proto file: mediapipe/gpu/gl_surface_sink_calculator_pb2.py
generating proto file: mediapipe/gpu/scale_mode_pb2.py
generating proto file: mediapipe/gpu/copy_calculator_pb2.py
generating proto file: mediapipe/gpu/gpu_origin_pb2.py
generating proto file: mediapipe/gpu/gl_context_options_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/camera_parameters_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/lift_2d_frame_annotation_to_3d_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/filter_detection_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/object_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/tensors_to_objects_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/frame_annotation_to_rect_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/frame_annotation_tracker_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/belief_decoder_config_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/annotation_data_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/tflite_tensors_to_objects_calculator_pb2.py
generating proto file: mediapipe/modules/objectron/calculators/a_r_capture_metadata_pb2.py
generating proto file: mediapipe/modules/holistic_landmark/calculators/roi_tracking_calculator_pb2.py
generating proto file: mediapipe/modules/face_geometry/geometry_pipeline_calculator_pb2.py
generating proto file: mediapipe/modules/face_geometry/env_generator_calculator_pb2.py
generating proto file: mediapipe/modules/face_geometry/effect_renderer_calculator_pb2.py
generating proto file: mediapipe/modules/face_geometry/protos/environment_pb2.py
generating proto file: mediapipe/modules/face_geometry/protos/face_geometry_pb2.py
generating proto file: mediapipe/modules/face_geometry/protos/geometry_pipeline_metadata_pb2.py
generating proto file: mediapipe/modules/face_geometry/protos/mesh_3d_pb2.py
generating proto file: mediapipe/util/render_data_pb2.py
generating proto file: mediapipe/util/audio_decoder_pb2.py
generating proto file: mediapipe/util/color_pb2.py
generating proto file: mediapipe/util/tracking/box_detector_pb2.py
generating proto file: mediapipe/util/tracking/motion_models_pb2.py
generating proto file: mediapipe/util/tracking/region_flow_pb2.py
generating proto file: mediapipe/util/tracking/motion_estimation_pb2.py
generating proto file: mediapipe/util/tracking/box_tracker_pb2.py
generating proto file: mediapipe/util/tracking/push_pull_filtering_pb2.py
generating proto file: mediapipe/util/tracking/tracking_pb2.py
generating proto file: mediapipe/util/tracking/tracked_detection_manager_config_pb2.py
generating proto file: mediapipe/util/tracking/motion_analysis_pb2.py
generating proto file: mediapipe/util/tracking/flow_packager_pb2.py
generating proto file: mediapipe/util/tracking/tone_estimation_pb2.py
generating proto file: mediapipe/util/tracking/camera_motion_pb2.py
generating proto file: mediapipe/util/tracking/motion_saliency_pb2.py
generating proto file: mediapipe/util/tracking/frame_selection_pb2.py
generating proto file: mediapipe/util/tracking/region_flow_computation_pb2.py
generating proto file: mediapipe/util/tracking/tone_models_pb2.py
generating proto file: mediapipe/util/tracking/frame_selection_solution_evaluator_pb2.py
/usr/local/lib/python3.6/dist-packages/setuptools/dist.py:511: UserWarning: The version specified ('0.8.9_cuda102') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % version
running bdist_wheel
running build
running build_py
running build_binary_graphs
generating binarypb: mediapipe/modules/face_detection/face_detection_short_range_gpu
Starting local Bazel server and connecting to it...
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/org_tensorflow/third_party/repo.bzl:122:14: 
Warning: skipping import of repository 'pybind11' because it already exists.
ERROR: Traceback (most recent call last):
	File "/home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/rules_cc/cc/private/rules_impl/cc_flags_supplier.bzl", line 16, column 76, in <toplevel>
		load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
Error: file '@bazel_tools//tools/cpp:toolchain_utils.bzl' does not contain symbol 'use_cpp_toolchain' (did you mean 'find_cpp_toolchain'?)
ERROR: While resolving toolchains for target //mediapipe/modules/face_detection:face_detection_short_range_gpu: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '@bazel_tools//tools/cpp': in /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/rules_cc/cc/defs.bzl: Extension file 'cc/private/rules_impl/cc_flags_supplier.bzl' has errors
ERROR: Analysis of target '//mediapipe/modules/face_detection:face_detection_short_range_gpu' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '@bazel_tools//tools/cpp': in /home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/rules_cc/cc/defs.bzl: Extension file 'cc/private/rules_impl/cc_flags_supplier.bzl' has errors
INFO: Elapsed time: 8.777s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 0 targets conf\
igured)

Could you offer your guidance and advice please?

Kindest regards.

Way back, when I had built and modified mediapipe, I had done so directly from the mediapipe sources. As far as I can tell, bazel is having trouble finding the cpp tools:

ERROR: Traceback (most recent call last): File "/home/mericgeren/.cache/bazel/_bazel_root/1203cec2c0418060ccddce75ea9152a3/external/rules_cc/cc/private/rules_impl/cc_flags_supplier.bzl", line 16, column 76, in load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") Error: file '@bazel_tools//tools/cpp:toolchain_utils.bzl' does not contain symbol 'use_cpp_toolchain' (did you mean 'find_cpp_toolchain'?)

Guessing (and I do really mean guessing), did you install build-esentials and “### Do not forget set g++8:
$ sudo update-alternatives --config g++”?

Hope this helps - Mario.

Thank you for your kind suggestions.

Although when I try to run the command sudo update-alternatives --config g++ it tells me there is no alternative. When I run the command g++ --version I can see that my g++ version is 8.4.0. About build-essentials, I have run the command to install build-essentials at least a couple of times before trying to install bazel or mediapipe.

Kindest regards.

Sounds an alot like: this. The MacOS solution should still work …

Regards - Mario.

When I look at that I realized I need the bazel version of 5.2.0. So I have removed the former version of bazel and installed 5.2.0 and when I run the command to build mediapipe, I haven’t got that error.

Thank you so much.

You’re welcome.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.