You are not logged in.
hello
can i compile jpcap on arch x86_64?
because when i try it i get this error:
/usr/bin/ld: /tmp/ccWFe5Db.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/ccWFe5Db.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libjpcap.so] Error 1
i tried to serach web but i just found out that this is architecture issue but no solution..
edit:
if i use 32bit enviroment (http://wiki.archlinux.org/index.php/Arc … bit_system) to compile it will it wrok on my 64 bit?
Last edited by _dunmer (2009-02-28 13:15:28)
Offline
Search for -fPIC compiler flag issues in our forums and mailing lists. Fix it in the corresponding Makefile. If you don't find it try export CFLAGS="$CFLAGS -fPIC" though this is not the proper way and slows it down more than needed.
Please also file an upstream bug.
Offline
this is whole makefile
JAVA_DIR = $(JAVA_HOME)
JNI_INCLUDE = $(JAVA_DIR)/include
# try to detect your OS using 'uname'
PLATFORM = $(shell "uname")
ifeq ($(PLATFORM), Linux)
JNI_INCLUDE2 = $(JAVA_DIR)/include/linux
COMPILE_OPTION = -shared -L.
SUFFIX = .so
else
ifeq ($(PLATFORM), FreeBSD)
JNI_INCLUDE2 = $(JAVA_DIR)/include/freebsd
COMPILE_OPTION = -shared -L.
SUFFIX = .so
else
ifeq ($(PLATFORM), SunOS)
JNI_INCLUDE2 = $(JAVA_DIR)/include/solaris
COMPILE_OPTION = -G
SUFFIX = .so
else
ifeq ($(PLATFORM), Darwin)
JNI_INCLUDE2 = /System/Library/Frameworks/JavaVM.framework/Headers
COMPILE_OPTION = -bundle -framework JavaVM
SUFFIX = .jnilib
endif
endif
endif
endif
# Specify where pcap.h is
PCAP_INCLUDE = /usr/include
#PCAP_INCLUDE = /usr/include/pcap
#CC = cl
CC = gcc
all: libjpcap.so
libjpcap.so: JpcapCaptor.c JpcapSender.c JpcapWriter.c\
packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c\
packet_ipv6.c packet_tcp.c packet_udp.c
$(CC) $(COMPILE_OPTION) -I$(JNI_INCLUDE) -I$(JNI_INCLUDE2)\
-I$(PCAP_INCLUDE)\
JpcapCaptor.c JpcapSender.c JpcapWriter.c\
packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c\
packet_ipv6.c packet_tcp.c packet_udp.c\
-o libjpcap$(SUFFIX) -lpcap
clean:
-rm libjpcap$(SUFFIX)
witt thie make file i get this error:
[dunmer@joybox c]$ make
gcc -shared -L. -I/opt/java/include -I/opt/java/include/linux\
-I/usr/include\
JpcapCaptor.c JpcapSender.c JpcapWriter.c\
packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c\
packet_ipv6.c packet_tcp.c packet_udp.c\
-o libjpcap.so -lpcap
JpcapCaptor.c: In function 'Java_jpcap_JpcapCaptor_processPacket':
JpcapCaptor.c:467: warning: cast to pointer from integer of different size
JpcapCaptor.c: In function 'Java_jpcap_JpcapCaptor_loopPacket':
JpcapCaptor.c:486: warning: cast to pointer from integer of different size
JpcapCaptor.c: In function 'dispatcher_handler':
JpcapCaptor.c:700: warning: cast from pointer to integer of different size
JpcapWriter.c: In function 'Java_jpcap_JpcapWriter_close':
JpcapWriter.c:47: warning: incompatible implicit declaration of built-in function 'free'
packet_icmp.c: In function 'analyze_icmp':
packet_icmp.c:79: warning: cast to pointer from integer of different size
packet_icmp.c:81: warning: cast from pointer to integer of different size
/usr/bin/ld: /tmp/cceBND7o.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/cceBND7o.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libjpcap.so] Error 1
when i add -fPIC to CFLAGS it doesn't do anything and i get the same output
somebody tell me to chanege Linux part of make file like this:
ifeq ($(PLATFORM), Linux)
JNI_INCLUDE2 = $(JAVA_DIR)/include/linux
-- COMPILE_OPTION = -shared -L.
++ COMPILE_OPTION = -shared -fPIC -L.
whit this a i get another error:
[dunmer@joybox c]$ make
gcc -I/opt/java/include -I/opt/java/include/linux\
-I/usr/include\
JpcapCaptor.c JpcapSender.c JpcapWriter.c\
packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c\
packet_ipv6.c packet_tcp.c packet_udp.c\
-o libjpcap.so -lpcap
JpcapCaptor.c: In function 'Java_jpcap_JpcapCaptor_processPacket':
JpcapCaptor.c:467: warning: cast to pointer from integer of different size
JpcapCaptor.c: In function 'Java_jpcap_JpcapCaptor_loopPacket':
JpcapCaptor.c:486: warning: cast to pointer from integer of different size
JpcapCaptor.c: In function 'dispatcher_handler':
JpcapCaptor.c:700: warning: cast from pointer to integer of different size
JpcapWriter.c: In function 'Java_jpcap_JpcapWriter_close':
JpcapWriter.c:47: warning: incompatible implicit declaration of built-in function 'free'
packet_icmp.c: In function 'analyze_icmp':
packet_icmp.c:79: warning: cast to pointer from integer of different size
packet_icmp.c:81: warning: cast from pointer to integer of different size
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [libjpcap.so] Error 1
nothing i could find about -fPIC helped me..
Offline
ok, i give up
can anybody tell what have i do to use this library compilated on 32bit system? some 32bit enviroment?
Offline
i created 32bit enviroment using this wiki page: http://wiki.archlinux.org/index.php/Arc … bit_system and compiled it there..
it's working or at least it looks working.
Offline