Jan 05

想利用 DD-WRT 支持 Buffalo WZR-1750DHP 全部 512M 内存的固件来做编译机,安装了 Tomatoware。

编译一些无需通过 automake/autoconf 生成 Makefile 的源程序都没啥问题,但是一旦编译通过 autogen.sh (应该调用 automake 等程序)生成的 Makefile 就会直接出错,信息类似:

[goflex@GoFLEX:/home/local/goflex/work/shairport-sync_git 35%] ~ make
make all-recursive
make[1]: Entering directory '/home/local/goflex/work/shairport-sync_git'
Making all in man
Makefile:518: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/local/goflex/work/shairport-sync_git'
Makefile:371: recipe for target 'all' failed
make: *** [all] Error 2
[goflex@GoFLEX:/home/local/goflex/work/shairport-sync_git 36%] ~

参考:

https://forum.openwrt.org/viewtopic.php?id=60605

https://github.com/lancethepants/tomatoware/issues/18#issuecomment-168871785

目前没什么好的解决办法,好在出错的地方有些规律,就是在 Makefile 中 dot_seen=no; 这句上面的反斜杠“\”需要去掉;写了个脚本做提示:

#!/bin/sh

curr_dir=`pwd`

bad_makefile=""
bad_makefile_line=""

bad_makefile_line=$(sed -n '/dot_seen=no;/=' `grep -lr 'dot_seen=no;' $curr_dir`)
bad_makefile=$(grep -lr 'dot_seen=no;' $curr_dir)

for bfile in $bad_makefile; do
    echo $bfile
done

for line in $bad_makefile_line; do
    fi_line="$(($line - 1))"
    echo $fi_line
done

echo "sed -i 'LINEs/\//' FILE"

它会列出需要修改的文件,所在行数,提示用:

sed -i 'LINEs/\//' FILE

去修改。

参考上面的帖子链接,最终确认是 DD-WRT 自带 /bin/bash 的问题,解决方法是:在 ./configure 之前建立一个环境变量:

export CONFIG_SHELL=/mmc/bin/bash

用来覆盖配置文件建立时默认使用的 /bin/bash 即可。