【问题标题】:redirect stderr of my program to config.log将我的程序的 stderr 重定向到 config.log
【发布时间】:2015-12-03 12:15:27
【问题描述】:

我希望我的配置脚本运行自定义编译器。 autoconf 对这种语言一无所知,所以 AC_TRY_COMPILE 不会。

如果我只是在不使用宏的情况下运行编译器,它的 stderr 会打印到终端,但是,我想做与 C 编译器相同的重定向,并受 --quiet 标志的影响。

标准宏执行如下操作:

$CC ... 2>conftest.err
cat conftest.err >&5

但没有记录。

【问题讨论】:

  • 尝试提问。
  • 尝试运行编译器,将标准错误复制到标准输出,标准输出将写入 config.log。 (例如,2>&1)

标签: c autoconf


【解决方案1】:

config.log 文件描述符的记录宏:AS_MESSAGE_LOG_FD

https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/File-Descriptor-Macros.html#AS_MESSAGE_LOG_FD

用法示例:

echo foobar >&AS_MESSAGE_LOG_FD

【讨论】:

    猜你喜欢
    • 2014-07-22
    • 1970-01-01
    • 2022-01-18
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2017-07-21
    相关资源
    最近更新 更多