Implict declarations of functions
Closed this issue · 10 comments
Which system, libc and compiler are you using?
stdlib.h
is included in both files, I'm wondering if its related to using #include_next
in the compat headers.
Gentoo, glibc, clang 3.9.1 and gcc 5.4.0-r3
Same issue here when trying to build under Debian stretch (with gcc 6.3.0).
Thanks for reporting, a debian environment to test was easier to setup, this should be fixed by 3a8a009.
Many thanks for your quick help! Indeed, I could compile a large number of sources. However, i got stuck at the first linker step
gcc -o bc bc.o scan.o tty.o dc.o bcode.o inout.o mem.o stack.o -ledit -lcurses -lcrypto
bc.o: In function `yyerror':
/data/obj/usr.bin/bc/../../..//usr.bin/bc/bc.y:954: undefined reference to `yyin'
One should be able to reproduce this in a debian:stretch container.
You need to install flex and run ./configure
again.
I'm going improve the configure script to fail if some of the dependencies are not found.
Ok, many thanks. I managed to build everything.
Along the way, compilation of find
did not succeed due to the following
error: 'ARG_MAX' undeclared (first use in this function)
which I got by with this fix.
Well done @Duncaen !
Closing this issue as you fixed the implict declarations of functions.
Can I suggest simple version of uname.c
?
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/utsname.h>
#define MAX_STRING_SIZE 1024
int main(int argc, char *argv[]) {
int ch = 0;
char buf[MAX_STRING_SIZE];
char *all = buf;
struct utsname KerneL;
memset(&KerneL, 0, sizeof(struct utsname));
if (-1 == (uname(&KerneL))) {
fprintf(stderr, "%s\n", "uname() failed");
return EXIT_FAILURE;
}
if (1 == argc) {
puts(KerneL.sysname);
}
while (-1 != (ch = getopt(argc, argv, "asnrvm"))) {
switch(ch) {
case 'a':
all += snprintf(all, MAX_STRING_SIZE-1, "%s %s %s %s %s ",
KerneL.sysname, KerneL.nodename, KerneL.release,
KerneL.version, KerneL.machine);
break;
case 's':
all += snprintf(all, MAX_STRING_SIZE-1, "%s ", KerneL.sysname);
break;
case 'n':
all += snprintf(all, MAX_STRING_SIZE-1, "%s ", KerneL.nodename);
break;
case 'r':
all += snprintf(all, MAX_STRING_SIZE-1, "%s ", KerneL.release);
break;
case 'v':
all += snprintf(all, MAX_STRING_SIZE-1, "%s ", KerneL.version);
break;
case 'm':
all += snprintf(all, MAX_STRING_SIZE-1, "%s ", KerneL.machine);
break;
}
}
*(--all) = '\0';
puts(buf);
return EXIT_SUCCESS;
}