ev3dev-lang-cpp icon indicating copy to clipboard operation
ev3dev-lang-cpp copied to clipboard

Compiling on windows leads to GLIBCXX error not found on ev3

Open Jacob-Brink opened this issue 8 years ago • 8 comments

I am recently trying to code my ev3 in c++, I installed ev3dev onto an sd card, I followed the instructions, but lo and behold, the ev3 complains it cannot find the Glibcxx 3.4.1 something so that it cannot run the program. I followed the step by step instructions here and made sure all packages were up to date on my windows bash, but nothing seems to work.

Jacob-Brink avatar Jan 06 '18 13:01 Jacob-Brink

Have you looked at #17, #27, #28? There could be some clues there.

ddemidov avatar Jan 06 '18 14:01 ddemidov

No, Is there a way to copy libsdc++? I am new to building my own executables with cmake and am fairly confused. I tried reflashing the ev3 to maybe update its software, but now I am running into more issues. Thanks for pointing me to those helpful explanations though.

Jacob-Brink avatar Jan 06 '18 15:01 Jacob-Brink

I am sorry, I have no experiance with cross-compiling under windows, but it was reported that compilation with docker works.

ddemidov avatar Jan 06 '18 15:01 ddemidov

Docker complains that I need windows pro or server edition to install. How did #17 issue that you provided solve her issue? I am trying to figure out how to copy the right libsdc++ version onto the ev3. Is there any way of doing that?

Jacob-Brink avatar Jan 06 '18 16:01 Jacob-Brink

My guess is there should be a libstdc++.so.?.?.? file somewhere in the cross-compiler files, and that #17 was solved by copying it into /usr/lib on the EV3 filesystem. This could work, but I am not fond of this solution. Another way to install docker would be to install a virtual Linux OS, and install docker there.

ddemidov avatar Jan 06 '18 17:01 ddemidov

Wait. Is it possible to build the c++ files on the ev3 itself? Then what ever compiler it had would just compile!

Jacob-Brink avatar Jan 07 '18 00:01 Jacob-Brink

It is possible, but may be quite frustrating. Depending on your program size, the compilation could take from very long time to forever. You can try it with a command like

g++ -std=c++11 -o my_program my_program.cpp ev3dev.cpp -I.

assuming you have ev3dev.cpp and ev3dev.h in the same folder as my_program.cpp.

ddemidov avatar Jan 07 '18 10:01 ddemidov

I believe that one work-around for this issue is to make sure that you have completed step 7:

sudo vim /etc/apt/sources.list

Append the following lines to the end of the file:

deb http://httpredir.debian.org/debian unstable main contrib non-free
deb http://security.debian.org/ unstable/updates main contrib non-free
deb http://archive.ev3dev.org/debian unstable main

Save and exit. Afterwards, run sudo apt-get update, which will update the packages searched for.

Now do:

sudo apt-get -y install build-essential

This should fix the issue.

However, if you are running ROS on the ev3, then installing build-essential from the unofficial unstable release will create new issues since ROS will depend on older versions of GLIBC. I don't know how to fix that yet. My current solution is to go back to the jessie branch and using docker to cross-compile.

morob05 avatar May 22 '19 02:05 morob05