-1

I am trying to compile a custom package which depends heavily on libcurl an pcap, on my machine it works great,but when i try to compile it using the toolchain i get this errors:

$ /home/kavastudios/sites/proC/SDK/OpenWrt-Toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc airhog.c -o airhogfull  -lpcap -lcurl
mips-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
In file included from /usr/include/curl/curl.h:35:0,
                 from airhog.c:16:
/usr/include/curl/curlrules.h:142:3: error: size of array '__curl_rule_01__' is negative
   __curl_rule_01__
   ^
/usr/include/curl/curlrules.h:152:3: error: size of array '__curl_rule_02__' is negative
   __curl_rule_02__
   ^

And if i compile it removing all the code using curl (leaving just pcap) I get this error:

cannot find -lpcap
collect2: error: ld returned 1 exit status

After reading many post, my guess is I need to cross compile pcap and curl and then reference them at the moment of trying to compile my script, but I am totally lost on how to do it.

I'd really appreaciate if you can give me a clue about:

  1. setup the staging dir properly (i have been trying using the PATH/STAGING_DIR variables with no success)

  2. how to compile the curl/pcap library (to be used at the moment of compile my script and not ending up with those libraries replacing the ones used in my machine)

  3. which flags or commands I should include at the moment of compile my script.

I am using Ubuntu 14.04

Thanks.

Karlovalentin
  • 321
  • 1
  • 3
  • 14

1 Answers1

0

I don't know what you have done with your script but I can answer your second question.

(Replace arm-none-linux-gnueabi with your toolchain)

Cross compiling libpcap

1) First configure libpcap as shown below

./configure --prefix=<install/path> --host=arm-none-linux-gnueabi --with-pcap=linux

2) Then compile it

make

3) Finally install it

make install

Cross compiling libcurl

1) Configure

./configure --prefix=<install/path> --host=arm-none-linux-gnueabi 

Then follow steps 2 & 3 of libpcap

If you need additional features in these you have to cross compile those dependencies too.

ashwanth selvam
  • 486
  • 3
  • 13