2011-05-16 11:38:41     Using nearbyint() results in undefined reference

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2011-05-16 11:38:41     Using nearbyint() results in undefined reference

Tarjei Knapstad (NORWAY)

Message: 100674   

 

I have some C++ code that uses nearbyint(), but when I try to compile it for Blackfin (BF561) I get undefined references:

 

      undefined reference to `_nearbyint'

 

GCC supplies builtins for nearbyint(), but I get the same error if I try to link with the math library (-lm). Does anyone know how I can get this to link?

QuoteReplyEditDelete

 

 

2011-05-16 12:22:14     Re: Using nearbyint() results in undefined reference

Stuart Henderson (UNITED KINGDOM)

Message: 100676   

 

Hi,

 

i'm not seeing this problem, could you provide a sample program and command line?  also, what version of the tools are you using?

 

thanks,

 

Stu

QuoteReplyEditDelete

 

 

2011-05-16 13:38:20     Re: Using nearbyint() results in undefined reference

Mike Frysinger (UNITED STATES)

Message: 100679   

 

it isnt implemented currently in uClibc (i.e. Linux userspace apps).  it should work for bare metal though.

 

$ cat test.c

main(int argc){return nearbyint(argc);}

$ bfin-elf-gcc test.c -lm -mcpu=bf537

<works>

$ bfin-linux-uclibc-gcc test.c -lm

<fails>

$ bfin-uclinux-gcc test.c -lm

<fails>

QuoteReplyEditDelete

 

 

2011-05-18 05:05:47     Re: Using nearbyint() results in undefined reference

Tarjei Knapstad (NORWAY)

Message: 100719   

 

Ah, thanks for explaining Mike. I think I'll just define my own nearbyint to be round(x + 0.5) in that case (and possibly provide a patch for uClibc at some point down the road if I can find the time :))

Attachments

    Outcomes