reassign 626232 libpcap0.8 1.1.1-4
severity 626232 grave
retitle 626232 libpcap0.8: undefined reference to clock_gettime on kFreeBSD
thanks

configure:21655: gcc -o conftest -g -O2 -O2 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS   
conftest.c -lpcap  -lnsl -lresolv  -lpthread >&5
/usr/lib/gcc/i486-kfreebsd-gnu/4.6.1/../../../libpcap.so: undefined reference 
to `clock_gettime'
collect2: ld returned 1 exit status

I think that clock_gettime is in libc on "true" FreeBSD, but it's in librt on GNU/* systems. The attached patch should fix this bug. (At least I could rebuild freeradius successfuly on kfreebsd-i386.)

--
Jakub Wilk
Index: libpcap-1.1.1/configure
===================================================================
--- libpcap-1.1.1.orig/configure	2011-05-10 17:14:14.000000000 +0200
+++ libpcap-1.1.1/configure	2011-05-10 17:22:00.000000000 +0200
@@ -7796,6 +7796,7 @@
 
 fi
 
+	    LIBS="$LIBS -lrt"
 	;;
 
 dag)
Index: libpcap-1.1.1/configure.in
===================================================================
--- libpcap-1.1.1.orig/configure.in	2011-05-10 17:13:20.000000000 +0200
+++ libpcap-1.1.1/configure.in	2011-05-10 17:22:00.000000000 +0200
@@ -491,6 +491,7 @@
 #endif
 #include <net/bpf.h>
 		    ])
+	    LIBS="$LIBS -lrt"
 	;;
 
 dag)
Index: libpcap-1.1.1/Makefile.in
===================================================================
--- libpcap-1.1.1.orig/Makefile.in	2011-05-10 17:22:05.000000000 +0200
+++ libpcap-1.1.1/Makefile.in	2011-05-10 17:22:25.000000000 +0200
@@ -426,7 +426,7 @@
 $(SHAREDLIB): $(OBJ_PIC)
 	-@rm -f $@
 	-@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
-	$(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
+	$(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS)
 	ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
 	ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
 

Reply via email to