Subject: lib install problem
To: None <netbsd-help@netbsd.org, netbsd-users@netbsd.org>
From: Steve Tremblett <sjt@cisco.com>
List: netbsd-users
Date: 10/26/2002 14:06:54
I need to use libnet to inject ethernet frames to test a networking
tool I'm writing. I checked /usr/pkgsrc but the version there is
outdated so I got the latest version and installed by hand. Everything
seems to work ok, but I can't link against the lib no matter what I
try. It is a static (".a") lib, if that matters.
I originally installed it in /usr/pkg/lib but that didn't work (even
after running ldconfig /usr/pkg/lib). Then I installed in /usr/lib,
with no difference. Changing "-llibnet" to "-lnet" results in
"undefined reference" errors for all the functions.
HELP PLEASE!
/home/sjt/tcpip/ether_write % cat Makefile
CFLAGS=-I/usr/pkg/include -O -g -Wall
LDFLAGS=-llibnet
CC=gcc
all: ether_write
ether_write: ether_write.c
$(CC) $(CFLAGS) $(LDFLAGS) ether_write.c -o ether_write
/home/sjt/tcpip/ether_write % ls /usr/lib/libnet*
/usr/lib/libnet.a
/home/sjt/tcpip/ether_write % make
gcc -I/usr/pkg/include -O -g -Wall -llibnet ether_write.c -o ether_write
/usr/bin/ld: cannot open -llibnet: No such file or directory
collect2: ld returned 1 exit status
*** Error code 1
Stop.
At this point I tried to change to "-lnet" instead of "-llibnet" which
results in this:
/home/sjt/tcpip/ether_write % make
gcc -I/usr/pkg/include -O -g -Wall -lnet ether_write.c -o ether_write
/tmp/cctslD53.o: In function `main':
/home/sjt/tcpip/ether_write/ether_write.c:29: undefined reference to `libnet_init'
/home/sjt/tcpip/ether_write/ether_write.c:36: undefined reference to `libnet_build_ethernet'
/home/sjt/tcpip/ether_write/ether_write.c:45: undefined reference to `libnet_write'
/home/sjt/tcpip/ether_write/ether_write.c:49: undefined reference to `libnet_destroy'
/home/sjt/tcpip/ether_write/ether_write.c:41: undefined reference to `libnet_destroy'
collect2: ld returned 1 exit status
*** Error code 1
Stop.
--
Steve Tremblett