在OSX上编译时,sed版本不正确


2

我正在尝试crosstool-ng在OSX 10.6.8 上安装。在配置阶段,我运行./configure --prefix=/opt/cross,我得到以下输出:

! ./configure --prefix=/opt/cross
checking build system type... x86_64-apple-darwin10.8.0
checking host system type... x86_64-apple-darwin10.8.0
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking whether sed understands -r -i -e... no
configure: error: 

似乎sed应该接受-r作为一个论点,但不是。在sed 这里查看 也表明这-r是一个有效的参数,但是当我运行时,man sed我不认为我的版本允许这样:

SED(1)                    BSD General Commands Manual                   SED(1)

NAME
     sed -- stream editor

SYNOPSIS
     sed [-Ealn] command [file ...]
     sed [-Ealn] [-e command] [-f command_file] [-i extension] [file ...]

我的系统是否包含不正确的版本sed?我该怎么做才能使我sed兼容crosstool-ng

Answers:


2

GNU sed使用-r和OSX' BSD sed用于-E启用扩展正则表达式。GNU sed也理解-E哪个是未记录的功能,但BSD sed不理解-r。因此,您需要先安装GNU sed并临时更改搜索路径,以便configure首先查看它,或者您可以尝试在sed周围创建一个包装器,以便-r将其转换为-E。然后它仍然可能不起作用,因为该-i选项工作略有不同..

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.