Thread: [libdnet-devel] [ARM] My sample link error.
Status: Abandoned
Brought to you by:
dugsong
|
From: jang,suk-woo <jha...@gm...> - 2005-04-11 16:04:08
|
arm cross compiler version => 2.95.2
libdnet-1.10 cross compile success.
but My sample program link error.
error message =>
//////////////////////////////////////////////////////
dnet_test.o: In function 'main'
dnet_test.o(.text+0x60): undefined reference to 'eth_close'
dnet_test.o(.text+0x60): relocation truncated to fit: R_ARM_PC24 eth_close
collect2: ld returned 1 exit status
make: *** [dnet_test] Error 1
//////////////////////////////////////////////////////
<<Makefile>>
//////////////////////////////////////////////////////
KERNERDIR = /usr/src/s3c2800
CFLAGS = -I$(KERNELDIR)/include -O
CC=arm-linux-gcc
all: dnet_test
cp -a dnet_test /nfs
dnet_test.o: dnet_test.c
$(CC) $(CFLAGS) -c dnet_test.c
dnet_test: dnet_test.o /usr/arm-linux/lib/libdnet.a
//////////////////////////////////////////////////////
<<dnet_test.c>>
//////////////////////////////////////////////////////
#include <stdio.h>
#include <dnet.h>
unsigned char arp_sample[1000];
int arp_sample_len;
main()
{
eth_t *h_eth;
//<<ellipsis>>
h_eth = eth_open("eth0");
eth_send(h_eth, arp_sample, arp_sample_len);
eth_close(h_eth);
}
|
|
From: Dug S. <du...@mo...> - 2005-04-11 16:37:43
|
On Tue, Apr 12, 2005 at 01:03:08AM +0900, jang,suk-woo wrote: > dnet_test.o: In function 'main' > dnet_test.o(.text+0x60): undefined reference to 'eth_close' > dnet_test.o(.text+0x60): relocation truncated to fit: R_ARM_PC24 eth_close > collect2: ld returned 1 exit status > make: *** [dnet_test] Error 1 > > > <<Makefile>> > KERNERDIR = /usr/src/s3c2800 > CFLAGS = -I$(KERNELDIR)/include -O > CC=arm-linux-gcc > > all: dnet_test > cp -a dnet_test /nfs > > dnet_test.o: dnet_test.c > $(CC) $(CFLAGS) -c dnet_test.c > > dnet_test: dnet_test.o /usr/arm-linux/lib/libdnet.a your Makefile is just wrong. you need to actually link the library in: > dnet_test.o: dnet_test.c > $(CC) $(CFLAGS) -c dnet_test.c -L/usr/arm-linux/lib -ldnet or > dnet_test.o: dnet_test.c > $(CC) $(CFLAGS) -c dnet_test.c /usr/arm-linux/lib/libdnet.a or > dnet_test.o: dnet_test.c > $(CC) `dnet-config --cflags` -c dnet_test.c `dnet-config --libs` if you've installed libdnet correctly. -d. --- http://monkey.org/~dugsong/ |
|
From: Dug S. <du...@mo...> - 2005-04-11 16:50:10
|
On Mon, Apr 11, 2005 at 12:37:34PM -0400, Dug Song wrote: > > dnet_test.o: dnet_test.c > > $(CC) $(CFLAGS) -c dnet_test.c -L/usr/arm-linux/lib -ldnet > > or > > > dnet_test.o: dnet_test.c > > $(CC) $(CFLAGS) -c dnet_test.c /usr/arm-linux/lib/libdnet.a > > or > > > dnet_test.o: dnet_test.c > > $(CC) `dnet-config --cflags` -c dnet_test.c `dnet-config --libs` > > if you've installed libdnet correctly. oh hell, i didn't read your Makefile carefully. sorry, those are wrong too. :-) you can just do: > dnet_test: dnet_test.c > $(CC) `dnet-config --cflags` -o $@ $< `dnet-config --libs` -d. --- http://monkey.org/~dugsong/ |
|
From: jang,suk-woo <jha...@gm...> - 2005-04-11 17:49:59
|
Thank you! but error. [ipqam] make arm-linux-gcc `dnet-config --cflags` -o dnet_test dnet_test.c `dnet-config --libs` /tmp/ccvGvrtp.o: In function `main': /tmp/ccvGvrtp.o(.text+0x80): undefined reference to `eth_close' /tmp/ccvGvrtp.o(.text+0x80): relocation truncated to fit: R_ARM_PC24 eth_close collect2: ld returned 1 exit status make: *** [dnet_test] Error 1 >>dnet_test: dnet_test.c >> $(CC) `dnet-config --cflags` -o $@ $< `dnet-config --libs` >> >> < reference> libnet cross-compiling sequence. $cd libnet-1.10 $CC=arm-linux-gcc AR=arm-linux-ar LD=arm-linux-ld RANLIB=arm-linux-ranlib ./configure --prefix=/usr/arm-linux --build=i686-linux --host=arm-linux $make $make install |
|
From: Dug S. <du...@mo...> - 2005-04-11 19:07:59
|
On Tue, Apr 12, 2005 at 02:46:46AM +0900, jang,suk-woo wrote: > [ipqam] make > arm-linux-gcc `dnet-config --cflags` -o dnet_test dnet_test.c > `dnet-config --libs` > /tmp/ccvGvrtp.o: In function `main': > /tmp/ccvGvrtp.o(.text+0x80): undefined reference to `eth_close' > /tmp/ccvGvrtp.o(.text+0x80): relocation truncated to fit: R_ARM_PC24 > eth_close > collect2: ld returned 1 exit status > make: *** [dnet_test] Error 1 looks like your cross-compilation environment is broken somehow? can you show me the output of 'nm /usr/arm-linux/lib/libdnet.a | egrep eth_close' ? -d. --- http://monkey.org/~dugsong/ |
|
From: jang,suk-woo <jha...@gm...> - 2005-04-12 00:44:34
|
$nm /usr/arm-linux/lib/libdnet.a | grep eth_close 0000010c T eth_close >looks like your cross-compilation environment is broken somehow? > >can you show me the output of >'nm /usr/arm-linux/lib/libdnet.a | egrep eth_close' ? > >-d. > >--- >http://monkey.org/~dugsong/ > > > |