This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler cannot link to libpcap.so.1

Hi, all,

I just start using BeagleBone Black with TI linux sdk(linux-am335x-evm-03.01.00.06). I've installed sdk on Ubuntu 14.04 and added Wilink8 patch to it(followed instructions from TI, built and examined). libpcap.so.1 and libpcap.so.1.7.4 are in the sdk.

Now I want to develop on it with CCS. However I met some problem when I tried to use pcap in my code. I include an header "pcap.h" in my code but gcc cannot find it. I've tried some methods I could do with it, i.e.link libpcap(checked in /home/beagle/ti-processor-sdk-linux-am335x-evm-03.01.00.06/sdk3-wilink-filesystem-e14/usr/lib/libpcap.so.1) to compiler(absolute/relative path) in Makefile,   build project under environment_setup. I use "ldconfig -p" to check packages I have, another older version libpcap is in cache.  

Code is pretty simple. I'm sure this is the problem.

#include <pcap.h>

Makefile

-include /home/beagle/ti-processor-sdk-linux-am335x-evm-03.01.00.06/Rules.make

#   ----------------------------------------------------------------------------
#   Variables passed in externally
#   ----------------------------------------------------------------------------
PLATFORM ?=
ARCH ?=
CROSS_COMPILE ?=

#   ----------------------------------------------------------------------------
#   Name of the Linux compiler
#   ----------------------------------------------------------------------------
CC := $(CROSS_COMPILE)gcc

#   ----------------------------------------------------------------------------
#   General options, sources and libraries
#   ----------------------------------------------------------------------------
NAME := hello
SRCS := hello.c
HDRS := 
OBJS :=
DEBUG :=
BIN := hello

#   ----------------------------------------------------------------------------
#   Compiler and Linker flags for Debug
#   ----------------------------------------------------------------------------
OBJDIR_D := Debug
BINDIR_D := $(OBJDIR_D)
LIBS_D := $(LIBS)
OBJS_D := $(SRCS:%.c=$(OBJDIR_D)/%.o)
ALL_DEBUG := -g3 -gdwarf-2

#   ----------------------------------------------------------------------------
#   Compiler include directories 
#   ----------------------------------------------------------------------------
INCLUDES := 

#   ----------------------------------------------------------------------------
#   All compiler options to be passed to the command line
#   ----------------------------------------------------------------------------
ALL_CFLAGS := $(INCLUDES)                   \
              -static                       \
              -c                            \
              $(CFLAGS)			    \
              -lpcap

LDFLAGS :=

#   ----------------------------------------------------------------------------
#   Compiler symbol definitions 
#   ----------------------------------------------------------------------------
DEFS :=

#   ----------------------------------------------------------------------------
#   Compiler and Linker procedure
#   From this point and on changes are very unlikely.
#   ----------------------------------------------------------------------------
all: debug 

#   ----------------------------------------------------------------------------
#   Building Debug... 
#   ----------------------------------------------------------------------------
debug: $(BINDIR_D)/$(BIN)

#$(BINDIR_D)/$(BIN): $(OBJS_D)
#	@mkdir -p $(OBJDIR_D)
#	@echo Compiling Debug...
#	$(CC) -o $@ $(OBJS_D) $(LIBS_D) $(LDFLAGS)  -Wl,-Map,$(BINDIR_D)/$(NAME).map 

$(OBJDIR_D)/%.o : %.c $(HDRS)
	@mkdir -p $(OBJDIR_D)
	$(CC) $(ALL_DEBUG) $(DEFS) $(ALL_CFLAGS) -o$@ $<


clean:
	@rm -rf $(OBJDIR_D)

Error is 

/home/beagle/ti-processor-sdk-linux-am335x-evm-03.01.00.06/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc -g3 -gdwarf-2   -static -c -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -lpcap -oDebug/hello.o hello.c
hello.c:2:18: fatal error: pcap.h: No such file or directory