This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Re: linking problem when using "fopen"
- From: Robin Farine <robin dot farine at acn-group dot ch>
- To: jyl087 at netscape dot net
- Cc: Jonathan Larmour <jlarmour at redhat dot com>, Robin Farine <robin dot farine at acn-group dot ch>, eCos users <ecos-discuss at sources dot redhat dot com>
- Date: 05 Apr 2002 10:40:26 +0200
- Subject: RE: Re: [ECOS] linking problem when using "fopen"
- References: <3F0DF4C3.7DDA4628.00067016@netscape.net>
Hi,
Two more things:
* in my first message, I forgot to mention that you also need to
#include <new> which should come from the compiler's own
header files, i.e. something like
".../arm-unknown-elf/gcc-lib/arm-elf/2.95.2/include/new", it
defines the prototype for the "new (std::nothrow) X(...)"
* I doubt but there might be a MULTILINK flavor of gcc that
builds a version of libgcc without the exception related
stuff?
HTH,
Robin
On Fri, 2002-04-05 at 00:23, jyl087@netscape.net wrote:
> Jonathan Larmour <jlarmour@redhat.com> wrote:
>
> >jyl087@netscape.net wrote:
> >> I'm using GCC 2.95.2. The libgcc.a associated with this compiler
> >> implements "new" with exceptions. Robin is on the right track, but
> >> the "new (std:nothrow)" form doesn't quite work, as Cyg_Stdio_Stream's
> >> constructor doesn't match the std:nothrow form of "new".
> >>
> >> Seems like this problem has been known for a couple of years. Why hasn't
> >> the fix been incorporated into the source tree?
> >
> >Sort of because I don't like it because the fault is elsewhere. In
> >Ryouzaburou's case, the problem was because of his tools. In your case the
> >problem is surely because of your eCos sources (you haven't said what the
> >problem exactly is and what eCos sources you are using so I can't be sure).
> >I know it "works for me" :-).
> >
> >I'll do you a deal: tell me what your problem is, and I'll make this change
> >even though I don't like it.
> >
> >Jifl
> >--
>
> I'm not sure if I'm answering your question correctly, but here's
> what I'm doing...
>
> I'm using the GCC 2.95.2 family of tools to cross compile to an ARM
> target. Host is RH 7.2. eCos is the latest from the CVS tree.
>
> I have a simple test program which calls "fopen". The program compiles
> correctly to produce "test.o". When the linker attemps to build the
> "test" executable, I get the errors below. It took me a long time to
> figure out what was really happening from the errors shown below.
>
> Basically, I figured out that the
> "../arm-elf/2.95.2/libgcc.a" contains the "new" implementation,
> which is needed by "fopen", and that object code requires all the
> C++ cruft for exception handling. That's why the linker is barfing!
>
> Obviously, my libgcc.a is different from yours. I built my tools
> using the instructions found on the eCos site, and got these results.
> I probably missed a step somewhere to build libgcc clean from C++
> exception handling. Is that the case, or is it a matter of the
> particular version (2.95.2) that I'm using?
>
> Let me know if you need further information about my setup. By the
> way... do you have any thoughts on my previous query (March 25, 2002)
> concerning GDB over serial?
>
> Thanks!
> /Jim
>
> ----------------------------------------
> LINKER ERRORS
> ----------------------------------------
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(exception.o): In function `__throw_bad_cast':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/exception.cc:321: undefined reference to `bad_cast::~bad_cast(void)'
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/exception.cc:321: undefined reference to `bad_cast virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(exception.o): In function `__throw_bad_typeid':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/exception.cc:327: undefined reference to `bad_typeid::~bad_typeid(void)'
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/exception.cc:327: undefined reference to `bad_typeid virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__throw_type_match_rtti':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:191: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__is_pointer(void *)':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:246: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__rtti_ptr':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:46: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__rtti_attr':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:58: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__rtti_func':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:70: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__rtti_ptmf':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:76: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o): In function `__rtti_ptmd':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:82: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:88: more undefined references to `type_info virtual table' follow
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo2.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo2.cc:300: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o): In function `__rtti_class':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.h:50: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o): In function `__rtti_si':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.h:26: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o): In function `__rtti_user':
> /usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.h:11: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.h:11: undefined reference to `type_info virtual table'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.h:26: more undefined references to `type_info virtual table' follow
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info node'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info function'
> /usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134: undefined reference to `type_info type_info node'
> collect2: ld returned 1 exit status
>
>
>
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
>
> Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
>
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
>
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss