编译OpenWrt时遇到的问题及解决方法(一)

在编译uboot时,报错:

1.编译uboot时报错:
In file included from fs.c:54:
fsdata.c:226: error: parse error before ',' token
/home/polaris/mtk7688/u-boot-mt7688-hiwooya-master/config.mk:799: recipe for target 'fs.o' failed
make[1]: *** [fs.o] Error 1
make[1]: Leaving directory '/home/polaris/mtk7688/u-boot-mt7688-hiwooya-master/httpd'
Makefile:369: recipe for target 'httpd/libhttpd.a' failed
make: *** [httpd/libhttpd.a] Error 2

分析问题:

通过错误信息发现,在fsdata.c 的226行多了一个,通过查找问题,发现在生成fsdata.c文件时,出现错误。(在httpd/vendors/makefsdatac中生成fsdata.c)

解决办法:

修改 ./httpd/vendors/makefsdatac
 # Content
        if [ "$_file_ext" == "css"  ]; then
                if [ -e "$yui_compressor" ]; then
                        _file_content=`java -jar "$yui_compressor" --charset utf-8 "$1" | od -A n -t x1 | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                else
                        _file_content=`cat "$1" | tr -d '\r\n\t' | od -A n -t x1 | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                fi
                `ascii_to_bytes "Content-type: text/css; charset=UTF-8\r\n\r\n" >> "$files_content_tmp"`
        elif [ "$_file_ext" == "png"  ]; then
                _file_content=`od -A n -t x1 < "$1" | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                `ascii_to_bytes "Content-Type: image/png\r\n\r\n" >> "$files_content_tmp"`
        elif [ "$_file_ext" == "jpg" -o "$_file_ext" == "jpeg"  ]; then
                _file_content=`od -A n -t x1 < "$1" | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                `ascii_to_bytes "Content-Type: image/jpeg\r\n\r\n" >> "$files_content_tmp"`
        elif [ "$_file_ext" == "gif"  ]; then
                _file_content=`od -A n -t x1 < "$1" | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                `ascii_to_bytes "Content-Type: image/gif\r\n\r\n" >> "$files_content_tmp"`
        else
                _file_content=`cat "$1" | tr -d '\t\r\n' | od -A n -t x1 | tr -d '\r\n' | sed 's/ /0x/;s/ /, 0x/g;s/.\{102\}/&\n/g'`
                `ascii_to_bytes "Content-type: text/html; charset=UTF-8\r\n\r\n" >> "$files_content_tmp"`
        fi
#####################################################################################       
        #add zgx 2018/7/31        
        if [ "$_file_ext" == "css" ]; then
                `echo " " >> "$files_content_tmp"`
        else
                `echo "," >> "$files_content_tmp"`
        fi
######################################################################################
        # File content
        `echo -ne "/* Page/File content */\n" >> "$files_content_tmp"`
        `echo -ne "$_file_content" >> "$files_content_tmp"`

        # And close declaration
        `echo -ne ", 0 };\n\n" >> "$files_content_tmp"`
 

你可能感兴趣的:(openwrt)