bazel build failed after updated command line tool in Mac - xcode

Recently I updated command line tool in my Mac as required, but after that, my bazel build is not working, can you help advise how to fix it? thanks in advance
ERROR: /private/var/tmp/_bazel_me/57d181a2c7179aa428276012ffbf756a/external/com_google_protobuf/BUILD:135:1: undeclared inclusion(s) in rule '#com_google_protobuf//:protobuf':
this rule is missing dependency declarations for the following files included by 'external/com_google_protobuf/src/google/protobuf/stubs/mathlimits.cc':
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/stddef.h'
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/__stddef_max_align_t.h'
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/float.h'
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/stdint.h'
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/stdarg.h'
'/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include/limits.h'
Target //java/com/myproject/target:build-deployment failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 5.268s, Critical Path: 2.42s
FAILED: Build did NOT complete successfully

Similar issue to: bazel "undeclared inclusion(s)" errors after updating gcc
(Resolved with bazel clean --expunge)

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

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

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

Getting wrong when installing tensorflow from source

I had been trying to install tensorflow for a few day. However, cuda 7.5 is the version that tensorflow r0.10.0 supports default. So I can only install it from source. But I came after the following problem which bother me a lot.
.....
INFO: Reading options for 'clean' from /home/lhx/tensorflow-r0.10/tools/bazel.rc:
Inherited 'build' options: --force_python=py2 --host_force_python=py2 --python2_path=/usr/bin/python --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define PYTHON_BIN_PATH=/usr/bin/python --spawn_strategy=standalone --genrule_strategy=standalone
Unrecognized option: --host_force_python=py2
ERROR: /home/lhx/tensorflow-r0.10/WORKSPACE:18:6: First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path..
ERROR: /home/lhx/tensorflow-r0.10/WORKSPACE:22:6: First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path..
ERROR: WORKSPACE file could not be parsed.
ERROR: package contains errors: third_party/boringssl.
ERROR: no such package 'external': Package 'external' contains errors.
Configuration finished
I just can't figure out what is going wrong and I have been trying for so long.
I experienced similar errors when my bazel was too outdated. You can try newer bazel version.

how to build mongodb-cxx-driver in win

I followed instruction on https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/, but I blocked at STEP4, it says:
CMake Error at CMakeLists.txt:135 (generate_export_header):
Unknown CMake command "generate_export_header".
I found this command exists for a long time. I tried cmake3.7rc1 and rc3, but error all the time.
How can I build bsoncxx?
just go to that CMakeLists.txt line 134 and add a new line with following code
include(GenerateExportHeader)
maybe it was included by some dependency in older versions

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.

Resources