unable to run example of OpenCV in beagleBone Black - c++

I am trying to run a program using OpenCV in beaglebone black as described at the end of the link https://solarianprogrammer.com/2014/04/21/opencv-beaglebone-black-ubuntu/
I had some compilation issues which I resolved using
g++ pkg-config --cflags --libs opencv test_2.cpp -o test_2
It successfully compiles, but when I try to run using
./test_2
I get the error:
Ipc_start: LAD_connect() failed: 4
test_2: /build/ti-opencl-zdvBAC/ti-opencl-01.01.06.00/host/src/core/dsp/mbox_impl_msgq.cpp:59: MBoxMsgQ::MBoxMsgQ(Coal::DSPDevice*): Assertion `status == (0) || status == (1)' failed.
Aborted
I am not sure why I am getting this, and I've been unable to resolve it for a few days already. Please guide me into right direction.
Regards

This stems from the use of OpenCL under the covers. The bypass that works for me is to disable opencl by setting:
export OPENCV_OPENCL_RUNTIME=qqq
Optionally, if you're (cross) compiling OpenCV you can add -DWITH_OPENCL=OFF to your Cmake options to remove OpenCL from the build.

Related

Build errors in cpprest sdk (casablanca) on Ubuntu 16.04

While searching for an HTTP client C++ based library, I have decided to use the casablanca -- so I needed to build it.
I'm running on Ubuntu 16.04.
While following the "common" build steps described here: How-to-build-for-Linux I have encountered a build error (when running the make command as the last operation of step 4).
The entire error output can be found here (now it is the last comment in the thread cpprestsdk-build-error#266).
Just to be sure my system has the needed build tools and libraries I performed the command mentioned in step 2 and this is the output:
--> Which means my system is "good to go".
So after I struggled it a little more, I have found "an alternative" way to build it:
I have downloaded the source code from here: Source Package: casablanca (2.8.0-2) [universe], and again, followed the same instructions STARTING FROM STEP 4 from the link mentioned in the question (How-to-build-for-Linux).
This time the make phase was successful !! (it is worth to mention that not all the unit tests that are recommended to be run on step 5 passed - I did not spend time trying to understand why...).
Went on and "copied-pasted" the complete sample provided at the bottom of the following link: cpprestsdk-Getting-Started-Tutorial.
Built the program with the following command (the program contained a single cpp file called main):
g++ -std=c++11 main.cpp -o myProg -lboost_system -lcrypto -lssl -lcpprest
Ran the program
./myProg
and it passed (there was output in the console saying:"Received response status code:200").
Would be glad to hear if you have encountered the same issue, or perhaps I did something wrong in my first attempt (or in any other step along the way).

Checking of python fails as: testing of pyembed fails

When I try to do a waf configuration, I get the following error:
Asking python-config for pyembed '--cflags --libs --ldflags' flags :
yes Testing pyembed configuration:Could not build a python embedded
interpreter
The error is difficult to understand and solve. Can anyone please help me to fix this error?

NPM sqlite3 with sqlcipher support

I am trying to cross compile NPM Sqlite3 with sqlcipher support. I am using Ubuntu 16.04 to cross compile for linux armv7 based SOC(system on chip).
So I started with cross-compiling OpenSSL to build sqlcipher for arm. I successfully cross compiled sqlcipher to produce a static library (libsqlcipher.a).
Now I am trying to get the NodeJS side of the project. I need sqlite with sqlcipher support, compiled for arm. I am using SOC SDK to built till now.
I am using node v4.6.1 and npm v2.15.9 to cross compile. I made sure I have the same version installed on Ubuntu as the SOC.
The command I use to cross compile is as follows :
npm install sqlite3 --target_arch=arm --enable-static=yes --build-from-source --sqlite_libname=sqlcipher -fPIC --sqlite=home/onkar/Library/sqlcipher-master/.libs --verbose
I exported the location of the libsqlcipher.a to LDFLAGS. I get the following error when I try to cross compile. Can someone help me with this error?
/home/linuximage/sdk/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/5.2.1/real-ld: error: /home/Library/sqlcipher-master/.libs/libsqlcipher.a(sqlite3.o): requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC
collect2: error: ld returned 1 exit status
node_sqlite3.target.mk:129: recipe for target 'Release/obj.target/node_sqlite3.node' failed
make: *** [Release/obj.target/node_sqlite3.node] Error 1
Please let me know if you require any additional information, I would be more than happy to provide you with the same.
Thanks,
Onkar
In the first instance, you should check if the -fPIC (position independent code) flag was correctly applied when the libsqlcipher.a file was originally created.
In your output above, it looks like the linker is using the file at:
/home/Library/sqlcipher-master/.libs/libsqlcipher.a
Run the command
objdump -r /home/Library/sqlcipher-master/.libs/libsqlcipher.a | more
... and check for a line close to the start of the output beginning with the text
RELOCATION RECORDS FOR
If you see this line, then the library doesn't contain position independent code.

How to cross compile alljoyn standard core and service framework?

I have one wifi camera with armv5 processor and want to cross compile and alljoyn standard core, service framework and want to make notification producer application.
But I am stuck while cross compiling alljoyn. I am compiling alljoyn with codesourcery arm cross compiler with gcc version 4.3.3
Initially I have used same command, used to compile standard core and service framework. Just added CROSS_COMPILE and CPU flag for arm and crosscompiler. Here is the command used, compilation process fails with some error related to -std=c++11
command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=linux CPU=arm CROSS_COMPILE="/home/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-" SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
error:
....
prints for copying header files to 'build' dir
....
/* On compilation of first cc file */
cc1plus: error: unrecognized command line option "-std=c++11"
scons: ***
[build/linux/arm/debug/obj/services/config/cpp/samples/ConfigClientSample/ConfigClientMain.o] Error 1
After this failure I found following link,
https://wiki.allseenalliance.org/develop/building_and_running
It says that we can compile alljoyn for openwrt on cross compiling. So I have prepared and executed following command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=openwrt CPU=openwrt TARGET_PATH=/home/CodeSourcery/Sourcery_G++_Lite/bin/ TARGET_CC=arm-none-linux-gnueabi-gcc TARGET_CFLAGS="-std=c++0x" TARGET_CPPFLAGS="-std=c++0x" TARGET_CXX=arm-none-linux-gnueabi-g++ TARGET_LINK=arm-none-linux-gnueabi-gcc TARGET_LINKFLAGS="" TARGET_AR="" TARGET_RANLIB="" STAGING_DIR=/usr/lib/x86_64-linux-gnu SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
But getting error before compilation starts,
scons: Reading SConscript files ...
Checking c++ compiler support for -std=c++11 flag... no
Checking c++ compiler support for -std=c++0x flag... no
*** Compiler too old to build AllJoyn. Aborting.
So here is my questions,
1. Is it possible to cross compile alljoyn standard client and services without using openwrt?
2. Does cross compiling using openwrt affect any functionality of alljoyn?
3. What should I do to overcome c++11/c++0x error, should I find new gcc version for cross compiling my code.
Please let me know if some one has cross compiled alljoyn standard core and service framework for any platform, please provide me steps/command for that.
Thanks in advance.
Pratik
These steps to cross compile AllJoyn worked for me.
http://itisprakash.blogspot.com/2016/05/cross-compile-alljoyn-for-raspberrypi.html

OpenCV C++ code runs fine in terminal but error in running from eclipse - Ubuntu 12.04

I am trying to run C++ OpenCV programs in Eclipse IDE on Ubuntu 12.04 LTS. They run fine when I use the terminal, as shown here-https://help.ubuntu.com/community/OpenCV.
But when I build the same code in Eclipse, I get the following error
Error description-
opengl support available
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/akash/OpenCV/opencv-2.4.7/modules/highgui/src/window.cpp, line 269
terminate called after throwing an instance of 'cv::Exception'
what(): /home/akash/OpenCV/opencv-2.4.7/modules/highgui/src/window.cpp:269: error: (-215) size.width>0 && size.height>0 in function imshow
My code is
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img=imread("image.jpg");
namedWindow("win",WINDOW_AUTOSIZE);
imshow("win",img);
waitKey(0);
return 1;
}
I have taken care of the following-
kept the image.jpg in src and all other folders of the project.
double-checked the library names in /usr/local/lib
Added only a single include path for OpenCV header files.
I still cant seem to run it.
Please help.
I still think your problem comes from the program not finding the image.jpg file (even if you have taken a number of steps to make sure it does). The working directory - that an application is executed from - is often different from that of the source or binary folders in eclipse (you can actually set it manually in project settings).
To quickly verify this hypothesis you could pass the absolute path of image.jpg to imread(). If that solves the problem you just need to configure your working directory correctly in eclipse.
g++ filename.cpp -o outputfile-name pkg-config --cflags --libs opencv
Ex:
Compilation:-
thinkpadt61#thinkpadt61-ThinkPad-T61:~/Kannathasan$ g++ simple.cpp -o sample pkg-config --cflags --libs opencv
Run:
thinkpadt61#thinkpadt61-ThinkPad-T61: ./sample
Thats it!... Enjoy