goahead移植

1.网上下载goahead-3.1.2-0-src.tgz包  

2.解压 

       tar -zxvf goahead-3.1.2-0-src.tgz 

3.编译 

      cd goahead-3.1.2-0 

      make CC=arm-hisiv100-linux-gcc ARCH=arm 

      在linux-arm-default/bin中可以找到goahead和相关库文件,将库文件拷贝到板子/lib下

4.测试

      运行./goahead -v /web 192.168.1.155:9000


问题1: 

      goahead: 0: Can't get host address for host dvr: errno 11   

      goahead: 0: Can't initialize server. Exiting.   

     出处:goahead-3.1.1-0\src\http.c文件的setLocalHost函数 

     修改: 

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #if 0     
  2.   
  3.     if ((hp = gethostbyname(host)) == NULL) {   //MHB 2013-10-22     
  4.   
  5.         error("Can't get host address for host %s: errno %d", host, errno);     
  6.   
  7.         return -1;     
  8.   
  9.     }     
  10.   
  11.     memcpy((char*) &intaddr, (char *) hp->h_addr_list[0], (size_t) hp->h_length);     
  12.   
  13.     ipaddr = inet_ntoa(intaddr);     
  14.   
  15. #else   //MHB 2013-10-22 换种方式获取ip地址 (ipv4)     
  16.   
  17.     int sockfd;      
  18.   
  19.     struct sockaddr_in sin;      
  20.   
  21.     struct ifreq ifr;            
  22.   
  23.     sockfd = socket(AF_INET, SOCK_DGRAM, 0);         
  24.   
  25.     if (sockfd == -1)   {                
  26.   
  27.         return -1;               
  28.   
  29.     }            
  30.   
  31.     strncpy(ifr.ifr_name, "eth0", IFNAMSIZ);    //网卡多的得修改下     
  32.   
  33.     ifr.ifr_name[IFNAMSIZ - 1] = 0;          
  34.   
  35.     if (ioctl(sockfd, SIOCGIFADDR, &ifr) < 0)    {                
  36.   
  37.         return -1;       
  38.   
  39.     }        
  40.   
  41.     memcpy(&sin, &ifr.ifr_addr, sizeof(sin));        
  42.   
  43.     ipaddr=inet_ntoa(sin.sin_addr);      
  44.   
  45. #endif     
  46.   
  47.     websSetIpAddr(ipaddr);     
  48.   
  49.     websSetHost(ipaddr);   

问题2: 

        goahead: 0: Can't open config file route.txt   

        goahead: 0: Can't initialize server. Exiting.   

        解决方法: 

        拷贝goahead-3.1.1-0\src\route.txt文件到goahead同目录下 


问题3: 

        网页存放位置 

        /web目录启动是 可以指定。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值