出现错误:“ar: 创建 ../lib/libmgr.a”
我有一个 bash 脚本,它执行 make,然后在 make 写入 stderr 时中止。代码是这样的:
make all 2>${ERROR_FILE}
ERR=$(cat ${ERROR_FILE})
if [ ! -z "${ERR}" ];
then
abort "Halted because of errors in make $1: ${ERR}"
fi
但是,make 将以下内容写入文件:
ar: creating ../lib/libmgr.a
ar: creating ../lib/libnet.a
ar: creating ../lib/libeoc.a
ar: creating ../lib/libdvr.a
ar: creating ../lib/libmsg.a
ar: creating ../lib/liblgc.a
ar: creating ../lib/libshm.a
ar: creating ../lib/libsys.a
ar: creating ../lib/librsk.a
ar: creating ../lib/librep.a
ar: creating ../lib/libmdl.a
ar: creating ../lib/libmdb.a
ar: creating ../lib/libdat.a
ar: creating ../lib/libchs.a
这是什么意思?这些是错误吗?如果不是,为什么它们会写入 stderr?
I have a bash script that performs makes and then aborts when a make writes to stderr. The code is like this:
make all 2>${ERROR_FILE}
ERR=$(cat ${ERROR_FILE})
if [ ! -z "${ERR}" ];
then
abort "Halted because of errors in make $1: ${ERR}"
fi
However, make writes the following to the file:
ar: creating ../lib/libmgr.a
ar: creating ../lib/libnet.a
ar: creating ../lib/libeoc.a
ar: creating ../lib/libdvr.a
ar: creating ../lib/libmsg.a
ar: creating ../lib/liblgc.a
ar: creating ../lib/libshm.a
ar: creating ../lib/libsys.a
ar: creating ../lib/librsk.a
ar: creating ../lib/librep.a
ar: creating ../lib/libmdl.a
ar: creating ../lib/libmdb.a
ar: creating ../lib/libdat.a
ar: creating ../lib/libchs.a
What does this mean? Are these errors? If not, why are they written to stderr?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将
-c
标志与ar
一起使用,以抑制创建存档时默认写入标准错误的诊断消息。例如:You can use the
-c
flag withar
to suppress the diagnostic message that is written to standard error by default when an archive is created. For example:它们看起来不像错误,它们看起来像是来自 ar 的消息。如果 std err 文件非零,为什么要停止?您也想停止警告吗?如果没有,您可能需要根据 make 命令的状态停止(make 命令后的非零 $? 值表示错误)。
They don't look like errors, they look like messages from ar. Why do you stop if the std err file is nonzero? Do you want to stop on warnings too? If not, you may want to stop based on the status of the make command (a non zero $? value after the make command indicates error).
我同意@skjaidev。此外,您还可以更具体地说明您在 ERR 变量中查找的内容。一种方法是
编辑:将引用从 ar 更改为 make
我希望这会有所帮助。
I agree with @skjaidev. Additionally, you can also be more specific about what you are looking for in your ERR variable. One approach is
Edit : changed references from ar to make
I hope this helps.