ARM平台的ppp-2.4.4交叉编译

来源:互联网 发布:数据检索 编辑:程序博客网 时间:2024/05/01 06:24
交叉编译器 : arm-linux-gcc 3.3.2
     ppp版本 : both 2.4.4 and 2.4.3 are OK

     用arm-linux-gcc直接交叉编译ppp-2.4.1不会有啥问题,但是换成高版本的2.4.3或2.4.4就会出现错误,错误信息如下:
options.c:59:18: pcap.h: No such file or directory
options.c: In function `setpassfilter':
options.c:1458: error: `pcap_t' undeclared (first use in this function)
options.c:1458: error: (Each undeclared identifier is reported only once
options.c:1458: error: for each function it appears in.)
options.c:1458: error: `pc' undeclared (first use in this function)
options.c:1461: warning: implicit declaration of function `pcap_open_dead'
options.c:1461: error: `DLT_PPP' undeclared (first use in this function)
options.c:1462: warning: implicit declaration of function `pcap_compile'
options.c:1464: warning: implicit declaration of function `pcap_geterr'
options.c:1467: warning: implicit declaration of function `pcap_close'
options.c: In function `setactivefilter':
options.c:1479: error: `pcap_t' undeclared (first use in this function)
options.c:1479: error: `pc' undeclared (first use in this function)
options.c:1482: error: `DLT_PPP' undeclared (first use in this function)
options.c: At top level:
options.c:134: error: storage size of `pass_filter' isn't known
options.c:135: error: storage size of `active_filter' isn't known
make[1]: *** [options.o] 错误 1
make[1]: Leaving directory `/root/PhenixTest/ppp-2.4.4/pppd'
make: *** [all] 错误 2

     错误原因很明显,缺少了pcap.h这个头文件和相应的库!具体解决办法如下:
    
Step 1:交叉编译pcap

     这里具体怎样交叉编译pcap就不再重复了,如果遇到问题你可以参考一下本空间的《移植pcap库到Liod板》一文。生成的动态链接libpcap.so、libpcap.so.0、libpcap.so.0.9.4在/home/TestSuite/pcap_test(随便你放在哪个目录下,只要你在下面修
改Makefile时指定好路径就可以),将pcap.h、pcap-bpf.h和pcap-namedb.h这几个头文件放在/usr/local/include下(也可以
放在别的目录)

Step 2:修改ppp的Makefile

    先configure生成Makefile。从上面的错误信息得知是ppp-2.4.4/pppd/options.c中需要pcap库,因此修改pppd目录下的Makefile即可,具体修改如下:
   171        # modify by Phenix
   172     #ifdef FILTER
   173        #ifneq ($(wildcard /usr/include/pcap-bpf.h),)
   174        LIBS    += -lpcap
   175        #CFLAGS += -DPPP_FILTER
   176     CFLAGS += -DPPP_FILTER -I/usr/local/include -L/home/TestSuite/pcap_test #指定pcap的库路径和头文件的路径
   177       #endif
   178           #endif
   
Step 3:Make CC=arm-linux-gcc
     
    至此,ppp2.4.4已经交叉编译成功。ppp2.4.3的修改同此一样!下面就可以在ARM平台上进行拨号了。具体拨号过程可以参考本空间的《Liod平台的ppp拨号(linux)》一文。
     值得注意的是,最后要将libpcap.so、libpcap.so.0、libpcap.so.0.9.4拷贝到开发板的/lib下才能正确运行pppd程序。
原创粉丝点击