天天看點

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

goahead移植
goahead移植
  1. #if 0     
  2.     if ((hp = gethostbyname(host)) == NULL) {   //MHB 2013-10-22     
  3.         error("Can't get host address for host %s: errno %d", host, errno);     
  4.         return -1;     
  5.     }     
  6.     memcpy((char*) &intaddr, (char *) hp->h_addr_list[0], (size_t) hp->h_length);     
  7.     ipaddr = inet_ntoa(intaddr);     
  8. #else   //MHB 2013-10-22 換種方式擷取ip位址 (ipv4)     
  9.     int sockfd;      
  10.     struct sockaddr_in sin;      
  11.     struct ifreq ifr;            
  12.     sockfd = socket(AF_INET, SOCK_DGRAM, 0);         
  13.     if (sockfd == -1)   {                
  14.         return -1;               
  15.     }            
  16.     strncpy(ifr.ifr_name, "eth0", IFNAMSIZ);    //網卡多的得修改下     
  17.     ifr.ifr_name[IFNAMSIZ - 1] = 0;          
  18.     if (ioctl(sockfd, SIOCGIFADDR, &ifr) < 0)    {                
  19.         return -1;       
  20.     }        
  21.     memcpy(&sin, &ifr.ifr_addr, sizeof(sin));        
  22.     ipaddr=inet_ntoa(sin.sin_addr);      
  23. #endif     
  24.     websSetIpAddr(ipaddr);     
  25.     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目錄,啟動是 可以指定。