[ECOS] Linking problem

Meulendijks, J. Meulendijks@WT.TNO.NL
Fri Sep 24 09:36:00 GMT 2004


When I try to link twothreads.o (Example from ecos) I get the following:
Command used to link:
powerpc-eabi-ld -g -nostartfiles -Lc:/ecos-work/ecos_install/lib -Map .\output/l
ink.map -Ttarget.ld -nostdlib .\obj/twothreads.o -Lc:/cygwin/gnu/powerpc/lib -Lc
:/cygwin/gnu/powerpc/lib/eCos -o .\output/ram.elf

output:
.\obj/twothreads.o: In function `cyg_user_start':
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:16: undefined re
ference to `cyg_mutex_init'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:18: undefined re
ference to `cyg_thread_create'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:21: undefined re
ference to `cyg_thread_create'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:25: undefined re
ference to `cyg_thread_resume'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:26: undefined re
ference to `cyg_thread_resume'
.\obj/twothreads.o: In function `simple_program':
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:34: undefined re
ference to `cyg_thread_delay'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:41: undefined re
ference to `cyg_mutex_lock'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:45: undefined re
ference to `cyg_mutex_unlock'
/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:46: undefined re
ference to `cyg_thread_delay'
make: *** [.\output/ram.elf] Error 1
make: Leaving directory `/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw'
Finished

In my opinion all necaserry libraries are linked: libtarget.a, libgcc.a,
libsupc++.a
Can anyone see what's wrong??
Thanks!

-----Original Message-----
From: Billy [mailto:billy@dadadada.net]
Sent: donderdag 23 september 2004 14:05
To: Meulendijks, J.
Cc: eCos Discussion
Subject: Re: [ECOS] Linking problem


On Thu, Sep 23, 2004 at 10:11:40AM +0200, Meulendijks, J. wrote:
> When I try to link my application I get the following output:
> .\obj/twothreads.o: In function `cyg_user_start':
> /ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:27: undefined
reference to `cyg_mutex_init'
> /ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw/twothreads.c:27: relocation
truncated to fit: R_PPC_REL24 cyg_mutex_init
...
> make: *** [.\output/ram.elf] Error 1
> make: Leaving directory `/ecos-c/eCos-Work/Test/untitled_single_gnu_TNO_rtw'
> Finished
> 
> In my opinion the linker is missing libraries (libgcc.a libsupc++.a)

That's not what it looks like to me.
Missing libraries should be straight and simple undefined references
of symbols from -lgcc or -lsupc++, which isn't what you're seeing.
Something more wicked is happening...  see below for my hypothesis.

> but I use the GROUP(libtarget.a libgcc.a libsupc++.a) in my
> linkerscript. So I don't understand why it cannot find these
> libraries. Does anyone have any suggestions?

We saw something like this for ARM.  It was because we had a Makefile
bug which resulted in linking a library built for PC with my ARM app.
And the error we got looked a lot like what you have.  So check the
architecture of all of the libraries you're linking, and make
sure they're all compatible.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list