Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

link q's

link q's

2005-12-05 by Steve Franks

Hi all,

fyi: I'm using WinARM, not a home-built distribution.  I think WinARM's
fantastic, btw.

So, I'm getting the following errors that I can't get rid of:

C:\projects\arm\examples\knightrider/main.cpp:41: undefined reference to
`SetNativeSpeed(unsigned long)'
C:\projects\arm\examples\knightrider/main.cpp:48: undefined reference to
`ioctl(int, unsigned long, void*)'

Obviously, my makefile can locate newlib-lpc, but I'm tearing out my hair
trying to fix it.  I've tried "-lnewlib-lpc" linker option,

vpath %.o C:\WinARM\arm-elf\lib
vpath %.a C:\WinARM\arm-elf\lib

and 

-LC:\WinARM\arm-elf\lib

And nothing works.  I have no idea how the linker points to the lib dirs,
because I didn't originally see lib dirs pointed to anywhere in the makefile
like include dirs are.  Where's that magic?

Obviously, I'm not a make expert.  Apologize if this is question has an easy
answer that I could look up somewhere...

Steve

Steve Franks, KE7BTE
Electrical & Firmware Engineer
Tucson Embedded Systems

Re: [lpc2000] link q's

2005-12-06 by Robert Adsett

I hope this gets through, I've not been having much luck recently.

At 03:39 PM 12/5/05 -0700, Steve Franks wrote:
>Hi all,
>
>fyi: I'm using WinARM, not a home-built distribution.  I think WinARM's
>fantastic, btw.
>
>So, I'm getting the following errors that I can't get rid of:
>
>C:\projects\arm\examples\knightrider/main.cpp:41: undefined reference to
>`SetNativeSpeed(unsigned long)'
>C:\projects\arm\examples\knightrider/main.cpp:48: undefined reference to
>`ioctl(int, unsigned long, void*)'
>
>Obviously, my makefile can locate newlib-lpc, but I'm tearing out my hair
>trying to fix it.  I've tried "-lnewlib-lpc" linker option,

OK, I would expect that was likely to work.

A question.  Where is your newlib-lpc archive?  You should find 
libnewlib-lpc.a somewhere if you expect -lnewlib-lpc to work.

The linker control file has the ability to specify search path and that can 
be used to supply path's if ld doesn't appear to be searching for the 
archive correctly.  Something like

SEARCH_DIR( /home/radsett/arm/lib)
SEARCH_DIR( /home/radsett/install/arm-elf/lib)
SEARCH_DIR( /home/radsett/install/lib/gcc-lib/arm-elf/3.3.2)

Someone familiar with winarm can probably tell you what its search path 
are.  It should have some built in to it.

Robert


" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Re: [lpc2000] link q's

2005-12-06 by Tom Walsh

Steve Franks wrote:

>Hi all,
>
>fyi: I'm using WinARM, not a home-built distribution.  I think WinARM's
>fantastic, btw.
>
>So, I'm getting the following errors that I can't get rid of:
>
>C:\projects\arm\examples\knightrider/main.cpp:41: undefined reference to
>`SetNativeSpeed(unsigned long)'
>C:\projects\arm\examples\knightrider/main.cpp:48: undefined reference to
>`ioctl(int, unsigned long, void*)'
>
>  
>

The GNU linker does not do circular resolution of symbols, for example, 
symbol foo is in 'libbar.a', when linking in with the 'libjunk.a' 
archive, this would fail to give libjunk.a resolving of 'foo':

INPUT ( -lbar -ljunk )

This would solve the problem:

INPUT ( -lbar -ljunk -lbar )

GNU ld links "forward" resolving against successive objects to resolve 
symbols, it does not consider previously known references that may have 
appeared in proir objects (libs, *.o).   This may sound "wrong" but 
there are many situations where this behavior is desirable (to overload 
a known symbol such as your own version of strcpy() for example).




>Obviously, my makefile can locate newlib-lpc, but I'm tearing out my hair
>trying to fix it.  I've tried "-lnewlib-lpc" linker option,
>
>vpath %.o C:\WinARM\arm-elf\lib
>vpath %.a C:\WinARM\arm-elf\lib
>
>and 
>
>-LC:\WinARM\arm-elf\lib
>
>And nothing works.  I have no idea how the linker points to the lib dirs,
>because I didn't originally see lib dirs pointed to anywhere in the makefile
>like include dirs are.  Where's that magic?
>
>Obviously, I'm not a make expert.  Apologize if this is question has an easy
>answer that I could look up somewhere...
>
>Steve
>
>Steve Franks, KE7BTE
>Electrical & Firmware Engineer
>Tucson Embedded Systems
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>  
>


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

RE:link q's

2005-12-07 by Steve Franks

> Message: 1         
>    Date: Mon, 5 Dec 2005 15:39:34 -0700
>    From: Steve Franks <stevef@...>
> Subject: link q's
> 
> Hi all,
> 
...
> 
> So, I'm getting the following errors that I can't get rid of:
> 
> C:\projects\arm\examples\knightrider/main.cpp:41: undefined 
> reference to
> `SetNativeSpeed(unsigned long)'
> C:\projects\arm\examples\knightrider/main.cpp:48: undefined 
> reference to
> `ioctl(int, unsigned long, void*)'
...

I thought everyone would like to know the resolution:  when using newlib-lpc
from a .cpp file, one must surround the '#include' lines by 'extern "c" {}'.
Get's you every time.  Hopefully I'll save someone else a few hours someday.
'C' headers in cpp sources bites me about every 18 months.  One day I'll
learn...

regards,
Steve

Re: [lpc2000] RE:link q's

2005-12-08 by Tom Walsh

Steve Franks wrote:

>>Message: 1         
>>   Date: Mon, 5 Dec 2005 15:39:34 -0700
>>   From: Steve Franks <stevef@...>
>>Subject: link q's
>>
>>Hi all,
>>
>>    
>>
>...
>  
>
>>So, I'm getting the following errors that I can't get rid of:
>>
>>C:\projects\arm\examples\knightrider/main.cpp:41: undefined 
>>reference to
>>`SetNativeSpeed(unsigned long)'
>>C:\projects\arm\examples\knightrider/main.cpp:48: undefined 
>>reference to
>>`ioctl(int, unsigned long, void*)'
>>    
>>
>...
>
>I thought everyone would like to know the resolution:  when using newlib-lpc
>from a .cpp file, one must surround the '#include' lines by 'extern "c" {}'.
>Get's you every time.  Hopefully I'll save someone else a few hours someday.
>'C' headers in cpp sources bites me about every 18 months.  One day I'll
>learn...
>
>  
>
Maybe get an open source lint program and change it to look for that for 
you?

Regards,

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.