Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
undefined reference to `__errno' - Linker bug?
05-09-2014, 04:38 PM,
#1
undefined reference to `__errno' - Linker bug?
Hello there!

I'm on
- Pinguino ide 11.20140905
- Ubuntu 14.04 x86_64

when I try to compile this code

void setup() {
}
void loop() {
float a;
pow(a , 10 );
}


for any of the 32-bits architectures I get a number of

undefined reference to `__errno'
/usr/bin/../lib/gcc/mips-elf/4.9.1/../../../../mips-elf/lib/libm.a(lib_a-wf_pow.o): In function `powf':


errors during link (full stdout is in attach)

This is the smaller piece of code I 'm able to reproduce the problem with.
Did I step into a linker bug or what else?

Anyone can please try to compile this to see if it's only me ....

Tnx
Marco


Attached Files
.txt   stdout.txt (Size: 9.42 KB / Downloads: 2)
Reply
05-09-2014, 05:29 PM,
#2
RE: undefined reference to `__errno' - Linker bug?
I guess on a uC no-one uses pow.

Just define errno (with some leading underscores as needed).

John
Reply
07-09-2014, 06:28 PM,
#3
RE: undefined reference to `__errno' - Linker bug?
Here is the problem:

/usr/bin/../lib/gcc/mips-elf/4.9.1/../../../../mips-elf/bin/ld: Warning: /home/regis/.pinguino/source/main32.elf uses -msoft-float (set by /usr/bin/../lib/gcc/mips-elf/4.9.1/soft-float/el/crtbegin.o), /usr/bin/../lib/gcc/mips-elf/4.9.1/../../../../mips-elf/lib/libm.a(lib_a-sf_copysign.o) uses -mhard-float

I will check how I build newlib/libm for gcc_mips-elf 4.9.1.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
10-09-2014, 02:17 PM,
#4
RE: undefined reference to `__errno' - Linker bug?
I fixed the hard-float issue but I still get :
undefined reference to `__errno' /usr/bin/../lib/gcc/mips-elf/4.9.1/../../../../mips-elf/lib/libm.a(lib_a-wf_pow.o): In function `powf':
so there must be an issue in the newlib library ...
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
10-09-2014, 03:47 PM,
#5
RE: undefined reference to `__errno' - Linker bug?
Tnx Regis
I probably found it: in source/Makefile32.linux at line 69-70 -lc have been removed from LIBS variable
Setting it as
LIBS = -lm -lgcc -lc
seems to solve `__errno' issue.
Reply
10-09-2014, 04:50 PM,
#6
RE: undefined reference to `__errno' - Linker bug?
oops ... fixed. Thanks.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)