Error building opencv with cmake on raspberry pi - opencv

I'm trying to build opencv-3.4.0 (with opencv_contrib-3.4.0) on Raspberry Pi. I'm getting a cmake build error after a 99 % , what should I change?
After I tried "make -j4" in the opencv-3.4.0/build folder, it successfully completed its process until 99%. Before that, configuration and generation part is done with cmake-gui.
Here is the error I am getting on the terminal
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:63: modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4018: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
What could be the problem?

Edit the file /home/pi/opencv-3.4.0/modules/python/src2/cv2.cpp and change
char* str = PyString_AsString(obj);
to const char* str = PyString_AsString(obj);

A slightly sideways answer, but I found that version 4.1 (without contribs - haven't tried it with) builds with no problems

Related

SWUpdate building error in yocto. make[1]: *** [swupdate_unstripped] Error 1 , make: *** [sub-make] Error 2

I am building custom image in yocto and I want to include SWUpdate in my image but while building the image I am getting a build error of make[1]: *** [swupdate_unstripped] Error 1 and make: *** [sub-make] Error 2 below are the log messages
/swupdate/2021.04-r0/recipe-sysroot/usr/lib/liblua5.1.a(loadlib.o): undefined reference to symbol 'dlsym##GLIBC_2.17'
/swupdate/2021.04-r0/recipe-sysroot/lib/libdl.so.2: error adding symbols: DSO missing from command line
/swupdate/2021.04-r0/git/Makefile:421: recipe for target 'swupdate_unstripped' failed
I searched the internet about the error I am getting, and according to it if u-boot version and swupdate version are not compatible then the following error occures. But in my case both the swupdate is at its latest verson and even u-boot is at latest version.
I added meta-swupdate in bblayers.config and added swupdate, swupdate-www in IMAGE_INSTALL to add the swupdate in image.

Torch with CUDA10

I am trying to install torch with cuda10 on my raspberry pi. I am following the following github thread ( answer of nagadomi:
https://github.com/torch/cutorch/issues/834
Following all his steps still when I run ./install.sh
I get the following error
make[2]: * No rule to make target 'exe/luajit-rocks/luajit-2.1/src/lib_ffi.c', needed by 'exe/luajit-rocks/luajit-2.1/vmdef.lua'. Stop.
make[1]: * [CMakeFiles/Makefile2:212: exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit-static.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
./install.sh: line 107: /home/pi/torch/install/bin/luarocks: No such file or directory
Installing common Lua packages
./install.sh: line 111: /home/pi/torch/install/bin/luarocks: No such file or directory
I have now spent a week just trying to setup torch with CUDA.
Basically I need cutorch library and it is not installing from `luarocks install cutorch
Can anyone help me please?

How to make ardrone autonomy package work on Jetson Nano?

I'm working on a Jetson Nano board and I need to connect it with a parrot ar drone 2.0, so in order to do that I would like to use the ardrone_autonomy package, but I can't do that because jetson has Ubuntu 18, which only supports ROS Melodic, which doesn't have this package.
Here is what I tried:
I built the package from this repository:
https://github.com/dsapandora/ardrone_autonomy
But I obtained this error:
/tmp/ccIoQjBo.s: Assembler messages:
/tmp/ccIoQjBo.s:128: Error: unknown mnemonic `bswap' -- `bswap x3'
generic.makefile:231: recipe for target '../../Soft/Build/targets_versions/vlib_PROD_MODE_Linux_4.9.140-tegra_GNU_Linux_usrbingcc_5.4.0/video_mem32.o' failed
make[8]: *** [../../Soft/Build/targets_versions/vlib_PROD_MODE_Linux_4.9.140-tegra_GNU_Linux_usrbingcc_5.4.0/video_mem32.o] Error 1
vlib.makefile:104: recipe for target 'all' failed
make[7]: *** [all] Error 2
Makefile:167: recipe for target 'build_vlib' failed
make[6]: *** [build_vlib] Error 2
Makefile:170: recipe for target 'all' failed
make[5]: *** [all] Error 2
Makefile:84: recipe for target 'build_libs' failed
make[4]: *** [build_libs] Error 2
Makefile:20: recipe for target 'all' failed
make[3]: *** [all] Error 2
ardrone_autonomy/CMakeFiles/ardronelib.dir/build.make:110: recipe for target '/catkin_ws/devel/src/ardronelib-stamp/ardronelib-build' failed
make[2]: *** [/catkin_ws/devel/src/ardronelib-stamp/ardronelib-build] Error 2
CMakeFiles/Makefile2:578: recipe for target 'ardrone_autonomy/CMakeFiles/ardronelib.dir/all' failed
make[1]: *** [ardrone_autonomy/CMakeFiles/ardronelib.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
After I resolved that using almost any solution from here:
https://github.com/AutonomyLab/ardrone_autonomy/issues/71
I can compile the package without problems but when I try to run the node, it says that the ardrone_driver has died, without any other information.
2.Then I tried to build the package in a docker under ROS Kinetic, but after getting the same bswap error as above, after applying the above solution I get this:
/tmp/ccFs5LFZ.s: Assembler messages:
/tmp/ccFs5LFZ.s:130: Error: unexpected characters following instruction at operand 2 -- `mov x4,x4,ror#8'
generic.makefile:231: recipe for target '../../Soft/Build/targets_versions/vlib_PROD_MODE_Linux_4.9.140- tegra_GNU_Linux_usrbingcc_5.4.0/video_mem32.o' failed
make[8]: *** [../../Soft/Build/targets_versions /vlib_PROD_MODE_Linux_4.9.140-tegra_GNU_Linux_usrbingcc_5.4.0 /video_mem32.o] Error 1
vlib.makefile:110: recipe for target 'all' failed
make[7]: *** [all] Error 2
Makefile:167: recipe for target 'build_vlib' failed
make[6]: *** [build_vlib] Error 2
Makefile:170: recipe for target 'all' failed
make[5]: *** [all] Error 2
Makefile:84: recipe for target 'build_libs' failed
make[4]: *** [build_libs] Error 2
Makefile:24: recipe for target 'all' failed
make[3]: *** [all] Error 2
ardrone_autonomy/CMakeFiles/ardronelib.dir/build.make:110: recipe for target '/ardrone_ws/devel/src/ardronelib-stamp/ardronelib-build' failed
make[2]: *** [/ardrone_ws/devel/src/ardronelib-stamp/ardronelib-build] Error 2
CMakeFiles/Makefile2:578: recipe for target 'ardrone_autonomy/CMakeFiles/ardronelib.dir/all' failed
make[1]: *** [ardrone_autonomy/CMakeFiles/ardronelib.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 2%] Built target _ardrone_autonomy_generate_messages_check_deps_matrix33
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j2" failed
And here is where I'm stuck, because as much as I know it is a problem of processor architecture (Jetson uses armv8), and all the above solutions are for armv7, but I don't know how to solve this. Please let me know if anyone else found a solution to this problem. Any help would be highly appreciated!
I finally solved the problem, here are the complete steps, if there is someone else who is struggling with the same problems:
I downloaded the docker image using:
sudo docker pull ros:kinetic-robot-xenial
And then followed this steps to run the image: http://wiki.ros.org/docker/Tutorials/Docker
The I cloned the ardrone_autonomy package in a worksapce, from the above link:
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/dsapandora/ardrone_autonomy.git
apt-get update
cd ../
rosdep install --from-paths src --ignore-src -r -y
catkin_make
After the error with bswap appears, edit this file: devel/src/ardronelib/ARDroneLib/VP_SDK/VP_Os/linux/intrin.h and replace:
static INLINE uint32_t _byteswap_ulong(uint32_t value)
{
__asm("bswap %0":
"=r" (value):
"0" (value));
return value;
}
with this:
static INLINE uint32_t _byteswap_ulong(uint32_t value)
{
int32_t tmp;
__asm __volatile(
"eor %1, %2, %2, ror #16\n"
"bic %1, %1, #0x00ff0000\n"
"mov %0, %2, ror #8\n"
"eor %0, %0, %1, lsr #8"
: "=r" (value), "=r" (tmp)
: "r" (value)
);
return value;
}
and comment this line: _BitScanReverse(&index, code);
After you do this if you try to give it a catkin_make it should appear the last error which can be resolved "simply" (after you understand what is happening there :) ) just by replacing this line (from the same file as above):
"mov %0, %2, ror #8\n"
with:
"mov %0, %2\n"
and now should work just fine.
PS: Don't forget to source your workspace.
AR Drone 2.0 is still compatible.
Just Downgrade the firmware to 2.4.1 (i use this one) from
https://www.espaciodrone.com/todos-los-firmware-del-ar-drone-1-y-2/
Power up your AR.Drone
Connect your computer to the AR.Drone’s network
Open a telnet session to 192.168.1.1
type the following: echo "1.1.1" > /firmware/version.txt
press enter
type the following: echo "2.4.1" > /update/version.txt
Connect an FTP client to: 192.168.1.1 Port: 5551 (i use nautilius ctrl + l then ftp://192.168.1.1:5551)
Upload the downloaded plf file to the FTP server (AR.Drone)
Disconnect your computer from the AR.Drone
Disconnect the battery from the AR.Drone
Reconnect the battery
Wait about 5 minutes while the upgrade completes, leave your drone switched on
And use this git clone https://github.com/dsapandora/ardrone...
It works like a charm...

Error installing opencv-3.0.0-beta on Ubuntu 14.04

I am new to opencv and i am trying to install opencv-3.0.0-beta on ubuntu 14.04. When running make command, I get an error at 54%.I followed the same steps mentioned in http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html. but I still get an error.
Below is the error message I'm getting.
/usr/bin/ld:
../../../3rdparty/ippicv/unpack/ippicv_lnx/lib/ia32/libippicv.a(jmp_ippiResizeGetBufferSize_16s_as.s.o):
relocation R_386_GOTOFF against undefined symbol
`ippicvJumpIndexForMergedLibs' can not be used when making a shared
object /usr/bin/ld: final link failed: Bad value collect2: error: ld
returned 1 exit status make[2]: * [lib/libopencv_imgproc.so.3.0.0]
Error 1 make1: [modules/imgproc/CMakeFiles/opencv_imgproc.dir/all]
Error 2 make: ** [all] Error 2
Please help in solving it.
Thanks
It looks like your IPP configuration bugs. If you don't need IPP, you might want to rerun the cmake command with this option WITH_IPP=OFF.
Further reading here about deactivate IPP and here to properly configure IPP.

OpenCV, Ubuntu 11.04

I've been trying to install OpenCV 2.2 on Ubuntu 11.04. As far as I can gather from here: linux/videodev.h : no such file or directory - OpenCV on ubuntu 11.04, the installation fails because video4linux is no longer in the kernel. If I follow the guide linked to in the above thread (http://tech.groups.yahoo.com/group/OpenCV/message/79758), the make-command passes the initial error described in the above thread, but fails at a later point. I get the error:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_highgui.so.2.2.0: undefined reference to `cvCreateCameraCapture_V4L(int)'
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_createsamples] Error 1
make[1]: *** [modules/haartraining/CMakeFiles/opencv_createsamples.dir/all] Error 2
make: *** [all] Error 2
This error also seems related to video4linux.
Any suggestions?
Thanks a bunch,
Andreas Møgelmose
You may find this blog post useful:
http://salikscodingblog.wordpress.com/2011/08/05/compiling-opencv-2-on-ubuntu/

Resources