On 23 January 2017 at 08:55, Xi Ruoyao wrote: > On 10 January 2017 at 09:00, Jonathan Wakely wrote: >> On 10 January 2017 at 02:39, ssmtpmailtesting ssmtpmailtesting wrote: >> > The current linux os I'm using is in /dev/sda7, mounted as /(root). >> > I've mounted /dev/sda2 in /media/sda2. Now trying to install gcc in >> > /media/sda2/usr/bin. >> >> Then build GCC with --prefix=/media/sda2/usr > > I don't think that's enough. This would generate GCC executables > polluted > by things in current system. For example, > > /media/sda2/usr/libexec/gcc/{version}/cc1 > > may link to > > (in sda7) /usr/lib/libgmp.so > > But actually there may be no /media/sda2/usr/lib/libgmp.so. So when you > try to invoke GCC in /dev/sda2, you'll receive > > error while loading shared libraries: libgmp.so: cannot open shared > object file: No such file or directory > > That's bad. I suggest to chroot into /media/sda2. Or just ensure libgmp.so and libmfr.so and libmpc.so are also installed in the new partition. Or link to them statically, which is what happens when using the contrib/downloadd_prerequisites script.