R: [uClibc]R: Doing C++ with uClibc

Fabio Parodi fabio.parodi at fredreggiane.com
Mon Sep 10 13:44:18 UTC 2001


Hi Erik,

I did not compile libstdc++ with uClibc.
In fact, you need libstdc++ if you use the C++ standard library, things like
iostream.
But I don't use iostream and I don't need libstdc++.

I managed to compile flnx with uClibc. flnx is a graphic toolkit written in
C++,
running on microwindows (www.microwindows.org). It is derived from
http://www.fltk.org/.

In order to compile C++ code with uClibc, I've modified the wrapper programs
I have found in
uClibc/extra/gcc-uClibc. Please find the tar.gz in attachment. To install
it, you should do
something like this:

cd ~/uClibc/extra/gcc-uClibc
tar xzf /tmp/wrap-c++.tar.gz
cd ~/uClibc
make clean
make
sudo make install
export PATH=/usr/i386-linux-uclibc/bin:$PATH

Now you are ready to compile c++ programs with uClibc. Try this:

cd ~/uClibc/extra/gcc-uClibc
c++ hello.cpp -o hello
chmod 744 hello
./hello

This will print "hello from A\n" then produce a segmentation fault, because
uClibc did not
call the global constructor for static object g.

My host system is a standard PC with SuSe Linux 7.1. Hope this can help you.
Thank you very much for your great work.

Fabio



> -----Messaggio originale-----
> Da: Erik Andersen [mailto:andersen at codepoet.org]
> Inviato: lunedì 10 settembre 2001 9.29
> A: Fabio Parodi
> Cc: kjlin; uclibc at uclibc.org
> Oggetto: Re: [uClibc]R: Doing C++ with uClibc
>
>
> On Mon Sep 10, 2001 at 08:50:42AM +0200, Fabio Parodi wrote:
> > Hi,
> >
> > Unfortunately I still have the same problem, my architecture is
> plain x86.
> > Andersen told me that uClibc does not call global contructors and
> > destructors.
> > It is something about crt0 but I don't know how to solve this.
> > Temporary, I don't use global objects.
>
> I've got a pretty good idea what is going on, but I've been
> unable to test it,
> since I have not gotten gcc to compile using uClibc as the target
> C library --
> I just started trying that mid last week.  It sounds like you've
> managed to get
> libstdc++ compiled vs uClibc, right?
>
> Mind showing me how to make gcc compile using uClibc for the target C lib?
>
>  -Erik
>
> --
> Erik B. Andersen   email:  andersee at debian.org
> --This message was written using 73% post-consumer electrons--
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrap-c++.tar.gz
Type: application/x-gzip
Size: 3707 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20010910/0a7cc6e6/attachment.bin 


More information about the uClibc mailing list