Log in

View Full Version : Raspberry Pi C++


FRC2501
21-04-2015, 18:29
I am trying to get team 2168's vision tracking working on a Raspberry Pi 2, but I get this error:
./2168_Vision_Example: error while loading shared libraries: libstdc++.so.6.0.20: cannot open shared object file: No such file or directory
I have had little experience with code outside of writing it and hitting compile and send to rio, could someone help me get this working

SoftwareBug2.0
21-04-2015, 18:36
Do you see something named "libstdc++..." on your device? I don't have a Raspberry Pi to look at but it would be typically in something like /usr/lib. If you find it, see if the version number matches.

FRC2501
21-04-2015, 18:48
There isn't a libstdc++ in that folder, I'm assuming that means that I have to get that library?
If so how would I get that library?

connor.worley
21-04-2015, 19:03
You can statically link the library on the compiler end.

FRC2501
21-04-2015, 20:06
You can statically link the library on the compiler end.

And how would I do this?

connor.worley
21-04-2015, 20:09
And how would I do this?

That depends on your environment... how are you building code for the pi?

FRC2501
21-04-2015, 20:25
I am using Eclipse

connor.worley
21-04-2015, 20:41
I am using Eclipse

Did you follow a guide? Please link it. The more detail you can provide the better.

FRC2501
21-04-2015, 20:50
I followed this guide:
https://github.com/Team2168/2168_Vision_Example

and to be honest I have no idea how the code I typed becomes the thing that runs on the roboRIO

faust1706
21-04-2015, 21:26
I would remove what installation you have of opencv, and start fresh.

Glancing at the code, or rather what's in the repo. If you haven't, try installing opencv separate from here: https://github.com/Itseez/opencv, or by simply typing sudo apt-get install opencdv-lib. You aren't losing anything by not using their altered opencv that can change one camera's internal settings. V4L2 does this for ANY camera, well, for the most part.

Once you think it is done, run the following program to ensure everything is working:

https://github.com/rr1706/sample

Then I would try to run their program if you desire.

So in your first post you say you are using the Pi, but on your latest one you say the roboRIO....

As for your last comment indirectly about compilers: grab a book about compilers and read it. The general cs courseload for any university should include a class on compilers.

FRC2501
21-04-2015, 21:50
I would remove what installation you have of opencv, and start fresh.

Glancing at the code, or rather what's in the repo. If you haven't, try installing opencv separate from here: https://github.com/Itseez/opencv, or by simply typing sudo apt-get install opencdv-lib. You aren't losing anything by not using their altered opencv that can change one camera's internal settings. V4L2 does this for ANY camera, well, for the most part.

Once you think it is done, run the following program to ensure everything is working:

https://github.com/rr1706/sample

Then I would try to run their program if you desire.

So in your first post you say you are using the Pi, but on your latest one you say the roboRIO....

As for your last comment indirectly about compilers: grab a book about compilers and read it. The general cs courseload for any university should include a class on compilers.


Sorry about confusing you, I am running this on a Pi, but I have the most experience with the rios, I reinstall the OpenCV, but it seems to be another C++ library not the OpenCV one that it needs.

faust1706
22-04-2015, 08:20
I figured your installation of opencv wasn't the problem, but you never know. I don't really trust getting the opencv source from anywhere but from the repo I shared.

I think this terminal command with solve all your problems:

sudo apt-get install lib32stdc++6

FRC2501
23-04-2015, 19:01
I tried to install it with apt-get and this came up, I did find that it has libstdc++ on it but not lib32stdc++
E: Unable to locate package lib32stdc++6
E: Couldn't find any package by regex 'lib32stdc++'

faust1706
24-04-2015, 21:32
Um....shot in the dark here: sudo apt-get build-essential. Sorry for the rather delayed response.

FRC2501
28-04-2015, 18:59
Ok a few things:
1. build-essential is already the newest version
2. lib32stdc++6 is not available
3. libstdc++6 is already the newest version

Doe anybody know how to fix this?

SoftwareBug2.0
02-05-2015, 18:37
Ok a few things:
1. build-essential is already the newest version
2. lib32stdc++6 is not available
3. libstdc++6 is already the newest version

Doe anybody know how to fix this?

What is the output if you run "apt show libstdc++6"?

yash101
04-05-2015, 00:34
That's quite a simple problem to understand, but I don't know how to fix it.

If you notice, in the error, there's some version info about the shared object file.
If this isn't the same, you will often get an error.

I guess that you can try getting that shared object from the system which compiled the code and place it in the libraries folder in your system. You'll need to run ldconfig to flush the changes. After that, it should work magically.

Ideally, you would want to just compile the software on your Pi. OpenCV's CMakeLists.txt is very smart and will automatically optimize your build for what's available for it to use. This way, it can add optimizations such as better GPU acceleration, etc.

Compiling on your Pi will also get rid of the error because you will have compiled your software using libraries already present on your system.

dubiousSwain
02-06-2015, 22:01
This is a little bit off topic, but I'm trying to get rudimentary tracking (nothing crazy like NN or 900's code) with the Raspberry Pi and Python, im just having trouble figuring out how to configure it to automatically run on the robot without having to be interfaced with

1. What distros can I use/should be using?
2. How do I run code without logging in?

After I figure out the answer to question 1, I can use my limited knowledge of GNU/Linux to disable GNOME/X, install OpenCV, and autorun my scripts, but those two questions are my current hangups. Any and all advice would be greatly appreciated.

faust1706
02-06-2015, 23:05
1. What distros can I use/should be using?
2. How do I run code without logging in?
.

1. I would recommend a linux distro as they are generally the lightest (and FREE!). A common OS is ubuntu.

2. You can set up any program (or script) to run upon boot in a linux. What 1706 has done for many years now is simply don't require a login and then set up the program to run on boot. This way, as soon as the board gets power (and maybe a press of the power button to start the booting process of the board), the program will start automatically.

dubiousSwain
03-06-2015, 08:43
1. I would recommend a linux distro as they are generally the lightest (and FREE!). A common OS is ubuntu.

2. You can set up any program (or script) to run upon boot in a linux. What 1706 has done for many years now is simply don't require a login and then set up the program to run on boot. This way, as soon as the board gets power (and maybe a press of the power button to start the booting process of the board), the program will start automatically.

Thank you. I have Raspbian on my RPi right now and the time it takes to log in is atrocious. Is it necessary to disable X if I'm not connected to a display? I want to maximize the resources that my code has available. Also, how does one make Ubuntu not require a login?

faust1706
03-06-2015, 10:08
Is it necessary to disable X if I'm not connected to a display?

Um...you could try only showing terminal (http://www.tecmint.com/wp-content/uploads/2014/05/Arch-Linux-2.png). I'm not sure how much that would speed up boot time and I do not recommend unless you are a hardened linux user.

FRC2501
26-06-2015, 21:38
So I had some issues with my Pi not booting, so I bought another and the new one works great, I had to restart my OS but now I have it back to operational.

apt show libstdc++ returns command not found

I had tried compiling on the Pi but then the Pi started asking for the FRC libraries.

AustinSchuh
27-06-2015, 16:28
So I had some issues with my Pi not booting, so I bought another and the new one works great, I had to restart my OS but now I have it back to operational.

apt show libstdc++ returns command not found

I had tried compiling on the Pi but then the Pi started asking for the FRC libraries.

apt-cache show libstdc++
dpkg -l libstdc++6

From looking at your initial error message, and this statement, it looks like you are trying to use the FRC toolchains to target the Pi. (The .20 is the version of libstdc++v3 built for the roboRIO) This isn't going to work like you are hoping. I'd recommend either building your code directly on the pi with compilers on the Pi, or finding a good tutorial on building code for the Pi.

nick4130
30-06-2015, 15:07
Does anyone have Raspberry Pi drive train code that i can copy and paste into it? Im doing a side project with one of my friends from 1718