vsprintf: undefined reference to `_sbrk'

Asked by Mario Ribeiro

Hi,
I have a function that I use for debbuging purposes and that uses vsprintf.

void LOG(char *text, ...)
{
  char buf[_LOGSTR_BUFSIZE];
  va_list args;
  va_start(args, text);
  vsprintf(buf,text, args);
  _send_string(buf);
  va_end(args);
}

This is part of a static library and when I link it with an application program (which provides the main() function) I get the following error:

/linux/arm/gcc/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
collect2: error: ld returned 1 exit status

If I remove the line that contains the vsprintf then the error is gone so this way I know the issue is related with vsprintf but I can't understand why? Any suggestion?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Joey Ye (jinyun-ye) said :
#1

Can you help with this problem?

Provide an answer of your own, or ask Mario Ribeiro for more information if necessary.

To post a message you must log in.