opencv-3.3.0 Stops compiling at 58% - opencv

I'm compiling opencv for Rasbian Stretch, running on the Pi 3b.
It compiled all the way to 58% before outputting this error.
Anybody familiar with the error and how to correct it?
[58%]Linking CXX shared library ../../lib/libopencv_datasets.so
CMakeFiles/opencv_datasets.dir/src/gr_chalearn.cpp.o: file not recognized: File truncated
collect2: error: id returned 1 exit status
modules/datasets/CMakeFiles/opencv_datasets.dir/build.make:858: recipe for target 'lib/libopencv_datasets.so.3.3.0' failed
make[2]: * [lib/libopencv_datasets.so.3.3.] Error 1
CMakeFiles/Makefile2:14481: recipe for target 'modules/datasets/CmakeFiles/opencv_datasets.dir/all' failed
make[1]: * [modules/datasets/CMakeFiles/opencv_datasets.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make *** [all] Error 2

I solved this issue by downloading opencv-3.4 and running make with -j4

Building OpenCV binaries on officially supported Ubuntu/Linux based operating systems has always been a little more troublesome than normal images. One of the core reasons is the visual graphics (mostly, but not limited to) used by these distributions are different than general ones. You'll find some similar errors while installing it on LXDE based Ubuntu distributions, for the same reason. I spotted different errors for the same method on Ubuntu 18.04 Gnome, Ubuntu 18.04 LXDE, Ubuntu 16.04 LXDE, and Raspbian OS. Having said that, there are always solutions available.
Please check this link for libraries required. Make sure you have all the repositories added which are required for installation. You must look extremely carefully for these libraries:
libgsteramer1.0-dev, libgstreamer1.0-plugins-base-dev & libgstreamer1.0-base-dev.
libprotobuf-dev & protobuf-compliler
libatlas-base-dev
libjasper-dev (this one for wheezy, you'll need to enable repository)
libfaac-dev
These libraries will be required and a test will run on them during CMake. Some of them have a lot of dependency issues like libpng-dev and libtheora-dev. If you can paste the initial part of your CMake build, we can pin-point those libraries.

Related

Unable to cross compile iOS programs on linux

I know that someone already asked this question but it isn`t up to date anymore. Most of the links are dead and the commands are not relevant anymore.
I have read these
Compile IOS program from linux commandline
How to cross-compile clang/llvm for iOS?
For example, I have been trying to compile silversearcher-ag for my iPhone 6 (jailbroken). This is the project link https://github.com/ggreer/the_silver_searcher.
I am targeting iOS 12.4.
These are the commands that I`ve tried
./configure CC=/home/growtopiajaw/Desktop/cctools-port-master/usage_examples/ios_toolchain/target/bin/arm-apple-darwin11-clang CXX=/home/growtopiajaw/Desktop/cctools-port-master/usage_examples/ios_toolchain/target/bin/arm-apple-darwin11-clang++ --host=arm-apple-darwin11
make
I am using cctools-port to cross compile the project. My compiled cctools toolchain is located under /home/growtopiajaw/Desktop/cctools-port-master/usage_examples/ios_toolchain/target and below is how the toolchain`s directory structure looks like
This is my configure log: https://del.dog/nugibonury
This is my make log:
CC src/ignore.o
In file included from src/ignore.c:11:
./src/options.h:7:10: fatal error: 'pcre.h' file not found
#include <pcre.h>
^~~~~~~~
1 error generated.
make: *** [Makefile:494: src/ignore.o] Error 1
This is my GitHub repository containing the cross compile toolchain
https://github.com/GrowtopiaJaw/arm-apple-darwin11
Apple does not ship PCRE. You need to get the headers and dylib/tbd files manually.
If you're using checkra1n or unc0ver, then the deb on the APT repo contains headers as well, so you could just use that.
If you plan to package this into an APT/dpkg file, make sure to add pcre as a dependency.

What CUDA version does torch/lua require?

I'm trying to install Torch/Lua version and am getting the build errors shown below. I see this discussion on Github encountering the same errors, but I don't see a resolution to it.
https://github.com/torch/torch7/issues/670
What version of CUDA does torch require? My best guess right now is that this is a CUDA version mismatch.
CMake Error at THC_generated_THCBlas.cu.o.cmake:267 (message):
Error generating file
~/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o
CMake Error at THC_generated_THCSleep.cu.o.cmake:267 (message):
Error generating file
~/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCSleep.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:392: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o] Error 1
It appears that these issues were related to the g++ version I had (4.8). I installed the latest g++ version (5.2), then had to delete the torch directory, re-clone it, and the installation worked. Note that build artifacts will be left over so actually removing the whole torch directory was necessary.

Can't find location of libopencv_core.so.3.4.0 even though program is installed and working perfectly

I installed the openCV library through apt-get. I am trying to install the BGSLibrary and the cmake file tries to find " /usr/local/lib/libopencv_core.so.3.4.0" The script fails and looking manually the folder isn't there. I have tried searching for it and nothing is turning, infact nothing is turning up for openCV, apart from a folder in usr/local/share which only contains a few cmake files and folders about the haar cascade. I don't even know where openCV is installed even though it is working perfectly.
I am using python 2.7 with openCV 3.4.0
Its important to have your cMake report (outputlog file) up to the error reporting included into your question without it a black box is presented. Anyhow.. a shot for the bow below.
Look into your cMake output/log for:
CMakeFiles/Makefile2:123456: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed.
followed by something like:
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: Leaving directory '/tmp/opencv32018MMDD7-12345-abcdefg/opencv-3.4.0/>OS system <'
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
Then see if below is showing up:
make[2]: *** No rule to make target '/libpython2.7.so', needed by 'lib/cv2.so'. Stop.
If so you need to check CMake/Modules/FindPythonLibs.cmake
file what to do. Github check here at L30-L35 in the cMake pythonlib file what to do exactly to set python lib path correctly... to prevent a cascade of underlying errors.
...but as no cMake output/log file was given and OS remains undetermined ..its a shot in the dark. Nevertheless, I hope it points you in the right direction how to fix it.

Installing version of cunn from GitHub and using multilabelmargin criterion

I need to use multilabelmargin criterion in torch7 to train a CNN. It is not supported by the current cunn. I have tried installing a different version of cunn, as here: source
git clone https://github.com/clementfarabet/cunn -b master
cd cunn
Luarocks make rocks/cunn-scm-1.rockspec
However, when I do, torch stops working and I get the error:
make[1]: *** [CMakeFiles/cunn.dir/all] Error 2
make: *** [all] Error 2
I subsequently needed to reinstall torch7 using ezinstall. How can I correctly install the version of cunn required, without affecting my torch installation, and therefore use multilabelmargin?

Opencv headers different version and libraries different version: ubuntu

I am new to Ubuntu and OpenCV. Apologies for my amateurishness.
I think I messed up OpenCV installation.
I had installed OpenCV 2.4 months back. The installation was successful (built openCV from source using CMake)
Couple of days back I had also installed OpenCV 3.0 using the same procedure.
The problem began when one of my code gave a segmentation fault for seemingly no reason. On suggestion by a friend on Caffe Neural Network issues forum (https://github.com/BVLC/caffe/issues/3416), it seems that I am compiling with 3.0 headers but linking against the 2.4 libraries.
I checked /usr/local/include. It has the standard openCv header files ( I didn't understand what 'compiling with 3.0 header means' )
In /usr/local/lib I have OpenCV 3.0 libraries ( no 2.4.8 at all).
Now compilation was successful, but when I try to run it, I get the following error.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff76c49bc in cv::merge(cv::_InputArray const&,
cv::_OutputArray const&) ()
from /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4
Just to add
"pkg-config --modversion opencv"
3.0.0
whereas dpkg -l | grep libopencv
gave out
i libopencv-calib3d-dev:amd64 2.4.8+dfsg1-2ubuntu1 amd64 development files for libopencv-calib3d
ii libopencv-calib3d2.4:amd64 2.4.8+dfsg1-2ubuntu1 amd64 computer vision Camera Calibration library
ii libopencv-contrib-dev:amd64 2.4.8+dfsg1-2ubuntu1 amd64 development files for libopencv-contrib
.......
q.1> why does my code link to libopencv_core.so.2.4 instead of 3.0. I have checked in /usr/local/lib and did not see a single 2.4 library. I have tried manually defining links to header files and libraries in CMake but still same result.
q.2> Do OpenCV headers have a version number? I don't understand how they are called '2.4 headers'. I have checked the source code but did not see any specific requirement for a version of library. Then what dictates to link to 2.4 version libraries?
Sorry if this is theoretical but this would be highly beneficial to beginners like me. Please do comment for a suitable question title if the current one is not appropriate.
Thanks
Your opencv2.4 libraries are located in /usr/lib/x86_64-linux-gnu/ while the new opencv3 libraries are most likely located in /usr/local/lib. The linker is first looking in the /usr/lib/x86_64-linux-gnu/ directory, and thus finding the opencv2.4 libs first. To fix this you can tell the linker to look in /usr/local/lib first by adding the following to your ~/.bashrc file
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Reload the bashrc file in the terminal as follows (or simply close and re-open the terminal):
source ~/.bashrc
And update the library database:
sudo ldconfig
To check the order in which the linker will search for libraries, you can use the following:
ld -lopencv_core --verbose | grep attempt

Resources