Sysprogs forums › Forums › VisualGDB › Raspicam example not working
- This topic has 11 replies, 3 voices, and was last updated 8 years, 10 months ago by support.
-
AuthorPosts
-
December 1, 2015 at 22:14 #7278robopoParticipant
Trying out VisualGDB with the Raspicam cross-compile example. Instllaing the second, Raspicam project things start to go wrong. I made a clean jennie install with updates/upgades a couple of times with no luck. I have followed the example istructions to the letter imo but what I get when building below. I use VS2013 Professional and Raspberry Pi Model 2. VisualGDB feels just like the tool I need now, so please get me of the hook. Thanks, RAp.
.
.
2> [ 57%] “Building CXX object src/CMakeFiles/raspicam.dir/private/threadcondition.cpp.o”
2> [ 71%] “Building CXX object src/CMakeFiles/raspicam.dir/private_still/private_still_impl.cpp.o”
2>G:\RPi\raspicam\raspicam-0.1.3\raspicam-0.1.3\src\private_still\private_still_impl.cpp(62,53): warning : unused parameter ‘port’ [-Wunused-parameter]
2> static void control_callback ( MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer ) {
2> ^
2> G:/RPi/raspicam/raspicam-0.1.3/raspicam-0.1.3/src/private_still/private_still_impl.cpp: In member function ‘void raspicam::_private::Private_Impl_Still::commitParameters()’:
2>G:\RPi\raspicam\raspicam-0.1.3\raspicam-0.1.3\src\private_still\private_still_impl.cpp(172,117): warning : missing initializer for member ‘MMAL_PARAMETER_INPUT_CROP_T::rect’ [-Wmissing-field-initializers]
2> MMAL_PARAMETER_INPUT_CROP_T crop = {{MMAL_PARAMETER_INPUT_CROP, sizeof ( MMAL_PARAMETER_INPUT_CROP_T ) }};
2> ^
2> G:/RPi/raspicam/raspicam-0.1.3/raspicam-0.1.3/src/private_still/private_still_impl.cpp: In member function ‘void raspicam::_private::Private_Impl_Still::commitBrightness()’:
2>G:\RPi\raspicam\raspicam-0.1.3\raspicam-0.1.3\src\private_still\private_still_impl.cpp(606,13): warning : narrowing conversion of ‘((raspicam::_private::Private_Impl_Still*)this)->raspicam::_private::Private_Impl_Still::brightness’ from ‘unsigned int’ to ‘int32_t {aka int}’ inside { } [-Wnarrowing]
2> } );
2> ^
2> “Linking CXX shared library libraspicam.so”
2>EXEC : CMake error : cmake_symlink_library: System Error: No error
2>EXEC : CMake error : cmake_symlink_library: System Error: No error
2> make[2]: *** [src/libraspicam.so.0.1.2] Error 1
2> make[1]: *** [src/CMakeFiles/raspicam.dir/all] Error 2
2> make: *** [all] Error 2
2> ————————————————————-
2> Command exited with code 2
2> Executable: cmd.exe
2> Arguments: /c “C:\SysGCC\raspberry\bin\make.exe”
2> Directory: G:\RPi\VS2013\RaspberryCameraTest\Raspicam\..\..\..\raspicam\raspicam-0.1.3\raspicam-0.1.3/build/Debug
2>VisualGDB : error : Command-line action failed
2>EXEC : error : Build has failed. See the Output window for more details.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(43,5): error MSB3073: The command “”C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDB.exe” /rebuild “G:\RPi\VS2013\RaspberryCameraTest\Raspicam\Raspicam.vcxproj” “/solution:G:\RPi\VS2013\RaspberryCameraTest\RaspberryCameraTest.sln” “/config:Debug” “/platform:Win32″” exited with code 1.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
December 1, 2015 at 22:25 #7279robopoParticipantPS. When I install the include directories and Library directories to CisualGDB Projet Properties the testing won’t fall thru but says: Tool arguments: /tmp/VisualGDB_ToolchainTestProgram_deployed: error while loading shared libraries: libraspicam.so.0.0: cannot open shared object file: no such file or directory.
I have tried to maually copy the library to RPi but that won’t help.
December 3, 2015 at 04:33 #7282supportKeymasterHi,
The “EXEC : CMake error : cmake_symlink_library: System Error: No error” looks very strange. Please try using a newer version of CMake.
If this does not help, please try running it on a different machine.
December 3, 2015 at 17:44 #7290robopoParticipantI think the Raspicam example can actually never work. Considering the Raspicam-0.1.3 instructions how the library should be built manually on the RPi, I think this example will never install the camera’s dynamic library correctly on the appropriate folders or set the environmental parameters correctly on RPi. Maybe the creator of this example already had the library installed and that is how he assumed it works. I spent a lot of hours with this. 🙁
December 6, 2015 at 03:47 #7302supportKeymasterHi,
We have actually used a clean Raspberry Pi image when making that tutorial and built the raspicam library using the cross-compiler.
VisualGDB will actually automatically deploy the raspicam library to the same directory as your executable as long as:
- It is specified in the “debugged program” field (see step 26 of the tutorial)
- The project you are debugging references the raspicam project
It looks like in your case something prevents CMake from linking the library (EXEC : CMake error : cmake_symlink_library: System Error: No error). Please try running CMake in verbose mode to figure out what breaks it or run it on a different machine. Perhaps you are using a non-NTFS filesystem and CMake fails to create a symbolic link?
December 6, 2015 at 05:49 #7305robopoParticipantIMHO it would be better if the raspicam library is installed as a shared/dynamic library in the normal RPi library directory the way the install of the library itself does. I don’t see any good reason why not. Your wiringPi example uses the install provided by the library itself and installs it as a shared library in the standard library path, very clear, why not with raspicam as well.
I have the cam working on the RPi now and compile stuff on the console. I’m now trying to get the cross compiling for raspicam to work using the same approach you have used in the wiringPi example, but the problem is that VisualGDB has no help system (?) which makes it very hard and time wasting to try to finding out on your own what to do.
BTW. I think you could probably get a lot of friends if you made the VisualGDB available for QtCreator both Windows and Linux. These days I don’t use my VS2013 almost at all but now for VisualGDB only.
December 7, 2015 at 14:52 #7311robopoParticipantI am totally unable to get the raspicam to work using VisualGDB. I have the raspicam installed on the Raspberry Pi as a dynamic library according to its initial install instructions. While in Raspberry Pi – using a text editor and compiling and linking from the command line – I can get things working. Can you please show how to do the same using VisualGDB? I’m sure this could be an example other RPi cross compile wannabes would like to see too.
Even with VisualGDB I’d rather use the my own build instructions if possible as those I can understand (without reading first a book about makefiles) and which are easy to use put in script file/s. The compiling could happen on RPi but rather on the PC, I would like to see both versions.
As far as I can see my sysroot is a copy of the RPi lib folders containing all the necessary files in same folders. This is my compiling command line on RPi, the folder name is /wicam and the source filename “wicam.cpp”:
g++ -std=c++11 -I/usr/local/lib -I/usr/lib -I/usr/local/include/raspicam -c /home/pi/projects/wicam/wicam.cpp -o /home/pi/projects/wicam/wicam.o
and this one does the linking:
g++ -L/usr/local/lib/ -o /home/pi/projects/wicam/wicam /home/pi/projects/wicam/wicam.o /usr/local/lib/libraspicam.so -lwiringPi
The source “wicam.cpp” is a combined and modified example of the wiringPi example and a raspicam example:
/*********************************
wicam.cpp
*********************************/#include <fstream>
#include <iostream>
#include <vector>
#include <unistd.h>
#include <raspicam.h>
#include <wiringPi.h>using namespace std;
int main(int argc, char **argv)
{//testing wiringPi library access
int wiringPiSetup (void);
pinMode (0, OUTPUT);for (int i = 0; i<10;i++)
{
digitalWrite (0, HIGH); delay (500);
digitalWrite (0, LOW); delay (500);
std::cout <<” looping” << std::endl;
}// testing the raspicam lib access
raspicam::RaspiCam camera;
if (!camera.open())
{
cerr << “Could not open the camera” << endl;
return 1;
}cout << “Initial delay…” << endl;
sleep(3);
cout << “Acquiring image…” << endl;
camera.grab();std::vector<unsigned char> buf;
buf.resize(camera.getImageTypeSize(raspicam::RASPICAM_FORMAT_RGB));
camera.retrieve(buf.data(), raspicam::RASPICAM_FORMAT_RGB);
std::ofstream outFile(“output.ppm”, std::ios::binary);
outFile << “P6\n” << camera.getWidth() << ” ” << camera.getHeight() << ” 255\n”;
outFile.write((char*)buf.data(), buf.size());cout << “Image saved to output.ppm” << endl;
return 0;
}I hope you have the time for this. If I can’t get things working using VisualGDB I have to try something else.
Thanks
December 9, 2015 at 20:13 #7319supportKeymasterHi,
If you don’t want to use Makefiles, you can create a file called build.bat, place the compilation commands there and switch the Build System on the first page of VisualGDB Project Properties to custom. Then you can simply point it at your .bat file and VisualGDB will run it for you each time you build the project.
Your Linux command line (g++ -std=c++11 -I/usr/local/lib -I/usr/lib -I/usr/local/include/raspicam -c /home/pi/projects/wicam/wicam.cpp -o /home/pi/projects/wicam/wicam.o) will need to be adjusted to use the cross-compiler:
arm-linux-gnueabihf-g++ -std=c++11 -I=/usr/local/lib -I=/usr/lib -I=/usr/local/include/raspicam -c c:/projects/wicam.cpp -o c:/projects/wicam.o
If you have troubles setting up the manual build with VisualGDB, let us know so that we could share some screenshots.
January 26, 2016 at 13:45 #7545timschueParticipantHi everybody,
I have a Problem with this example too. I follow all steps in the example. But I get each time this failure. May someone can help me 🙂
————————————————————
Remote debugging from host 192.168.0.99
Failed to create camera componentopen Failed to create camera componentC:/Users/Tim/Desktop/test/raspicam-0.1.3/src/private/private_impl.cpp 102
Could not open the cameraChild exited with status 1
GDBserver exiting————————————————————
A python script on the cam works well, so it should work probably.
Greetz Tim
January 27, 2016 at 22:20 #7559supportKeymasterPlease try setting the “run GDB as root with sudo” flag in VisualGDB Project Properties.
January 28, 2016 at 12:06 #7565timschueParticipantHi Bazis,
thanks for your answer, I tried this but the problem is still the same (I just set the both flag?!). Have you another idea what the problem could be?
January 30, 2016 at 08:01 #7576supportKeymasterHi,
Does it work when you run your program manually via SSH? If not, the only advice we could give is to try stepping into the library code and figuring out why it cannot open the device. Perhaps the device is already open by some other app?
- This reply was modified 8 years, 10 months ago by support.
-
AuthorPosts
- You must be logged in to reply to this topic.