question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@com_google_mediapipe//third_party:opencv_cmake: no such attribute 'shared_libraries' in 'cmake' rule

See original GitHub issue

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 20.04, WSL2): Windows 10
  • Target (e.g. desktop cpu, android arm64): desktop cpu
  • Bazel version: bazel 4.0.0
  • Python version: Python 3.9.4
  • CMake version: cmake version 3.20.1
  • Unity version: 2019.4.11f1
  • Android NDK version (if building for Android):
  • Xcode version (if building for iOS):

Describe the problem I follow the setup steps for Windows(Desktop/UnityEditor), and after run build command, get error: ERROR: C:/_bzl/ru6tpeoz/external/com_google_mediapipe/third_party/BUILD:97:15: @com_google_mediapipe//third_party:opencv_cmake: no such attribute 'shared_libraries' in 'cmake' rule

Steps to reproduce the issue python build.py build --desktop cpu -v

Full logs

F:\unityproj\MediaPipeUnityPlugin-master>python build.py build --desktop cpu -v
INFO (build.py): Building protobuf sources...
DEBUG (build.py): Running `bazel --output_user_root C:/_bzl build -c opt --action_env PYTHON_BIN_PATH=D://Python//Python39//python.exe //mediapipe_api:mediapipe_proto_srcs`
DEBUG: C:/_bzl/ru6tpeoz/external/rules_foreign_cc/workspace_definitions.bzl:6:6: `@rules_foreign_cc//:workspace_definitions.bzl` has been replaced by `@rules_foreign_cc//foreign_cc:repositories.bzl`. Please use the updated source location
INFO: Build option --define has changed, discarding analysis cache.
INFO: Analyzed target //mediapipe_api:mediapipe_proto_srcs (0 packages loaded, 654 targets configured).
INFO: Found 1 target...
Target //mediapipe_api:mediapipe_proto_srcs up-to-date:
  bazel-bin/mediapipe_api/mediapipe_proto_srcs.zip
INFO: Elapsed time: 0.631s, Critical Path: 0.08s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
DEBUG (build.py): Unarchiving 'bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip' to 'build\Scripts\Protobuf'...
INFO (build.py): Built protobuf sources
INFO (build.py): Downloading protobuf dlls...
DEBUG (build.py): Running `nuget install -o .nuget`
Feeds used:
  C:\Users\DELL\.nuget\packages\
  https://api.nuget.org/v3/index.json

F:\unityproj\MediaPipeUnityPlugin-master\packages.config 中列出的所有程序包均已安装。
DEBUG (build.py): Copying '.nuget\Google.Protobuf.3.15.6\lib\netstandard2.0\Google.Protobuf.dll' to 'build\Plugins\Protobuf\Google.Protobuf.dll'...
DEBUG (build.py): Changing the mode of 'build\Plugins\Protobuf\Google.Protobuf.dll'...
DEBUG (build.py): Copying '.nuget\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll' to 'build\Plugins\Protobuf\System.Buffers.dll'...
DEBUG (build.py): Changing the mode of 'build\Plugins\Protobuf\System.Buffers.dll'...
DEBUG (build.py): Copying '.nuget\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll' to 'build\Plugins\Protobuf\System.Memory.dll'...
DEBUG (build.py): Changing the mode of 'build\Plugins\Protobuf\System.Memory.dll'...
DEBUG (build.py): Copying '.nuget\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll' to 'build\Plugins\Protobuf\System.Runtime.CompilerServices.Unsafe.dll'...
DEBUG (build.py): Changing the mode of 'build\Plugins\Protobuf\System.Runtime.CompilerServices.Unsafe.dll'...
INFO (build.py): Downloaded protobuf dlls
INFO (build.py): Building resource files
DEBUG (build.py): Running `bazel --output_user_root C:/_bzl build -c opt --action_env PYTHON_BIN_PATH=D://Python//Python39//python.exe //mediapipe_api:mediapipe_assets`
DEBUG: C:/_bzl/ru6tpeoz/external/rules_foreign_cc/workspace_definitions.bzl:6:6: `@rules_foreign_cc//:workspace_definitions.bzl` has been replaced by `@rules_foreign_cc//foreign_cc:repositories.bzl`. Please use the updated source location
INFO: Analyzed target //mediapipe_api:mediapipe_assets (0 packages loaded, 46 targets configured).
INFO: Found 1 target...
Target //mediapipe_api:mediapipe_assets up-to-date:
  bazel-bin/mediapipe_api/mediapipe_assets.zip
INFO: Elapsed time: 0.414s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
DEBUG (build.py): Unarchiving 'bazel-bin\mediapipe_api\mediapipe_assets.zip' to 'build\Resources'...
INFO (build.py): Built resource files
INFO (build.py): Building native libraries for Desktop...
DEBUG (build.py): Running `bazel --output_user_root C:/_bzl build -c opt --action_env PYTHON_BIN_PATH=D://Python//Python39//python.exe --define MEDIAPIPE_DISABLE_GPU=1 //mediapipe_api:mediapipe_desktop`
DEBUG: C:/_bzl/ru6tpeoz/external/rules_foreign_cc/workspace_definitions.bzl:6:6: `@rules_foreign_cc//:workspace_definitions.bzl` has been replaced by `@rules_foreign_cc//foreign_cc:repositories.bzl`. Please use the updated source location
INFO: Build option --define has changed, discarding analysis cache.
DEBUG: C:/_bzl/ru6tpeoz/external/rules_foreign_cc/tools/build_defs/deprecation.bzl:5:10: `@rules_foreign_cc//tools/build_defs/...` is deprecated, please find the relevant symbols in `@rules_foreign_cc//foreign_cc/...`. Note that the core rules can now be loaded from `@rules_foreign_cc//foreign_cc:defs.bzl`
ERROR: C:/_bzl/ru6tpeoz/external/com_google_mediapipe/third_party/BUILD:97:15: @com_google_mediapipe//third_party:opencv_cmake: no such attribute 'shared_libraries' in 'cmake' rule
ERROR: C:/_bzl/ru6tpeoz/external/com_google_mediapipe/mediapipe/framework/port/BUILD:92:11: Target '@com_google_mediapipe//third_party:glog' contains an error and its package is in error and referenced by '@com_google_mediapipe//mediapipe/framework/port:commandlineflags'
INFO: Repository com_google_absl instantiated at:
  F:/unityproj/mediapipeunityplugin-master/WORKSPACE:57:13: in <toplevel>
Repository rule http_archive defined at:
  C:/_bzl/ru6tpeoz/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: Analysis of target '//mediapipe_api:mediapipe_desktop' failed; build aborted: Analysis failed
INFO: Elapsed time: 3.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 707 targets configured)
Traceback (most recent call last):
  File "F:\unityproj\MediaPipeUnityPlugin-master\build.py", line 362, in <module>
    Argument().command().run()
  File "F:\unityproj\MediaPipeUnityPlugin-master\build.py", line 128, in run
    self._run_command(self._build_desktop_commands())
  File "F:\unityproj\MediaPipeUnityPlugin-master\build.py", line 47, in _run_command
    return subprocess.run(command_list, check=True)
  File "D:\Python\Python39\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bazel', '--output_user_root', 'C:/_bzl', 'build', '-c', 'opt', '--action_env', 'PYTHON_BIN_PATH=D://Python//Python39//python.exe', '--define', 'MEDIAPIPE_DISABLE_GPU=1', '//mediapipe_api:mediapipe_desktop']' returned non-zero exit status 1.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sharyucommented, Apr 13, 2021

Thanks. Will you apply this patch (git apply) to master branch?

diff --git a/WORKSPACE b/WORKSPACE
index ffdaf2c..cf30d2b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -78,8 +78,8 @@ http_archive(
 
 http_archive(
    name = "rules_foreign_cc",
-   strip_prefix = "rules_foreign_cc-main",
-   url = "https://github.com/bazelbuild/rules_foreign_cc/archive/main.zip",
+   strip_prefix = "rules_foreign_cc-0.1.0",
+   url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip",
 )
 
 load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")

After applying this fix, above error disappeared. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

unable to find shared object files · Issue #165 · bazelbuild ...
OK so I'm getting the same error for a library that is declared in shared_libraries attribute of cmake_external. the library is libboost_regex.
Read more >
CMake project fails to find shared library - c++
The issue you are encountering does sound to be related to the search path for direct and indirect linkage of shared libraries. CMake...
Read more >
target_link_libraries — CMake 3.27.3 Documentation
If an imported library has the IMPORTED_NO_SONAME target property set, CMake may ask the linker to search for the library instead of using...
Read more >
Custom Directory for CMake Library Output
The LIBRARY_OUTPUT_DIRECTORY target property specifies the directory where library target files will be built.
Read more >
Linux shared libraries with CMake and Bazel - Technical notes
Here, we try to exploit the possibility of setting the linkshared attribute of cc_binary to true, which will create a shared library. We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found