Raspberry Pi crosscompile on Ubuntu 13.10 “libstdc

2020-08-01 15:34发布

问题:

I've followed the tutorial on SE as well as trying the extra steps from Hertaville and bootc but I still get the error that prompted the original SE question. I'm stumped.

I get five steps into the process before I get the error:

sudo apt-get install git rsync cmake lib32z1 lib32ncurses5 lib32bz2-1.0
git clone git://github.com/raspberrypi/tools.git
export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
. ~/.bashrc
arm-linux-gnueabihf-gcc -v

Error:

arm-linux-gnueabihf-gcc: error while loading shared libraries: 
     libstdc++.so.6: cannot open shared object file: No such file or directory

libstdc++.so.6 is present in all three directory trees mentioned in the tutorials as well as ./lib/x86_64-linux-gnu/libstdc++.so.6, but adding the relevant one to the path doesn't help (see below). I suspect there's a library path not being set, but I have no idea what that is.


I'm doing this in a virtual machine running Ubuntu 13.10 with netbeans and other tools, plus a LAMP stack installed. netbeans will build and run C/C++ executables just fine (and obviously IO can do the same from the command line).

Other things I've tried without success

export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/lib

Hertaville suggest adding 32 bit architecture:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6-i386 lib32stdc++6 zlib1g:i386

And the "build-essential" package:

sudo apt-get install build-essential git

Which also didn't help. I've also rebooted just in case.

回答1:

As expected the answer is trivial - install lib32stdc++6

The first line above should read:

sudo apt-get install libc6-i386 lib32z1 lib32stdc++6