Getting error while running mediapipe on macOS; Building C++ command-line example apps - macos

I am trying to use mediapipe for a university project and have installed it, even successfully ran the Hello World! in C++ example app but when I am trying to build the C++ command-line example, it is giving me errors.
I ran this:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
and the result I got is this:
DEBUG: /private/var/tmp/_bazel_kanzashaikh/c191ae13e9137350b50f6a19ce94bf21/external/rules_foreign_cc/workspace_definitions.bzl:15:10: WARNING: This branch is deprecated and no longer recieving updates. Please update to main or choose a specific commit to pin in your workspace.
INFO: Build option --compilation_mode has changed, discarding analysis cache.
ERROR: Error fetching repository: java.io.IOException: The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: /Users/kanzashaikh/development/mediapipe/third_party/BUILD:178:6: //third_party:opencv_binary depends on #macos_opencv//:opencv in repository #macos_opencv which failed to fetch. no such package '#macos_opencv//': The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: Analysis of target '//mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.194s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 237 targets co
nfigured)
How do I solve it?

before building desktop examples, you should setup opencv. also for android examples you should setup android sdk and ndk.
there is a builtin script for setting up opencv and you can execute it.
for setting up opencv:
bash setup_opencv.sh
and for android sdk and ndk:
bash setup_android_sdk_and_ndk.sh

I am assuming you are running a M1 machine, as Homebrew is now installing Intel binaries under /usr/local and ARM ones under /opt/homebrew.
In your case, when building, bazel is looking for opencv#3 package at /usr/local/opt/opencv#3 and immediately throws an error as the package is located at /opt/homebrew/opt/opencv#3.
Thus, you have two choices:
Open WORKSPACE file from your bazel project and modify the path for each package accordingly
Make a symbolic link to /opt/homebrew/opt in /usr/local by running: sudo ln -s /opt/homebrew/opt opt

Related

Getting error: no matching version `^2.0.0` found for package `codec`?

Question
I'm new to Substrate and going through Add a Pallet to Your Runtime. At first, running the command cargo check -p node-template-runtime gave me error
error: failed to parse manifest at `/Users/bashar/work/substrate/start/substrate-node-template/pallets/template/Cargo.toml`
Caused by:
feature `rename-dependency` is required
consider adding `cargo-features = ["rename-dependency"]` to the manifest
I added it and then I started getting this error:
error: no matching version `^2.0.0` found for package `codec`
location searched: registry `https://github.com/rust-lang/crates.io-index`
versions found: 0.0.0
required by package `frame-benchmarking-cli v3.0.0`
... which is depended on by `node-template v3.0.0 (/Users/bashar/work/substrate/start/substrate-node-template/node)`
I tried modifying the codec version to 2.0.1 with no luck. My setup
rustup 1.23.1
rustc 1.50.0
cargo 1.30.0
Any idea what I'm doing wrong?
UPDATE
I went back to the Create Your First Substrate Chain, which this tutorial is built on, started from scratch, which the Pallet tutorial is based on. And this time, after cloning the repository for first tutorial, cargo build --release failed with the same error feature rename-dependency is required.
This built fine the first time before I moved to the second tutorial. Which makes me think maybe a recent Mac update ruined something? I even tried uninstalling Rust and re-installing it, then installing a new template. Same thing

Error (object._d_arraysetlengthTImpl not found) while building D project on MacOS

I was trying to build existing Dlang project on my home Mac. But I am getting this error. I haven't find anything about it.
$ dub build
Running pre-generate commands for vibe-d:tls...
Performing "debug" build using dmd for x86_64.
tinyendian 0.2.0: target for configuration "library" is up to date.
dyaml 0.8.0: building configuration "library"...
/Library/D/dmd/src/phobos/std/uni.d(935,32): Error: object._d_arraysetlengthTImpl not found. The current runtime does not support resizing arrays, or the runtime is corrupt.
/Library/D/dmd/src/phobos/std/uni.d(968,32): Error: object._d_arraysetlengthTImpl not found. The current runtime does not support resizing arrays, or the runtime is corrupt.
/Library/D/dmd/src/phobos/std/uni.d(4064,18): Error: template instance std.uni.MultiArray!(BitPacked!(uint, 13LU), BitPacked!(bool, 1LU)).MultiArray.length!0LU error instantiating
/Library/D/dmd/src/phobos/std/uni.d(4312,37): instantiated from here: TrieBuilder!(bool, dchar, 1114112, sliceBits!(8LU, 21LU), sliceBits!(0LU, 8LU))
/Library/D/dmd/src/phobos/std/regex/internal/ir.d(26,14): instantiated from here: CodepointSetTrie!(13, 8)
/Library/D/dmd/src/phobos/std/uni.d(935,32): Error: object._d_arraysetlengthTImpl not found. The current runtime does not support resizing arrays, or the runtime is corrupt.
/Library/D/dmd/src/phobos/std/uni.d(968,32): Error: object._d_arraysetlengthTImpl not found. The current runtime does not support resizing arrays, or the runtime is corrupt.
/Library/D/dmd/src/phobos/std/uni.d(4064,18): Error: template instance std.uni.MultiArray!(BitPacked!(uint, 13LU), BitPacked!(bool, 1LU)).MultiArray.length!1LU error instantiating
/Library/D/dmd/src/phobos/std/uni.d(4312,37): instantiated from here: TrieBuilder!(bool, dchar, 1114112, sliceBits!(8LU, 21LU), sliceBits!(0LU, 8LU))
/Library/D/dmd/src/phobos/std/regex/internal/ir.d(26,14): instantiated from here: CodepointSetTrie!(13, 8)
dmd failed with exit code 1.
Can somebody pls help?
I am using these:
MacOS 10.15.4
DMD64 v2.091.1
DUB 1.20.1
Thx to Adam D. Ruppe.
It looks like there was a problem with previously installed version of dmd.
Solved by:
brew uninstall dub
brew uninstall dmd
delete /Library/D directory
brew install dmd
brew install dub

How to build a shared library for TensorFlow on Travis-CI

I'm assisting in building a Ruby-wrapper for TensorFlow. Obviously. we'd want to setup automatic test of the project and so I'm currently trying struggling to configure Travis-CI to build the project and run tests like I can on my own machine (OSX El Capitan).
My question is: What is the magic that needs to go in the .travis.yml-file to properly bazel build a shared lib (tensorflow.so) for TensorFlow?
As far as I can tell, I've successfully installed TensorFlow's dependencies, including Google's build tool Bazel, but Travis-CI still can't build. As of this writing the bazel build command fails with the message:
...
...
INFO: Building...
[1 / 13] Writing file external/gif_archive/libgif.so-2.params
[3 / 13] Compiling external/gif_archive/giflib-5.1.4/lib/egif_lib.c
ERROR: /home/travis/.cache/bazel/_bazel_travis/1a58902034d650eeef2a9da5b1248179/external/gif_archive/BUILD:14:1: C++ compilation of rule '#gif_archive//:gif' failed: namespace-sandbox failed: error executing command
(cd /home/travis/.cache/bazel/_bazel_travis/1a58902034d650eeef2a9da5b1248179/execroot/tensorflow && \
exec env - \
...
...
The command "bazel build --verbose_failures=1 #gif_archive//:gif" failed and exited with 1 during .
https://travis-ci.org/chrhansen/tensorflow.rb/builds/145716589
Note: I've noticed that the guys over at github.com/node-tensorflow/node-tensorflow successfully made this happen: https://travis-ci.org/node-tensorflow/node-tensorflow/builds
UPDATE: https://github.com/tensorflow/tensorflow/issues/3374
The issue has been solved (https://github.com/tensorflow/tensorflow/issues/3374), you should be able to build tensorflow with sandbox enabled.

Trouble compiling mono from source via cygwin on windows

I work off my i: drive
I've downloaded the following mono source file mono-2.11.2.tar.bz2
I've installed the windows version of mono v2.11.2 to "I:\Mono-2.11.2"
I installed cygwin as per the following instructions found on the following webpage http://shana.worldofcoding.com/en/mono_cygwin_tutorial.html
I replaced the "make.exe" with the one from the mono website as per instruction. I had to get one more file "cygintl-2.dll" which resides in cygwin package libintl2/libintl2-0.12.1-3
I added the following my .bashrc file. I had to change "c/Mono-2.11.2/bin" to "i/Mono-2.11.2/bin"
PATH=.:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/i/Mono-2.11.2/bin
PKG_CONFIG_PATH=.:/lib/pkgconfig:/cygdrive/i/Mono-2.11.2/lib/pkgconfig
LD_LIBRARY_PATH=.:/usr/local/lib:/usr/lib:/lib:/cygdrive/i/Mono-2.11.2/lib
export PATH PKG_CONFIG_PATH LD_LIBRARY_PATH
I placed my mono source under the folder specified: /usr/src/mono/
So my dirs looks like:
i:
i:\cygwin\
i:\cygwin\usr\src\mono
i:\cygwin\usr\src\mono\mono
i:\cygwin\usr\src\mono\mcs etc etc
i:\Mono-2.11.2\bin etc
Now the instructions says I must change dirs to /usr/src/mono/mono and run "./autogen.sh --prefix=/usr/local" from the cygwin terminal
However that doesnt work. Running the above command from /usr/src/mono/ works fine.
Now heres the problem. The next instruction is to run "make". However this comes up with :
$ make
make: *** No targets specified and no makefile found. Stop.
I even tried running it from the /usr/src/mono/mono dir. Still no luck.
Can someone please suggest what I should do to be able to build the mono source on windows 7?
Update:
I needed to install the **gnu c++ compiler (g++)**. I just ran the cygwin setup again, searched for g++ and installed that. The autogen.sh ran to completion
The last lines of ./autogen.sh --prefix=/usr/local output should
look like bellow with Now type make to compile at the end. And it
generats Makefile in the same directory.
I think in your case ./autogen.sh failed. You can keep a log file
and check what it is complaining about.
./autogen.sh --prefix=/usr/local 2>&1 | tee autogen.log
More info: http://en.wikipedia.org/wiki/GNU_build_system
The end of the ./autogen.sh ouptut:
config.status: executing quiet-libtool commands
config.status: executing default commands
mcs source: mcs
olive source:
Engine:
GC: sgen and bundled Boehm GC with typed GC and parallel mark
TLS: __thread
SIGALTSTACK: yes
Engine: Building and using the JIT
oprofile: no
BigArrays: no
DTrace: no
LLVM Back End: no (dynamically loaded: no)
Libraries:
Moon Profile: no (boehm)
MonoDroid: no
MonoTouch: no
Mobile: no
JNI support: IKVM Native
libgdiplus: assumed to be installed
zlib: system zlib
Now type `make' to compile

Error building openssl-sys crate on Windows

I am trying to compile a Rust program on Windows, but I get this error message:
Compiling openssl-sys v0.6.4
failed to run custom build command for `openssl-sys v0.6.4`
[...]
failed to execute command: The system couldn't find the specified file. (os error 2)
Is `gcc` not installed? (see https://github.com/alexcrichton/gcc-rs#windows-notes for help)
--- stderr
thread '<main>' panicked at 'explicit panic', C:\Users\User\.cargo\registry\src\github.com-0a35038f75765ae4\gcc-0.3.12\src\lib.rs:510
Cargo compiled every other package without problem, but it can't compile the openssl package.
I searched for help with this specific error and found a github issue for hyperium. The first answer references the openssl building guide for Windows.
I don't understand exactly how I have to build openssl in Windows. I installed MinGW and added the bin path to the global PATH variable, so gcc is reachable, but this did not solve the error.
I use Rust 1.2 and Cargo 0.4.0. My project is an example for a Telegram API wrapper.
1) Download ssl
Installs Win32 OpenSSL v1.0.2d
Install it here: C:\OpenSSL-Win32,C:\OpenSSL-Win32\include,C:\OpenSSL-Win32\lib
2) Install MinGW,and add system env path ,,C:\MinGW\bin,important,MinGW's installed path contain char 'MinGW '
3) cmd run env OPENSSLLIBDIR=C:/OpenSSL-Win32/lib OPENSSLINCLUDEDIR=C:/OpenSSL-Win32/include cargo build

Resources