Hi I'm trying to use opencv in my Node.js project so I decided to use opencv4nodejs. I tried to install this module by npm and i discovered some errors related to absence of cmake on my computer. So I decided to install cmake by brew. But after this process when I'm trying to install this module the following errors occurs:
MacBook-Air-Micha:webcam-myidea michalkukielka$ npm install opencv4nodejs
> opencv-build#0.1.8 install /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build
> node ./install.js
info No package.json in folder.
info install if you want to use an own OpenCV installation set OPENCV4NODEJS_DISABLE_AUTOBUILD
info readAutoBuildFile file does not exists: /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json
info install failed to find auto-build.json: /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json
info install
info install running install script...
info install
info install opencv version: 3.4.6
info install with opencv contrib: yes
info install custom build flags:
info install
info install executing: git --version
info install git --version: git version 2.20.1
info install
info install executing: cmake --version
info install cmake --version: cmake version 3.15.3
info install
info install CMake suite maintained and supported by Kitware (kitware.com/cmake).
info install
info install installing opencv version 3.4.6 into directory: /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv
Cloning into 'opencv_contrib'...
remote: Enumerating objects: 2160, done.
remote: Counting objects: 100% (2160/2160), done.
remote: Compressing objects: 100% (1916/1916), done.
remote: Total 2160 (delta 365), reused 1101 (delta 134), pack-reused 0
Receiving objects: 100% (2160/2160), 50.82 MiB | 1.57 MiB/s, done.
Resolving deltas: 100% (365/365), done.
Note: checking out 'f26c98365da6af93cb5e49397b571190fca7bb55'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
Checking out files: 100% (1780/1780), done.
Cloning into 'opencv'...
remote: Enumerating objects: 7328, done.
remote: Counting objects: 100% (7328/7328), done.
remote: Compressing objects: 100% (6260/6260), done.
remote: Total 7328 (delta 1166), reused 3907 (delta 692), pack-reused 0
Receiving objects: 100% (7328/7328), 81.33 MiB | 1.62 MiB/s, done.
Resolving deltas: 100% (1166/1166), done.
Note: checking out '33b765d7979fd8a6038026aa44f6ff1a9c082b7b'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
Checking out files: 100% (6080/6080), done.
info install running cmake /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/opencv,-DCMAKE_INSTALL_PREFIX=/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build,-DCMAKE_BUILD_TYPE=Release,-DBUILD_EXAMPLES=OFF,-DBUILD_DOCS=OFF,-DBUILD_TESTS=OFF,-DBUILD_PERF_TESTS=OFF,-DBUILD_JAVA=OFF,-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr,-DBUILD_opencv_apps=OFF,-DBUILD_opencv_aruco=OFF,-DBUILD_opencv_bgsegm=OFF,-DBUILD_opencv_bioinspired=OFF,-DBUILD_opencv_ccalib=OFF,-DBUILD_opencv_datasets=OFF,-DBUILD_opencv_dnn_objdetect=OFF,-DBUILD_opencv_dpm=OFF,-DBUILD_opencv_fuzzy=OFF,-DBUILD_opencv_hfs=OFF,-DBUILD_opencv_java_bindings_generator=OFF,-DBUILD_opencv_js=OFF,-DBUILD_opencv_img_hash=OFF,-DBUILD_opencv_line_descriptor=OFF,-DBUILD_opencv_optflow=OFF,-DBUILD_opencv_phase_unwrapping=OFF,-DBUILD_opencv_python3=OFF,-DBUILD_opencv_python_bindings_generator=OFF,-DBUILD_opencv_reg=OFF,-DBUILD_opencv_rgbd=OFF,-DBUILD_opencv_saliency=OFF,-DBUILD_opencv_shape=OFF,-DBUILD_opencv_stereo=OFF,-DBUILD_opencv_stitching=OFF,-DBUILD_opencv_structured_light=OFF,-DBUILD_opencv_superres=OFF,-DBUILD_opencv_surface_matching=OFF,-DBUILD_opencv_ts=OFF,-DBUILD_opencv_xobjdetect=OFF,-DBUILD_opencv_xphoto=OFF,-DWITH_VTK=OFF,-DOPENCV_ENABLE_NONFREE=ON,-DOPENCV_EXTRA_MODULES_PATH=/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/opencv_contrib/modules
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
CMake Error at CMakeLists.txt:153 (message):
CMake fails to determine the bitness of the target platform.
Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.
-- Configuring incomplete, errors occurred!
See also "/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build/CMakeFiles/CMakeError.log".
ERR! child process exited with code 1 (for more info, set '--loglevel silly')
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build#0.1.8 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build#0.1.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michalkukielka/.npm/_logs/2019-09-07T05_38_02_479Z-debug.log
As I understand there are some new problems with cmake but I cant find solutions for.
Could you help me finish the proces of installation opencv4nodejs?
At the first: Native node modules are built via node-gyp, which already comes with npm by default. However, node-gyp requires you to have python installed. If you are running into node-gyp specific issues have a look at known issues with node-gyp first.
Important note: node-gyp won't handle whitespaces properly, thus make sure, that the path to your project directory does not contain any whitespaces. Installing opencv4nodejs under "C:\Program Files\some_dir" or similar will not work and will fail with: "fatal error C1083: Cannot open include file: 'opencv2/core.hpp'"!**
On Windows you will furthermore need Windows Build Tools to compile OpenCV and opencv4nodejs. If you don't have Visual Studio or Windows Build Tools installed, you can easily install the VS2015 build tools:
npm install --global windows-build-tools
At the second: You should check CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.
CMake doesn't (always) listen to CC and CXX. Instead use CMAKE_C_COMPILER and CMAKE_CXX_COMPILER:
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ ...
See also the documentation.
Alternatively, you can provide a toolchain file, but that might be overkill in this case.
finally: Under OSX we can simply install OpenCV via brew:
brew update
brew install opencv#4
brew link --force opencv#4
Related
i try to get pugixml running in github actions. And i would be happy with any solution that is working...
I added the download to the cmake.yml
run: sudo apt-get update && sudo apt-get install libsystemd-dev libpugixml-dev
Ubuntu inside github action is installing 1.10-1:
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml1v5 amd64 1.10-1 [89.9 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml-dev amd64 1.10-1 [105 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libsystemd-dev amd64 245.4-4ubuntu3.11 [246 kB]
On my private machine i use Debian testing, where Version: 1.11.4-1 of pugixml is installed.
CMake now tells, that it could not find version 1.10 or higher. It looks like ubuntu's version tag is not correct (?). Is there a way to debug inside these github-actions?
CMake Deprecation Warning at plog/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Checking for module 'libsystemd'
-- Found libsystemd, version 245
CMake Error at CMakeLists.txt:20 (find_package):
Could not find a configuration file for package "pugixml" that is
-- Configuring incomplete, errors occurred!
compatible with requested version "1.10".
See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeOutput.log".
See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeError.log".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown
/lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown
I solved it by using vcpkg to install pugixml:
- name: Install pugixml via vcpkg
run: sudo vcpkg install pugixml && sudo vcpkg integrate install
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
I am trying to build TensorFlow 2.4.1 C++ API on Windows 10 and I am having issues.
What I've done so far:
Download TensorFlow Source from the official repo
https://github.com/tensorflow/tensorflow
and switched to the official v2.4.1 tag
Download and install Python 3.6.8 x64
Created a virtual env with python 3.6.8
Created and installed requirements.txt based on the data here
Download and install CUDA 11.0 and cuDNN v8.0.4.30 (for CUDA 11)
Downloaded and installed msys2 and set it's location in PATH
Download and install bazel (3.1.0) as it is the most recent entry here
Then I run the configuration process with python configure.py
I configure for C++ build (tensorflow_cc) with GPU support
Here I had some problem that apparently during the config process windows-style backslashes are accepted as a valid input, but then when you actually run bazel compilation they cause problems, so I reran my configuration to provide linux-style backslashes. Thus CUDA and cuDNN were successfully detected and compilation started.
The full contents of my .tf_configure.bazelrc are below
build --action_env PYTHON_BIN_PATH="D:/code/sdk/tensorflow/venv/Scripts/python.exe"
build --action_env PYTHON_LIB_PATH="D:/code/sdk/tensorflow/venv/lib/site-packages"
build --python_path="D:/code/sdk/tensorflow/venv/Scripts/python.exe"
build --config=xla
build --action_env TF_CUDA_VERSION="11.0"
build --action_env TF_CUDNN_VERSION="8.0.4"
build --action_env TF_CUDA_PATHS="C:/Program Files/NVIDIA GPU Computing
Toolkit/CUDA/v11.0,D:/code/sdk/cudnn-11.0-windows-x64-v8.0.4.30/cuda"
build --action_env CUDA_TOOLKIT_PATH="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0"
build --action_env TF_CUDA_COMPUTE_CAPABILITIES="5.0"
build --config=cuda
build:opt --copt=/arch:AVX
build:opt --host_copt=/arch:AVX
build:opt --define with_default_optimizations=true
build --define=override_eigen_strong_inline=true
test --flaky_test_attempts=3
test --test_size_filters=small,medium
test:v1 --test_tag_filters=-benchmark-test,-no_oss,-no_windows,-no_windows_gpu,-no_gpu,-oss_serial
test:v1 --build_tag_filters=-benchmark-test,-no_oss,-no_windows,-no_windows_gpu,-no_gpu
test:v2 --test_tag_filters=-benchmark-test,-no_oss,-no_windows,-no_windows_gpu,-no_gpu,-oss_serial,-
v1only
test:v2 --build_tag_filters=-benchmark-test,-no_oss,-no_windows,-no_windows_gpu,-no_gpu,-v1only
build --action_env TF_CONFIGURE_IOS="0"
About 20 minutes into the compilation however it failed with the following error:
ERROR: D:/code/sdk/tensorflow/tensorflow/stream_executor/cuda/BUILD:366:1: C++ compilation of rule '//tensorflow/stream_executor/cuda:cudnn_stub' failed (Exit 2): python.exe failed: error executing command
And the reason the command fails to execute is
bazel-out/x64_windows-opt/bin/external/local_config_cuda/cuda/_virtual_includes/cudnn_header\third_party/gpus/cudnn/cudnn.h(61): fatal error C1083: Cannot open include file: 'cudnn_ops_infer.h': No such file or directory
And here I am wondering what is going on? I already provided a path to cuDNN, but apparently bazel doesn't really know about it, even though it previously acknowledged that the path I have provided is correct. Am I missing some environment variable that I need to set to instruct where cuDNN is?
Has anyone built TF C++ v2.4.1 on Windows? There is so little information online, even the official page says nothing about Windows builds. It's only Linux and Mac...
As I was running out of ideas I decided to go take a look at the Bazel build scripts for CUDA
In <REPO>\tensorflow\third_party\gpus\cuda_configure.bzl I saw that cuDNN path is read from env variable CUDNN_INSTALL_PATH
and if not present it will default to /usr/local/include?
Anyway, tried set CUDNN_INSTALL_PATH=D:/code/sdk/cudnn-11.0-windows-x64-v8.0.4.30/cuda and WOOHOO It compiled!
(Pro Tip: Set the env var without any quotes and with linux-style slashes...)
I was trying to build flann from source in Windows-10 using cmake. During the installation process it says it cannot find liblz4.
I tried two method :
1) So I downloaded the prebuild lz4 from here (https://github.com/lz4/lz4/releases) and placed the C:\XXXX\Downloads\lz4_v1_9_1_win64\dll to my env path.
2) I used vcpkg to install lz4 first. Then did
C:\source\flann\build> cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\XXXXXX\source\vcpkg\scripts\buildsystems\vcpkg.cmake -G "Visual Studio 15 2017 Win64".
None of the above two method worked. I still get cannot find liblz4 error.
-- Found PkgConfig: C:/XXXXXX/Downloads/cmake-3.13.3-win64-x64/bin/pkg-config.exe (found version "0.26") -- Checking for module 'liblz4' -- No package 'liblz4' found CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPkgConfig.cmake:452 (message): A required package was not found Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.13/Modules/FindPkgConfig.cmake:622 (_pkg_check_modules_internal) CMakeLists.txt:150 (pkg_check_modules) -- Configuring incomplete, errors occurred! See also "C:/XXXXXXX/source/flann/build/CMakeFiles/CMakeOutput.log".
Did you try to do as follows?(https://github.com/lz4/lz4)
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install lz4
I have cloned this repository https://github.com/grpc/grpc.git for installing the grpc. I want to use the framework with C++ programming so I followed the instructions given in folder src/cpp.
To build grpc for C++ from the source (in OpenSUSE) there are some pre-requisites given in this link
$ [sudo] apt-get install build-essential autoconf libtool pkg-config
As mentioned, to build from source and run tests, one needs
$ [sudo] apt-get install libgflags-dev libgtest-dev
$ [sudo] apt-get install clang libc++-dev
I could not find any build-essential, libgflags-dev and libgtest-dev. I don't know whether this is the reason for not getting grpc installed.
Later,
I have manually installed protocol buffer compiler protoc before running the make.
When I run make in the grpc root directory. I get this error
[PROTOC] Generating protobuf CC file from src/proto/grpc/channelz/channelz.proto
make: protoc: Command not found
make: *** [Makefile:2601: /home/rohan/Downloads/grpc/gens/src/proto/grpc/channelz/channelz.pb.cc] Error 127
Unable to figure out why this error is showing as I already have installed protoc. Is some linking problem, then please share how to solve it. I am new to Linux so I really am a little bit hesitant to change and env file or some make file by my own.
Please suggest some help. Thanks for your time.
I have resolved this problem by installing protocol buffer compiler properly.
The important step which I forgot to do earlier is to update the submodules with git submodule update --init --recursive when you are building protoc with git repository.
The steps for C++ version are mentioned at this link.
Thanks,
I want to build static Rust executables with a customized version of musl. As a first step, I'm making myself familiar with Rust's build system.
I took the slightly outdated docker-rust-musl GitHub project and updated URLs that went out-of-date. Everything seems to work well with the build, but when I want to compile with x86_64-unknown-linux-musl the compiler doesn't find the musl std crate:
root#beb234fba4af:/build# cat example.rs
fn main() { println!("hi!"); panic!("failed"); }
root#beb234fba4af:/build# rustc --target=x86_64-unknown-linux-musl example.rs
error[E0463]: can't find crate for `std`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
error: aborting due to previous error
In fact, /usr/local/lib/rustlib/ only contains the x86_64-unknown-linux-gnu directory, even though output during the build indicates that x86_64-unknown-linux-musl is built:
[...]
Building stage2 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-musl)
[...]
However, when it comes to the installation step x86_64-unknown-linux-gnu is nowhere to be seen:
[...]
Install std stage2 (x86_64-unknown-linux-gnu)
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
std is standing at the ready.
Install rustc stage2 (x86_64-unknown-linux-gnu)
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
Rust is ready to roll.
Build completed in 0:31:07
What do I have to do to install the x86_64-unknown-linux-musl Rust standard library?
Progress:
Digging through the build environment revealed that make all builds the Rust std library with musl but the subsequent make install step does not install it.
We have a temporary fix in the build.sh script of the previously mentioned docker image.
It is unclear whether that is an issue of the build environment or of its usage.
The issue is known to the Rust developers. No eta of the fix, however.