Subject: Re: R E: Why the program complied by mips-linux-g++ cann't run on the target machine

From: Geert Uytterhoeven <[email-masked]>
Date: Mon, 6 Sep 2004 11:25:04 +0200 (MEST)

On Mon, 6 Sep 2004, Li Shishan wrote:
>         My  test program is coded by C, but my normal project was  coded by C++;
>
>      If  actually   there requrie the C++ runtime library ,   Can you have any other method for it .
>
>     because the C++  runtime library very huge, my  flash is limited.

That's the disadvantage of using C++: it needs a large runtime.

You can work around it by building your own stripped libstdc++, that includes
only the stuff you really need.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email-masked]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

---

From: "Li Shishan" <[email-masked]>
Date: Mon, 6 Sep 2004 14:20:46 +0800

Hi:

    Thank you very much for reply!!!  

-----Original Message-----
From: [email-masked] [mailto:[email-masked]]On Behalf Of Geert Uytterhoeven
Sent: 2004年9月5日 16:03
To: Li Shishan
Cc: Linux/MIPS Development
Subject: RE: Why the program complied by mips-linux-g++ cann't run on the target machine

On Sun, 5 Sep 2004, Li Shishan wrote:
>         I am very appreciated to your reply,   thank you very  much   !!!
>
>        When I  excute  the command : ldd ./ccgame,  give result : ./ldd: not found .   what can I do for that ?

Install ldd to find out?

>         If as you say ,require the c++ runtime libraries on the target .   firstly , my  test program  is coded by  C ,not C++ , if it also require c++ libraries?

If you compile it with g++, it will need the C++ runtime library, even if the
program source is plain C:

| anakin$ cat hello.c
| #include <stdio.h>
| #include <stdlib.h>
|
| int main(int argc, char *argv[])
| {
|     printf("Hello, world! [C]\n");
|     exit(0);
| }
|
| anakin$ gcc hello.c
| anakin$ ldd a.out
|                 libc.so.6 => /lib/tls/libc.so.6 (0x41019000)
|         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x41000000)
| anakin$ mv hello.c hello.C
| anakin$ g++ hello.C
| anakin$ ldd a.out
|                 libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40016000)
|         libm.so.6 => /lib/tls/libm.so.6 (0x41156000)
|         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4131a000)
|         libc.so.6 => /lib/tls/libc.so.6 (0x41019000)
|         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x41000000)
| anakin$

>  secondly, my target flash is very limited,  the C++ runtime libraries  is very large .

If it's C, why not compile it with the C compiler instead of the C++ compiler?

> -----Original Message-----
> From: [email-masked] Geert Uytterhoeven
> Sent: 2004Äê9ÔÂ5èÕ 4:44
> To: Li Shishan
> Cc: Linux/MIPS Development
> Subject: Re: Why the program complied by mips-linux-g++ cann't run on
> the target machine
>
>
> On Sat, 4 Sep 2004, Li Shishan wrote:
> >                I  use the   mips-linux-g++  complie a program.  and I excuted it on the target machine , but cann't, what's wrong?
> >
> >               For example:
> >
> >                For PC, I use g++  -c -o ccgame.o ccgame.cpp
> > 		                    g++  -o ccgame ./ccgame.o
> > 		execute it will give: Hello, world!
> >
> > 		For the target board, I use mips-linux-g++  -c -o ccgame.o ccgame.cpp
> > 		                             mips-linux-g++  -o ccgame ./ccgame.o
> > 		excute it will give " /bin/sh: ./ccgame: not found".
> >
> > 		Is there something wrong?
>
> Look like you didn't install the C++ runtime libraries on the target.
> What does `ldd ./ccgame' say?

Gr{oetje,eeting}s,

						Geert