linux - cross compile c program for android -


i have c program uses -lpcap, -lm, , -lpthread. see libraries in /usr/arm-linuxgnueabi/lib/. however, if compile using command

arm-linux-gnueabi-gcc -static *.c -l/usr/arm-linux-gnueabi/lib/ -lpcap -lm -lpthread -o dumps/forandroid 

it gives following error:

/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find crt1.o: no such file or directory<br> /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find crti.o: no such file or directory<br> /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lpcap<br> /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lm<br> /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lpthread /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lc<br> collect2: error: ld returned 1 exit status 

how can give library path properly? trying compile program android emulator running android 5.1. using mint 17.2 64 bit amd machine.

i solved problem using ndk toolchain. compiled libpcap arm-linux , used library. following command job:

arm-linux-androideabi-gcc --sysroot=/home/shahrear/android/ndk/platforms/android-21/arch-arm -fpie -fpic -i./pcap -i. *.c -l./lib -pie -lm -lpcap -o dumps/forandroid 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -