Page 1 of 1

Compilation problems

Posted: Mon May 05, 2014 11:27 am
by jfsanchez
Hello everybody:
I'm training to compile this simple program using menuetlibc:

This's the main.c file:

#include <stdio.h>
int main(void)
{
FILE* a;
a = fopen("mio.txt","w");
fprintf(a,"Hello");
fclose(a);
return 0;
}


And here the Makefile:

OUTFILE = main
OBJS = main.o
include $(MENUETDEV)/makefiles/Makefile_for_program

I have my env OK, I'm using Linux and MENUETDEV is OK.
When I type make, it return some errors:
[MyHome]/menuetlibc/linuxtools/mld main main.o -n -Map main.map
[MyHome]/menuetlibc/lib/libc.a(fprintf.o): In function `fprintf':
fprintf.c:(.text+0x20): undefined reference to `va_start'
fprintf.c:(.text+0x8a): undefined reference to `va_end'
fprintf.c:(.text+0xa8): undefined reference to `__stack_chk_fail'
[MyHome]/menuetlibc/lib/libc.a(doprnt.o): In function `_doprnt':
doprnt.c:(.text+0x13af): undefined reference to `__stack_chk_fail'
[MyHome]/menuetlibc/lib/libc.a(remove.o): In function `remove':
remove.c:(.text+0x9a): undefined reference to `__stack_chk_fail'
make: *** [main] Error 1

Any idea about what is this??

Re: Compilation problems

Posted: Mon May 05, 2014 1:47 pm
by SoUrcerer
Some problems with varargs. I can't say for sure, but - please - check your preprocessor definitions.