OpenCV & Yocto Project on Variscite Board (Var-Som-Dual i.mx6) - c++

I've got a problem with OpenCV and Yocto (Ubuntu 14.04).
I'm trying to install OpenCV with Yocto on a Variscite Board. I've followed every possible guide on web (this is the best procedure that I've tried http://www.engcore.com/2014/02/building-opencv-2-4-x-for-freescales-i-mx6-bsp-yocto/)... but no one works!
I've created the image files and then I tried to build the project with the command $CXX test.cpp -o test (the .bb file is correct). The compiler reads the header files (#include <opencv2..etc..>) but it stops on the first instruction with error:
"undefined reference to cvLoadImage"
The same if I try with imread (with imgcodecs.hpp). I think that the linker can't find the libraries.
How I can solve it? It's too important for me, I'm trying since a month :(

Related

CLBlast library not working on Mingw-w64 with Nvidia GPUs

I am trying to run the example samples/sgemm.cpp from the CLBlast repo on
Windows 10 with a Nvidia graphics card. I have obtained the cl.hpp from the link. The makefile is simply as follows:
a.exe: sgemm.cpp
g++ sgemm.cpp -lopencl -clblast -O0 -g -DCL_TARGET_OPENCL_VERSION=300
I have the Nvidia CUDA toolkit v11.6 installed and the include directory is on the environment variable CPATH so that it is found by g++. Furthermore, the compiler is part of a Mingw-w64 installation on which clblast is installed.
The problem is that the compilation seems to succeed, but as soon as I try executing the a.exe it crashes without any error message. Similarly, attaching gdb does not help either, because the program exits immediatedly and gdb prints
During startup the program exited with code 0xc0000135.
What is the problem?
Update
I have opened an issue on the clblas github. Note that I can compile clinfo from here without problems. A missing library therefore should not be the first thing that comes to my mind.
To answer this, this was not a problem with gdb, a.exe or the CUDA toolkit but rather with the installed library which is build with Visual Studio. The resulting binary seems to be incompatible with g++. Therefore, installing the library from source using g++ fixed this.

Undefined reference to IEE_EmoEnginEventCreat()

I'm working on a Raspberry Pi3 project with C++ code running rasbian stretch OS. I cloned the code from https://github.com/Emotiv/community-sdk. First I installed CMake but when I type $make in the terminal, the following Errors appear. I tried to put all the header files inside the project folder but the error still there. Any suggestions on how to solve this.

EDSDK 3.6 macOS - 32bit vs 64bit and linking errors

I'm trying to use the Canon EDSDK (latest version, v3.6 as of writing) in a simple, C++, command-line program on macOS (Sierra 10.12.6). I wish to utilize a simple Makefile environment and the usual apple compiler tools (llvm-clang) and avoid Xcode or any other heavy-weight IDE. The samples included with the SDK are all Xcode centric so I've had to roll my own here.
At present, I am able to compile a program to init the SDK and list connected cameras. As soon as I execute any EDSDK command however, I am getting a dynamic linking error:
Error loading /Library/Frameworks/EDSDK.framework/Versions/A/DppCore.bundle/Contents/PlugIns/DppCoreG.bundle/Contents/MacOS/DppCoreG: dlopen(/Library/Frameworks/EDSDK.framework/Versions/A/DppCore.bundle/Contents/PlugIns/DppCoreG.bundle/Contents/MacOS/DppCoreG, 262): no suitable image found
Did find: ... snip ... mach-o, but wrong architecture
The same error lists twice (both for DppCoreG). Upon examination, DppCoreG is compiled for 64bit architecture:
file /Library/Frameworks/..snip../DppCoreG
/Library/Frameworks/..snip../DppCoreG: Mach-O 64-bit bundle x86_64
However, there are other critical parts of the EDSDK that are compiled for 32bit architecture only:
file /...snip.../DPP.framework/DPP
/...snip.../DPP.framework/DPP: Mach-O dynamically linked shared library i386
How do I resolve this? The path of least resistance so far is to compile to i386 architecture explicitly (and the documentation explicitly states EDSDK is not 64-bit compatible). All is well except this one dynamic linking error (and in fact everything I've tried so far, which is just listing connected cameras, seems to work okay) but it is something I'm sure I can't continue to ignore or allow to persist in a production version of this project.
Here's a minimal example to cause the DYLD error:
#include <EDSDK.h>
#include <EDSDKTypes.h>
#include <EDSDKErrors.h>
int main(int argc, char** argv) {
EdsInitializeSDK();
EdsTerminateSDK();
return 0;
}
And probably more informative is the command to compile:
c++ -D __MACOS__ -g -arch i386 -I./deps/mac/include -framework DPP -framework EDSDK -o min min.cpp
I have the headers in the local include directory shown in the command and the frameworks installed under /Library/Frameworks.
Note that the c++ command is Apple LLVM version 8.1.0 (clang-802.0.42)
I've concluded that this is just an error on the part of those that deliver the EDSDK for mac. They should be compiling this particular bundle as a universal binary, not a 64bit binary. You can work around the problem by simply removing the offending bundle. It appears to just be a plugin and removing it does not seem to immediately affect the SDK. Assuming you have installed the EDSDK framework in /Library/Frameworks then just do this:
sudo rm -rf /Library/Frameworks/EDSDK.framework/Versions/Current/DppCore.bundle/Contents/PlugIns/DppCoreG.bundle
Enter your password when prompted (this assumes you are an admin account) and it will delete the offending plugin.
I have to believe that there may be consequences for removing this plugin at some point and if anyone knows more about this particular bundle/plugin and can explain what removing it will do I'd appreciate the additional insight.
In addition to #OllieBrown answer, I found in Xcode building for MacOS I had an additional item to remove to stop the link warnings.
link warning- EDSDK.framework/Versions/Current/DPPLibCom.bundle/Contents/MacOS/DPPLibCom: mach-o, but wrong architecture
removing EDSDK.framework/Versions/Current/DppLibCom.bundle stopped the warning.
Since the 3.x version there is a split between intergrated versions of DPP RAW capabilities. The original DPP works in x86 mode only and allows inspection and conversion of CR2 files on cams up until a certain models. See the API doc for the list. For recent camera models which rely on the new 64bit DPP engine (v4+?, dppcoreg) you would need x86_64 bit build so it dynamically links to use the latest features. Quite some (Raw) features are dropped, and gradually make their way back in in beta state.

OpenCV can not find library on launch. Backwards compatibility?

I am trying to build and use a piece of C++ code that uses OpenCV. I am working on Linux, working in Code::Blocks (and the code was originally also developed on a Linux platform using C::B).
I followed this to install OpenCV (Ubuntu 12.04 & OpenCV 2.4.3). The project compiles fine, but when I try to execute it, it crashes on launch, with the following message about how it can not find the library:
(file_address): error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
Process returned 127 (0x7F) execution time : 0.017 s Press ENTER to continue.
I set all the parameters for the linker according to several Code::Blocks install tutorials.
I also checked in /usr/local/lib/ for my libraries (it is the folder I gave to Code::Blocks' compiler); and while I do have a libopencv_core.so, a libopencv_core.so.2.4 and a libopencv_core.2.4.3, I do not have a libopencv_core.so.2.3.
So I'm wondering what the issue is. Is it about backwards compatibility, i.e. do I have to install the exact same version of OpenCV used to develop the original code? (This would be a bit concerning, since I am trying to make a widely-usable library).
Could I force it to use libopencv_core.so.2.4 instead?
EDIT: I managed to make it work by removing everything and reinstalling with a simple apt-get. Sometimes it's the simplest method that works the best! From now on I'll try to apt-get before following installation tutorials. ;)
Have a nice day!

XCode 4 & OpenCV Libraries

I've been googling and trying for days to solve my problem I had n luck, so I'm asking my first question here.
I have a MacBook with Lion (1.7.4), Xcode 4.
I need to work on a C++ application made with Leopard and Xcode 3.
The application comes with its own OpenCV.framework and is made for 32-bit Architecture (as u can see in Fig. 1)
I've tried to get it working on Xcode 3, and it works just fine, no need to install OpenCV or stuff (that is because the OpenCV.framework is included in the project, right?).
On Xcode 4 it's not working. That's what I've tried:
Run it "as is": even thought the OpenCV.framework is in the application directory, i get the following error:
dyld: Library not loaded:
#executable_path/../Frameworks/OpenCV.framework/Versions/A/OpenCV
Referenced from:
/Users/fabrizioborgia/Library/Developer/Xcode/DerivedData/suiviGUI-awhilvjpoqatfdansnpqcexpnxaw/Build/Products/Debug/suiviGUI.app/Contents/MacOS/suiviGUI
Reason: image not found
Remove the OpenCV.framework, install OpenCV via MacPorts and link the libraries. Nope, the libraries are 64-bit, and my program is 32. Removed OpenCV AND MacPorts.
Remove the OpenCV.framework, install 32-bit OpenCV via Homebrew (brew install opencv --build32) and link the libraries. Nope, i get the following error, so I assume that the libraries are STILL 64-bit. Right? Removed OpenCV AND Homebrew.
ld: warning: ignoring file
/usr/local/Cellar/opencv/2.4.1/lib/libopencv_calib3d.2.4.1.dylib, file
was built for unsupported file format which is not the architecture
being linked (i386)
Remove the OpenCV.framework, install OpenCV 2.4.1 by myself (with make and stuff) and link the libraries in the project. Nope, if i run the program on 32-bit arch it tells me that the libraries are not for 32-bit arch.
In any case, if I try to run it on 64-bit the compilation is successful but the program doesn't work properly.
Guys, really, I'm out of ideas, maybe I'm on the wrong direction, maybe I just have to find another OpenCV.framework or there is some linking setting that I'm missing, and the program doesn't see the framwork.
Anyone can help?
Solved the problem.
I applied some sort fo "divide et impera approach" and I asked a new question here on SO, you can find it here: 32-bit OpenCV on OS X Lion? Possible? and I found out that MacPorts AND Homebrew AND the Cmake Approach install by default the native architecture (64-bit in my case) OpenCV libraries, I needed the 32-bit, so i followed those steps:
Step 1: Download OpenCV 2.4.0
Step 2: Download and install CMake.
Step 3: Untar the OpenCV package.
Step 4: Make a separate directory inside the OpenCV package for building
mkdir build
cd build
cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 ..
(this will force the 32-bit compile)
make -j8
sudo make install
Step 5: Link the brand-new libraries in the Xcode project using the "Link Binary to Libraries" build phase.
Step 6: Hit "Run" :)
I would suggest that you get OpenCV working (if not already) in Lion with XCode 4 (tutorial). Test it with the example in the linked tutorial. Once that works, then copy over the classes you need from the project that you can't get working.
In other words, abandon the older project and rebuild it from a working project base.