Trouble pulling in libm

Thomas Doerfler Thomas.Doerfler at embedded-brains.de
Fri Jan 14 07:49:29 UTC 2011


Hi,

I assume that your driver (which uses a libm function) is part of the
rtems library.

if I remember things right, ld will normally walk through the libraries
only once. So a library can provide library functions (like round() )
only for modules (and other lib functions) that have been pulled in
_before_ the library is listed on the ld command line.

So if you have the following order when linking:

.... application.o... ...-lm ... -lrtems ...

then libm will provide the math functions required for application.o,
but not for any reference in librtems.a . Changing the library order on
the command line would be _one_ way to fix that.

I am sure Ralf can give you hints how to fix this properly, but
providing as much information as possible is vital for this. So please
cut and post the actual error messages and the command line of the
linker that lead to the errors.

wkr,

Thomas.


Am 14.01.2011 06:43, John Wood wrote:
> If I call round only in my driver I get the previous linker error.
> 
> 
> If I add the following code to one of my application files.
> 
>   double test;
>   double value = 0.5;
> 
>   test = round(value);
> 
> The linker error goes away.  Its seems like there is something going on calling a libm function in the rtems code and not calling it in the app.
> 
> I have to call the specific function and not just another libm function, if I replace the round in the above code with sqrt for example I get the linker error again.
> 
> I don’t have my hardware so I can't tell if the function is actually linking correctly.  I'll test this tomorrow.  Short term I can put the code in my app but ideally it belongs with the driver.
> 
> 
> -----Original Message-----
> From: Ralf Corsepius [mailto:ralf.corsepius at rtems.org] 
> Sent: Friday, January 14, 2011 12:32 AM
> To: John Wood
> Cc: Andrei Chichak; Ralf Corsepius; RTEMS List
> Subject: Re: Trouble pulling in libm
> 
> On 01/14/2011 06:17 AM, John Wood wrote:
>> I assumed that and actually am pulling in several libraries successfully myself so I did not expect this issue.
>> I am trying to refine things in terms of my issues.  I noticed on closer inspection that the math.h file inclusion does not appear quite right since it says the round function definition is implicitly defined.
> 
> To getting started, it would be sufficient to see the actual error message.
> 
> Ralf
> 
> PS.: I am asking, because I know about several issues with libm in 
> rtems4.10's and rtems4.11's newlib, which some of which have been 
> addressed, but have not yet been addressed in rtems4.9's newlib.
> 
> These issues typically show as link errors with the linker complaining 
> about missing symbols from deep inside of newlib.
> 
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users


-- 

--------------------------------------------
embedded brains GmbH
Thomas Doerfler        Obere Lagerstrasse 30
D-82178 Puchheim       Germany
email: Thomas.Doerfler at embedded-brains.de
Phone: +49-89-18908079-2
Fax:   +49-89-18908079-9
PGP:   Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list