OpenCV WebAssembly - c++

I try to run this tutorial, http://videocortex.io/2017/opencv-web-app/, to build and try out OpenCV WebAssembly. But I can´t get over step "The Build System" I´ve build emscripten 1.38.21, installed Python 2.7.5.3_64bit and CMAKE 3.13.2 but get an error in the end:
Did I missed something?
When I run emcc -v I get some error´s also:
WARNING:root:LLVM version appears incorrect (seeing "6.0", expected
"3.7") ERROR:root:Emscripten, llvm and clang versions do not match,
this is dangerous (1.35.0, "1.38.21", "1.38.21") ERROR:root:Make sure
to use the same branch in each repo, and to be up-to-date on each. See
http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
INFO:root:(Emscripten: Running sanity checks) emcc (Emscripten
gcc/clang-like replacement + linker emulating GNU ld) 1.35.0 clang
version 6.0.1 (emscripten 1.38.21 : 1.38.21) Target:
x86_64-pc-windows-msvc Thread model: posix InstalledDir:
D:\Repositories\emsdk\clang\e1.38.21_64bit WARNING:root:LLVM version
appears incorrect (seeing "6.0", expected "3.7")
ERROR:root:Emscripten, llvm and clang versions do not match, this is
dangerous (1.35.0, "1.38.21", "1.38.21") ERROR:root:Make sure to use
the same branch in each repo, and to be up-to-date on each. See
http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
INFO:root:(Emscripten: Running sanity checks)

Someone has successfully compiled OpenCV to WebAssembly. You can visit the GitHub repository and follow the steps:
Get the source code:
git clone https://github.com/ucisysarch/opencvjs.git
cd opencvjs
git clone https://github.com/opencv/opencv
cd opencv
git checkout 3.1.0
Install Emscripten:
./emsdk update
./emsdk install sdk-incoming-64bit --shallow
./emsdk activate sdk-incoming-64bit
source ./emsdk_env.sh
Build OpenCV to WebAssembly.
python make.py --wasm

Related

Build GDB for ESP32 and QEMU

I tried to build a gdb for esp32 that works with qemu, but after many attempt, I didn't manage. All my attempts leaded me to the following error message after connecting to the remote target: Remote 'g' packet reply is too long.
Right now I am using the prebuilt version from Ebiroll: https://github.com/Ebiroll/qemu_esp32/blob/master/bin/xtensa-esp32-elf-gdb
but I would like to use a newer gdb version than 7.10, did anyone had success with this?
Here is how I built gdb:
git clone --depth 1 --branch esp-2021r2-gdb https://github.com/espressif/binutils-gdb.git
cd binutils-gdb
mkdir -p build
cd build
../configure --without-guile --host=x86_64-pc-linux-gnu --target=xtensa-esp32-elf --disable-werror
make
make install
(note from this branch the patch to apply from the Zephyr project, as described here https://github.com/Ebiroll/qemu_esp32#qemu-esp32, seems to already be included)
I also tried by applying the following patch (no success):
curl -L https://raw.githubusercontent.com/Ebiroll/gdb/master/gdb/xtensa-config.c.qemu --output binutils-gdb/gdb/xtensa-config.c
or patching qemu to fix the value of num_regs (tried 104 and 172, also no success).
Espressif's qemu wiki mentions setting an environment variable to only list the core registers:
export QEMU_XTENSA_CORE_REGS_ONLY=1
This needs to be set in the environment from where qemu will be executed.
My recommendation is to use both qemu and gdb (from the Esp32 tool chain) as provided by Espressif. I have recently used this combination with success. The latest release uses gdb 9.2.

How to install Boost.Python using homebrew (on OSX)?

I'm trying to install Robot Operating System (ROS) Melodic on my mac (macOS 11.5.1). While compiling cv_bridge package, the compiler spit out an error related to the Boost.Python:
$ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH=$HOME/ros_catkin_ws/install_isolated/lib -DCMAKE_PREFIX_PATH="/usr/local/Cellar/qt#5/5.15.2;${HOME}/ros_catkin_ws/install_isolated" -DCMAKE_CXX_STANDARD=17 --pkg cv_bridge
.......... (some log messages are skipped)
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /Users/yj/ros_catkin_ws/devel_isolated/cv_bridge
-- Using CMAKE_PREFIX_PATH: /usr/local/Cellar/qt#5/5.15.2;/Users/yj/ros_catkin_ws/install_isolated
-- This workspace overlays: /Users/yj/ros_catkin_ws/install_isolated
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2 (found suitable version "2.7.16", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
-- Using default Python package layout
-- Found PY_em: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/em.pyc
-- Using empy: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/em.pyc
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /Users/yj/ros_catkin_ws/build_isolated/cv_bridge/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: /Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.16")
CMake Error at /usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake:141 (find_package):
Could not find a package configuration file provided by "boost_python"
(requested version 1.76.0) with any of the following names:
boost_pythonConfig.cmake
boost_python-config.cmake
Add the installation prefix of "boost_python" to CMAKE_PREFIX_PATH or set
"boost_python_DIR" to a directory containing one of the above files. If
"boost_python" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake:258 (boost_find_component)
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/FindBoost.cmake:594 (find_package)
CMakeLists.txt:9 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/yj/ros_catkin_ws/build_isolated/cv_bridge/CMakeFiles/CMakeOutput.log".
See also "/Users/yj/ros_catkin_ws/build_isolated/cv_bridge/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "./src/catkin/bin/catkin_make_isolated", line 169, in <module>
main()
File "./src/catkin/bin/catkin_make_isolated", line 164, in main
override_build_tool_check=opts.override_build_tool_check,
File "./src/catkin/bin/../python/catkin/builder.py", line 1071, in build_workspace_isolated
_print_build_error(package, e)
File "./src/catkin/bin/../python/catkin/builder.py", line 810, in _print_build_error
cprint("#{rf}#!<==#| Failed to process package '#!#{bf}" + package.name + "#|': \n " + e_msg)
File "./src/catkin/bin/../python/catkin/builder.py", line 128, in cprint
print(fmt(msg), end=end)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/catkin_pkg/terminal_color.py", line 126, in fmt
return t.substitute(_ansi) + ansi('reset')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 176, in substitute
return self.pattern.sub(convert, self.template)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 173, in convert
self._invalid(mo)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 146, in _invalid
(lineno, colno))
ValueError: Invalid placeholder in string: line 2, col 437
It looks that the CMake was attempting to find the Boost.Python module, but it couldn't. I never installed it. So, I typed the following command to install the Boost.Python:
$ brew install boost-python
The homebrew responded:
$ brew install boost-python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (osrf/simulation and homebrew/core).
==> New Formulae
cruft pari-galdata pari-seadata-big
eigenpy pari-galpol singularity
newrelic-infra-agent pari-seadata spot
==> Updated Formulae
Updated 43 formulae.
Error: boost-python has been disabled because it does not build!
It looks not possible to install the boost-python formula through homebrew. Then, how can I install it?
This is a short brief of my system configuration:
OS: macOS Big Sur (11.5.1)
Boost library is installed by homebrew (brew install boost)
boost version: 1.76.0
python version: 2.7.16
cmake version: 3.21.1
Edit 1
As #BTables said, I tried this command: brew install boost --with-python
It looks removed. My homebrew version is 3.2.8.
$ brew install boost --with-python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (osrf/simulation and homebrew/core).
==> Updated Formulae
Updated 121 formulae.
Usage: brew install [options] formula|cask [...]
Install a formula or cask. Additional options specific to a formula may be
appended to the command.
Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory.
-f, --force Install formulae without checking for
previously installed keg-only or
non-migrated versions. When installing
casks, overwrite existing files (binaries
and symlinks are excluded, unless
originally from the same cask).
-v, --verbose Print the verification and postinstall
steps.
--formula, --formulae Treat all named arguments as formulae.
--env Disabled other than for internal Homebrew
use.
--ignore-dependencies An unsupported Homebrew development flag to
skip installing any dependencies of any
kind. If the dependencies are not already
present, the formula will have issues. If
you're not developing Homebrew, consider
adjusting your PATH rather than using this
flag.
--only-dependencies Install the dependencies with specified
options but do not install the formula
itself.
--cc Attempt to compile using the specified
compiler, which should be the name of the
compiler's executable, e.g. gcc-7 for GCC
7. In order to use LLVM's clang, specify
llvm_clang. To use the Apple-provided
clang, specify clang. This option will
only accept compilers that are provided by
Homebrew or bundled with macOS. Please do
not file issues if you encounter errors
while using this option.
-s, --build-from-source Compile formula from source even if a
bottle is provided. Dependencies will still
be installed from bottles if they are
available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to
run brew test formula.
--HEAD If formula defines it, install the HEAD
version, aka. main, trunk, unstable,
master.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will only be checked for updates when a new
stable or development version has been
released.
--keep-tmp Retain the temporary files created during
installation.
--build-bottle Prepare the formula for eventual bottling
during installation, skipping any
post-install steps.
--bottle-arch Optimise bottles for the specified
architecture rather than the oldest
architecture supported by the version of
macOS the bottles are built on.
--display-times Print install times for each formula at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise
determine how to turn the software package
into a Homebrew package.
-g, --git Create a Git repository, useful for
creating patches to the software.
--cask, --casks Treat all named arguments as casks.
--[no-]binaries Disable/enable linking of helper
executables (default: enabled).
--require-sha Require all casks to have a checksum.
--[no-]quarantine Disable/enable quarantining of downloads
(default: enabled).
--skip-cask-deps Skip installing cask dependencies.
--appdir Target location for Applications (default:
/Applications).
--colorpickerdir Target location for Color Pickers (default:
~/Library/ColorPickers).
--prefpanedir Target location for Preference Panes
(default: ~/Library/PreferencePanes).
--qlplugindir Target location for QuickLook Plugins
(default: ~/Library/QuickLook).
--mdimporterdir Target location for Spotlight Plugins
(default: ~/Library/Spotlight).
--dictionarydir Target location for Dictionaries (default:
~/Library/Dictionaries).
--fontdir Target location for Fonts (default:
~/Library/Fonts).
--servicedir Target location for Services (default:
~/Library/Services).
--input-methoddir Target location for Input Methods (default:
~/Library/Input Methods).
--internet-plugindir Target location for Internet Plugins
(default: ~/Library/Internet Plug-Ins).
--audio-unit-plugindir Target location for Audio Unit Plugins
(default:
~/Library/Audio/Plug-Ins/Components).
--vst-plugindir Target location for VST Plugins (default:
~/Library/Audio/Plug-Ins/VST).
--vst3-plugindir Target location for VST3 Plugins (default:
~/Library/Audio/Plug-Ins/VST3).
--screen-saverdir Target location for Screen Savers (default:
~/Library/Screen Savers).
--language Comma-separated list of language codes to
prefer for cask installation. The first
matching language is used, otherwise it
reverts to the cask's default language. The
default value is the language of your
system.
-q, --quiet Make some output more quiet.
-h, --help Show this message.
Error: invalid option: --with-python
$ brew --version
Homebrew 3.2.8
Homebrew/homebrew-core (git revision 6614f2a9b0; last commit 2021-08-18)
I was facing the same issue, I tried the following command and I worked:
$ brew install boost-python3
Don't know if ROS's cmake is set up to detect/use it since your other detections are for python2, but there is a another cask for python3: brew install boost-python3
Run brew install boost --with-python then do brew install boost-python.
I would also like to warn you that running Melodic(or really any OSX release of ROS) isn't something I would recommend. Specifically with OSX, the build is pretty experimental and not exactly stable or complete.
Update 2022
As #minari kotori mentioned, brew install boost --with-python does not build.
However, you can try building both boost and boost-python from source:
brew install --build-from-source -vd boost boost-python
If this doesn't work, you can try if boost_python3 solves your problem:
brew install boost
and then
brew install boost_python3.
Worked for me on macOS Monterey.

Makefile error raspberry-pi 3

I have an issue with Codelite compilation, running on raspbian jessie - these are the (known) steps I have taken to produce it.
First I installed Codelite with apt-get install Codelite, then produced a c++ project.
When running build project I get the error:
/bin/sh -c ' -j 4 -e -f Makefile'
/bin/sh: 1: -j: not found
0 errors, 0 warnings
I note that this error has been found and corrected previously, through running a different version of Codelite from 6.1.1 (that which apt-get installs). I therefore found the updated version of armhf .deb codelite from the rasbian archive with gdebi-gtk. However the updated version (9.1.1) produces the following error (install attempt with the graphical debian):
Error: Dependency is not satisfiable: libclang 1-3.8 (>=3.2)
I do not understand why the package manager cannot update these packages - do they not exist for the pi? I ran the manager as root, so I do not think it is a permissions issue.
EDIT 1:
Thank you for that Fabre. My Enviromental Variables file now looks like this:
CodeLiteDir=/usr/share/codelite
export MAKE=make
I still get the same error however.

RabbitMQ C++ client for old Debian

I have an old Debian (Lenny), on which I develop an application that should connect to RabbitMQ.
I downloaded the official C++ client rabbitmq-c-0.8.0 from https://github.com/alanxz/rabbitmq-c/releases/tag/v0.8.0 , but unfortunately, I can't compile it on my old Debian:
wget https://github.com/alanxz/rabbitmq-c/archive/v0.8.0.tar.gz
tar zxvf v0.8.0.tar.gz
autoreconf -i
Result:
autoreconf -i
/usr/share/aclocal/libmcrypt.m4:17: warning: underquoted definition of AM_PATH_LIBMCRYPT
/usr/share/aclocal/libmcrypt.m4:17: run info '(automake)Extending aclocal'
/usr/share/aclocal/libmcrypt.m4:17: or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
Makefile.am:6: Libtool library used but `LIBTOOL' is undefined
Makefile.am:6: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
Makefile.am:6: to `configure.ac' and run `aclocal' and `autoconf' again.
Makefile.am:6: If `AC_PROG_LIBTOOL' is in `configure.ac', make sure
Makefile.am:6: its definition is in aclocal's search path.
autoreconf2.50: automake failed with exit status: 1
Version of automake I have (and I can't upgrade it): 1:1.10.1-3
Version of libtool I have (and I can't upgrade it as well): 1.5.26-4+lenny1
Does anyone know how to build the RabbitMQ client on the old OS I use?
Many thanks!!!
Eventually, the best solution was to move to ubuntu 14+

Protobuf 3.0.0-alpha-1 not compiling on windows

I'm trying to compile protobuf 3.0.0 alpha 1 on Windows using MinGW 4.9.2 & MSYS.
According to the instructions I'm supposed to:
./configure
make
make check
make install
I added --prefix=/c/path/to/mingw to configure (How to build Google's protobuf in Windows using MinGW?) but it didnt help.
It fails at make with the message:
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/Markus/protobuf-3.0.0-alpha-
1/missing aclocal-1.14 -I m4
/home/Markus/protobuf-3.0.0-alpha-1/missing: line 81: aclocal-1.14: command not
found
WARNING: 'aclocal-1.14' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [aclocal.m4] Error 127
I've tried installing Automake but it doesnt come with aclocal.
Also today at work i managed to get it working on the first try with a bare MinGW & MSYS.
It looks like you need to install autoconf (which is separate from automake, though they are often used together). You may also need to install libtool.