Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined reference to `__errno_location'

Tags:

android-ndk

I am compileing application for ndk, i am getting error "undefined reference to `__errno_location'".

The error comes from a line

sprintf( buff, "%s TIOCMGET failed: %s\n", buff, strerror(errno) );

If I comment this line, the linker does not complain about the same otherwise it does.

I am trying to build my own executable for android using Sourcery G++ Lite's arm-none-linux-gnueabi-gcc tool chain.

like image 656
BTR Naidu Avatar asked May 02 '12 12:05

BTR Naidu


1 Answers

From what I can gather, your compiler is referencing a symbol __errno_location which cannot be found in any of the libraries which the linker is looking at.

This suggests that either:

  1. You don't have the correct libraries; or
  2. You do have the correct libraries but they're not being provided to the linker; or
  3. You don't have the correct headers.

If the header doesn't match the library then symbols can have the wrong name and so you can get such link errors.

It appears that you're including the compilers' LibC headers and then linking against the android library which might not always work.

like image 113
Nick Avatar answered Nov 09 '22 09:11

Nick