Closed jmceara closed 7 years ago
You need to tell me what you ran and what the errors were; a vague description doesn't give me anything I can diagnose.
[jmaurin@skynet dump1090]$ make gcc -DMODES_DUMP1090_VERSION=\"v1.15-dev-308-gccd8fd5\" -O2 -g -Wall -Wmissing-declarations -W -std=c11 -D_DEFAULT_SOURCE
pkg-config --cflags librtlsdr-c dump1090.c -o dump1090.o dump1090.c: In function ‘log_with_timestamp’: dump1090.c:73:5: warning: implicit declaration of function ‘localtime_r’ [-Wimplicit-function-declaration] localtime_r(&now, &local); ^ dump1090.c: At top level: dump1090.c:103:5: warning: no previous declaration for ‘getTermRows’ [-Wmissing-declarations] int getTermRows() { ^ dump1090.c:110:6: warning: no previous declaration for ‘sigWinchCallback’ [-Wmissing-declarations] void sigWinchCallback() { ^ dump1090.c: In function ‘start_cpu_timing’: dump1090.c:122:5: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration] clock_gettime(CLOCK_THREAD_CPUTIME_ID, start_time); ^ dump1090.c:122:19: error: ‘CLOCK_THREAD_CPUTIME_ID’ undeclared (first use in this function) clock_gettime(CLOCK_THREAD_CPUTIME_ID, start_time); ^ dump1090.c:122:19: note: each undeclared identifier is reported only once for each function it appears in dump1090.c: In function ‘end_cpu_timing’: dump1090.c:128:19: error: ‘CLOCK_THREAD_CPUTIME_ID’ undeclared (first use in this function) clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end_time); ^ dump1090.c: At top level: dump1090.c:138:6: warning: no previous declaration for ‘modesInitConfig’ [-Wmissing-declarations] void modesInitConfig(void) { ^ dump1090.c: In function ‘modesInitConfig’: dump1090.c:148:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration] Modes.net_input_raw_ports = strdup("30001"); ^ dump1090.c:148:35: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_input_raw_ports = strdup("30001"); ^ dump1090.c:149:35: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_raw_ports = strdup("30002"); ^ dump1090.c:150:35: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_sbs_ports = strdup("30003"); ^ dump1090.c:151:35: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_input_beast_ports = strdup("30004,30104"); ^ dump1090.c:152:35: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_beast_ports = strdup("30005"); ^ dump1090.c: At top level: dump1090.c:166:6: warning: no previous declaration for ‘modesInit’ [-Wmissing-declarations] void modesInit(void) { ^ dump1090.c: In function ‘modesInit’: dump1090.c:233:13: warning: implicit declaration of function ‘le16toh’ [-Wimplicit-function-declaration] Modes.maglut[le16toh((i*256)+q)] = (uint16_t) round(sqrtf(magsq) * 65535.0); ^ dump1090.c: At top level: dump1090.c:277:5: warning: no previous declaration for ‘modesInitRTLSDR’ [-Wmissing-declarations] int modesInitRTLSDR(void) { ^ dump1090.c:390:6: warning: no previous declaration for ‘rtlsdrCallback’ [-Wmissing-declarations] void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) { ^ dump1090.c: In function ‘rtlsdrCallback’: dump1090.c:455:19: error: ‘CLOCK_REALTIME’ undeclared (first use in this function) clock_gettime(CLOCK_REALTIME, &outbuf->sysTimestamp); ^ dump1090.c: At top level: dump1090.c:490:6: warning: no previous declaration for ‘readDataFromFile’ [-Wmissing-declarations] void readDataFromFile(void) { ^ dump1090.c: In function ‘readDataFromFile’: dump1090.c:511:19: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function) clock_gettime(CLOCK_MONOTONIC, &next_buffer_delivery); ^ dump1090.c:543:23: error: ‘CLOCK_REALTIME’ undeclared (first use in this function) clock_gettime(CLOCK_REALTIME, &outbuf->sysTimestamp); ^ dump1090.c:565:13: warning: implicit declaration of function ‘clock_nanosleep’ [-Wimplicit-function-declaration] while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &next_buffer_delivery, NULL) == EINTR) ^ dump1090.c:565:53: error: ‘TIMER_ABSTIME’ undeclared (first use in this function) while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &next_buffer_delivery, NULL) == EINTR) ^ dump1090.c: At top level: dump1090.c:597:7: warning: no previous declaration for ‘readerThreadEntryPoint’ [-Wmissing-declarations] void *readerThreadEntryPoint(void *arg) { ^ dump1090.c:646:6: warning: no previous declaration for ‘snipMode’ [-Wmissing-declarations] void snipMode(int level) { ^ dump1090.c:664:6: warning: no previous declaration for ‘showHelp’ [-Wmissing-declarations] void showHelp(void) { ^ dump1090.c:752:6: warning: no previous declaration for ‘backgroundTasks’ [-Wmissing-declarations] void backgroundTasks(void) { ^ dump1090.c: In function ‘backgroundTasks’: dump1090.c:834:26: error: ‘PATH_MAX’ undeclared (first use in this function) char filebuf[PATH_MAX]; ^ dump1090.c:834:18: warning: unused variable ‘filebuf’ [-Wunused-variable] char filebuf[PATH_MAX]; ^ dump1090.c: In function ‘main’: dump1090.c:931:28: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.dev_name = strdup(argv[++j]); ^ dump1090.c:939:28: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.filename = strdup(argv[++j]); ^ dump1090.c:942:13: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration] if (!strcasecmp(argv[j], "uc8")) { ^ dump1090.c:986:40: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_raw_ports = strdup(argv[++j]); ^ dump1090.c:989:39: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_input_raw_ports = strdup(argv[++j]); ^ dump1090.c:992:42: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_beast_ports = strdup(argv[++j]); ^ dump1090.c:995:41: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_input_beast_ports = strdup(argv[++j]); ^ dump1090.c:998:36: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_bind_address = strdup(argv[++j]); ^ dump1090.c:1010:40: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.net_output_sbs_ports = strdup(argv[++j]); ^ dump1090.c:1088:28: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.html_dir = strdup(argv[++j]); ^ dump1090.c:1091:28: warning: assignment makes pointer from integer without a cast [enabled by default] Modes.json_dir = strdup(argv[++j]); ^ dump1090.c:1169:13: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] usleep(100000); ^ dump1090.c:1188:31: error: ‘CLOCK_REALTIME’ undeclared (first use in this function) clock_gettime(CLOCK_REALTIME, &ts); ^ make: *** [dump1090.o] Error 1 [jmaurin@skynet dump1090]$
I guess you have a libc that doesn't understand _DEFAULT_SOURCE.
Also your gcc appears to turn on some extra warnings by defaults which is going to cause you problems.
I don't try compiling on CentOS/RH here; you'll need to work this one out yourself I'm afraid. If you have a Makefile patch I'm happy to take that.
Hi. I'm trying to compile in CentOS 7, but I'm getting a lot of errors....mostly of implicity declaration of functions and not defined constants (CLOCK_REALTIME, for example). All needed libraries are included. GCC version 4.8.5.