FreeRADIUS / freeradius-server

FreeRADIUS - A multi-protocol policy server.
http://freeradius.org
GNU General Public License v2.0
2.12k stars 1.08k forks source link

compile problem of HAVE_LIBPCAP #2246

Closed NolanWoo closed 6 years ago

NolanWoo commented 6 years ago

Issue type

compile problem of HAVE_LIBPCAP


Defect

./configure make

A clear and concise list of steps describing how to describe the issue.

Output of [radiusd|freeradius] -X showing issue occurring

In file included from src/lib/pcap.c:27:0: src/freeradius-devel/pcap.h:72:16: error: ‘PCAP_ERRBUF_SIZE’ undeclared here (not in a function) char errbuf[PCAP_ERRBUF_SIZE]; //!< Last error on this interface. ^ src/freeradius-devel/pcap.h:81:2: error: unknown type name ‘pcap_t’ pcap_t handle; //!< libpcap handle. ^ src/freeradius-devel/pcap.h:82:2: error: unknown type name ‘pcap_dumper_t’ pcap_dumper_t dumper; //!< libpcap dumper handle. ^ src/freeradius-devel/pcap.h:87:19: error: field ‘pstats’ has incomplete type struct pcap_stat pstats; //!< The last set of pcap stats for this handle. ^ src/freeradius-devel/pcap.h:92:43: error: unknown type name ‘pcap_if_t’ int fr_pcap_if_link_layer(char errbuff, pcap_if_t dev); ^ src/lib/pcap.c: In function ‘_free_pcap’: src/lib/pcap.c:52:4: warning: implicit declaration of function ‘pcap_close’ [-Wimplicit-function-declaration] pcap_close(pcap->handle); ^ src/lib/pcap.c:64:4: warning: implicit declaration of function ‘pcap_dump_flush’ [-Wimplicit-function-declaration] pcap_dump_flush(pcap->dumper); ^ src/lib/pcap.c:65:4: warning: implicit declaration of function ‘pcap_dump_close’ [-Wimplicit-function-declaration] pcap_dump_close(pcap->dumper); ^ src/lib/pcap.c: At top level: src/lib/pcap.c:86:42: error: unknown type name ‘pcap_if_t’ int fr_pcap_if_link_layer(char errbuff, pcap_if_t dev) ^ src/lib/pcap.c: In function ‘fr_pcap_open’: src/lib/pcap.c:135:3: warning: implicit declaration of function ‘pcap_create’ [-Wimplicit-function-declaration] pcap->handle = pcap_create(pcap->name, pcap->errbuf); ^ src/lib/pcap.c:140:3: warning: implicit declaration of function ‘pcap_set_snaplen’ [-Wimplicit-function-declaration] if (pcap_set_snaplen(pcap->handle, SNAPLEN) != 0) { ^ src/lib/pcap.c:142:4: warning: implicit declaration of function ‘pcap_geterr’ [-Wimplicit-function-declaration] fr_strerror_printf("%s", pcap_geterr(pcap->handle)); ^ src/lib/pcap.c:142:4: warning: format ‘%s’ expects argument of type ‘char ’, but argument 2 has type ‘int’ [-Wformat=] src/lib/pcap.c:147:3: warning: implicit declaration of function ‘pcap_set_timeout’ [-Wimplicit-function-declaration] if (pcap_set_timeout(pcap->handle, PCAP_NONBLOCK_TIMEOUT) != 0) { ^ src/lib/pcap.c:150:3: warning: implicit declaration of function ‘pcap_set_promisc’ [-Wimplicit-function-declaration] if (pcap_set_promisc(pcap->handle, pcap->promiscuous) != 0) { ^ src/lib/pcap.c:154:3: warning: implicit declaration of function ‘pcap_set_buffer_size’ [-Wimplicit-function-declaration] if (pcap_set_buffer_size(pcap->handle, SNAPLEN ^ src/lib/pcap.c:158:3: warning: implicit declaration of function ‘pcap_activate’ [-Wimplicit-function-declaration] if (pcap_activate(pcap->handle) != 0) { ^ src/lib/pcap.c:176:3: warning: implicit declaration of function ‘pcap_setnonblock’ [-Wimplicit-function-declaration] if (pcap_setnonblock(pcap->handle, true, pcap->errbuf) != 0) { ^ src/lib/pcap.c:184:3: warning: implicit declaration of function ‘pcap_get_selectable_fd’ [-Wimplicit-function-declaration] pcap->fd = pcap_get_selectable_fd(pcap->handle); ^ src/lib/pcap.c:185:3: warning: implicit declaration of function ‘pcap_datalink’ [-Wimplicit-function-declaration] pcap->link_layer = pcap_datalink(pcap->handle); ^ src/lib/pcap.c:198:3: warning: implicit declaration of function ‘pcap_open_offline’ [-Wimplicit-function-declaration] pcap->handle = pcap_open_offline(pcap->name, pcap->errbuf); ^ src/lib/pcap.c:210:23: error: ‘DLT_EN10MB’ undeclared (first use in this function) pcap->link_layer = DLT_EN10MB; ^ src/lib/pcap.c:210:23: note: each undeclared identifier is reported only once for each function it appears in src/lib/pcap.c:212:3: warning: implicit declaration of function ‘pcap_open_dead’ [-Wimplicit-function-declaration] pcap->handle = pcap_open_dead(pcap->link_layer, SNAPLEN); ^ src/lib/pcap.c:212:16: warning: assignment makes pointer from integer without a cast [enabled by default] pcap->handle = pcap_open_dead(pcap->link_layer, SNAPLEN); ^ src/lib/pcap.c:218:3: warning: implicit declaration of function ‘pcap_dump_open’ [-Wimplicit-function-declaration] pcap->dumper = pcap_dump_open(pcap->handle, pcap->name); ^ src/lib/pcap.c:218:16: warning: assignment makes pointer from integer without a cast [enabled by default] pcap->dumper = pcap_dump_open(pcap->handle, pcap->name); ^ src/lib/pcap.c:220:4: warning: format ‘%s’ expects argument of type ‘char ’, but argument 2 has type ‘int’ [-Wformat=] fr_strerror_printf("%s", pcap_geterr(pcap->handle)); ^ src/lib/pcap.c:228:3: warning: implicit declaration of function ‘pcap_fopen_offline’ [-Wimplicit-function-declaration] pcap->handle = pcap_fopen_offline(stdin, pcap->errbuf); ^ src/lib/pcap.c:246:3: warning: implicit declaration of function ‘pcap_dump_fopen’ [-Wimplicit-function-declaration] pcap->dumper = pcap_dump_fopen(pcap->handle, stdout); ^ src/lib/pcap.c:246:16: warning: assignment makes pointer from integer without a cast [enabled by default] pcap->dumper = pcap_dump_fopen(pcap->handle, stdout); ^ src/lib/pcap.c:248:4: warning: format ‘%s’ expects argument of type ‘char ’, but argument 2 has type ‘int’ [-Wformat=] fr_strerror_printf("%s", pcap_geterr(pcap->handle)); ^ src/lib/pcap.c: In function ‘fr_pcap_apply_filter’: src/lib/pcap.c:277:2: error: unknown type name ‘bpf_u_int32’ bpf_u_int32 mask = 0; / Our netmask / ^ src/lib/pcap.c:278:2: error: unknown type name ‘bpf_u_int32’ bpf_u_int32 net = 0; / Our IP / ^ src/lib/pcap.c:279:21: error: storage size of ‘fp’ isn’t known struct bpf_program fp; ^ src/lib/pcap.c:298:3: warning: implicit declaration of function ‘pcap_lookupnet’ [-Wimplicit-function-declaration] if (pcap_lookupnet(pcap->name, &net, &mask, pcap->errbuf) < 0) { ^ src/lib/pcap.c:304:2: warning: implicit declaration of function ‘pcap_compile’ [-Wimplicit-function-declaration] if (pcap_compile(pcap->handle, &fp, expression, 0, net) < 0) { ^ src/lib/pcap.c:305:3: warning: format ‘%s’ expects argument of type ‘char ’, but argument 2 has type ‘int’ [-Wformat=] fr_strerror_printf("%s", pcap_geterr(pcap->handle)); ^ src/lib/pcap.c:310:2: warning: implicit declaration of function ‘pcap_setfilter’ [-Wimplicit-function-declaration] if (pcap_setfilter(pcap->handle, &fp) < 0) { ^ src/lib/pcap.c:311:3: warning: format ‘%s’ expects argument of type ‘char ’, but argument 2 has type ‘int’ [-Wformat=] fr_strerror_printf("%s", pcap_geterr(pcap->handle)); ^ src/lib/pcap.c:279:21: warning: unused variable ‘fp’ [-Wunused-variable] struct bpf_program fp; ^ src/lib/pcap.c: In function ‘fr_pcap_link_layer_supported’: src/lib/pcap.c:362:7: error: ‘DLT_EN10MB’ undeclared (first use in this function) case DLT_EN10MB: ^ src/lib/pcap.c:363:7: error: ‘DLT_RAW’ undeclared (first use in this function) case DLT_RAW: ^ src/lib/pcap.c:364:7: error: ‘DLT_NULL’ undeclared (first use in this function) case DLT_NULL: ^ src/lib/pcap.c:365:7: error: ‘DLT_LOOP’ undeclared (first use in this function) case DLT_LOOP: ^ src/lib/pcap.c:369:7: error: ‘DLT_PFLOG’ undeclared (first use in this function) case DLT_PFLOG: ^ src/lib/pcap.c: In function ‘fr_pcap_link_layer_offset’: src/lib/pcap.c:398:7: error: ‘DLT_RAW’ undeclared (first use in this function) case DLT_RAW: ^ src/lib/pcap.c:401:7: error: ‘DLT_NULL’ undeclared (first use in this function) case DLT_NULL: ^ src/lib/pcap.c:402:7: error: ‘DLT_LOOP’ undeclared (first use in this function) case DLT_LOOP: ^ src/lib/pcap.c:412:7: error: ‘DLT_EN10MB’ undeclared (first use in this function) case DLT_EN10MB: ^ src/lib/pcap.c:460:7: error: ‘DLT_PFLOG’ undeclared (first use in this function) case DLT_PFLOG: ^ src/lib/pcap.c: At top level: cc1: warning: unrecognized command line option "-Wno-date-time" [enabled by default] make: *** [build/objs/src/lib/pcap.lo] Error 1


after that, HAVE_LIBPCAP was set to 1 :
| 
|           #include <pcap.h>
| int
| main ()
| {
| int a = 1;
|   ;
|   return 0;
| }
configure:9152: result: no
configure:9127: checking for pcap.h in /usr/src/linux-headers-3.13.0-128-generic/include/config/ezx
configure:9142: gcc -c -g -O2 -Wall -std=c99 -D_GNU_SOURCE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DOPENSSL_NO_KRB5 -isystem /usr/src/linux-headers-3.13.0-128-generic/include/config/ezx      conftest.c >&5
conftest.c: In function 'main':
conftest.c:108:5: warning: unused variable 'a' [-Wunused-variable]
 int a = 1;
     ^
configure:9142: $? = 0
configure:9145: result: yes
configure:9182: skipping test for collectd/client.h.
configure:9425: skipping test for cap.h.
configure:9666: checking for off_t
configure:9666: gcc -c -g -O2 -Wall -std=c99 -D_GNU_SOURCE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DOPENSSL_NO_KRB5 -isystem /usr/src/linux-headers-3.13.0-128-generic/include/config/ezx      conftest.c >&5
configure:9666: $? = 0
configure:9666: gcc -c -g -O2 -Wall -std=c99 -D_GNU_SOURCE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DOPENSSL_NO_KRB5 -isystem /usr/src/linux-headers-3.13.0-128-generic/include/config/ezx      conftest.c >&5
conftest.c: In function 'main':
conftest.c:140:20: error: expected expression before ')' token
 if (sizeof ((off_t)))
                    ^
configure:9666: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "freeradius"
| #define PACKAGE_TARNAME "freeradius"
| #define PACKAGE_VERSION "$Id: 32970d7f796442d9b6b447cf91190aa9a4ee3ba2 $"
| #define PACKAGE_STRING "freeradius $Id: 32970d7f796442d9b6b447cf91190aa9a4ee3ba2 $"
| #define PACKAGE_BUGREPORT "http://bugs.freeradius.org"
| #define PACKAGE_URL "http://www.freeradius.org"
| #define RADIUSD_VERSION 030018
| #define RADIUSD_VERSION_STRING "3.0.18"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define FR_LITTLE_ENDIAN 1
| #define WITH_ASCEND_BINARY 1
| #define WITH_TCP 1
| #define WITH_VMPS 1
| #define WITH_DHCP 1
| #define WITH_UDPFROMTO /**/
| #define ENABLE_OPENSSL_VERSION_CHECK 1
| #define HAVE_PTHREAD_H 1
| #define WITH_THREADS 1
| #define HAVE_LIBDL 1
| #define HAVE_LIBRESOLV 1
| #define HAVE_LIBNSL 1
| #define HAVE_PCAP_FOPEN_OFFLINE 1
| #define HAVE_PCAP_DUMP_FOPEN 1
| #define HAVE_PCAP_CREATE 1
| #define HAVE_PCAP_ACTIVATE 1
| #define HAVE_DIRENT_H 1
| #define STDC_HEADERS 1
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_CRYPT_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_FEATURES_H 1
| #define HAVE_FNMATCH_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_GLOB_H 1
| #define HAVE_GRP_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_LINUX_IF_PACKET_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_PWD_H 1
| #define HAVE_SEMAPHORE_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_STDBOOL_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_SYS_FCNTL_H 1
| #define HAVE_SYS_PRCTL_H 1
| #define HAVE_SYS_PTRACE_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_UTMP_H 1
| #define HAVE_UTMPX_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_LIBCRYPTO 1
| #define HAVE_LIBSSL 1
| #define HAVE_OPENSSL_SSL_H 1
| #define HAVE_OPENSSL_ASN1_H 1
| #define HAVE_OPENSSL_CONF_H 1
| #define HAVE_OPENSSL_CRYPTO_H 1
| #define HAVE_OPENSSL_ERR_H 1
| #define HAVE_OPENSSL_EVP_H 1
| #define HAVE_OPENSSL_HMAC_H 1
| #define HAVE_OPENSSL_MD5_H 1
| #define HAVE_OPENSSL_MD4_H 1
| #define HAVE_OPENSSL_SHA_H 1
| #define HAVE_OPENSSL_SSL_H 1
| #define HAVE_OPENSSL_OCSP_H 1
| #define HAVE_OPENSSL_ENGINE_H 1
| #define HAVE_CONF_MODULES_LOAD_FILE 1
| #define HAVE_CRYPTO_SET_ID_CALLBACK 1
| #define HAVE_CRYPTO_SET_LOCKING_CALLBACK 1
| #define HAVE_LIBPCAP 1
| /* end confdefs.h.  */

Full backtrace from LLDB or GDB

COPY/PASTE OUTPUT HERE (WITHIN BACKTICKS).  NO PASTEBIN (ET AL) LINKS!
arr2036 commented 6 years ago

Your system is broken, specify the paths to the libpcap headers and libraries manually. See the output of ./configure --help.