近来需要在solaris上工作一段时间, 所以需要使用solaris上的工具. 习惯了在Linux下的工具后, 突然发现许多solaris上的工具和linux差别甚大. 自带的sed和awk即是如此,以前在linux下用的sed/awk都出错, 由于我不想再熟悉一套新的sed/awk语法,故而,我就需要在solaris上安装gnu sed.
当运行完configure后,系统给出如下提示:
checking for GNU gettext in libc... no
checking for GNU gettext in libintl... no
configure: creating ./config.status
config.status: creating lib/stdbool.h
config.status: creating bootstrap.sh
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating lib/Makefile
config.status: creating sed/Makefile
config.status: creating testsuite/Makefile
config.status: creating po/Makefile.in
config.status: creating intl/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: linking ./lib/regex_.h to lib/regex.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing gettext-fix commands
sed: command garbled: install_sh=/home/jd/tools/sed-4.1.5/config/install-sh
sed: command garbled: install_sh=/home/jd/tools/sed-4.1.5/config/install-sh
估计着,是出什么问题了. 一Make,果然如此:
bash-2.05$ make
make all-recursive
make[1]: Entering directory `/scratch/jd/tools/sed-4.1.5'
Making all in intl
make[2]: Entering directory `/scratch/jd/tools/sed-4.1.5/intl'
make[2]: *** No rule to make target `all'. Stop.
make[2]: Leaving directory `/scratch/jd/tools/sed-4.1.5/intl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/scratch/jd/tools/sed-4.1.5'
make: *** [all] Error 2
查看了一下intl下的Makefile,居然是空的!,说明脚本没有正确的根据Makefile.in生成Makefile. 原因在于config.status中使用了一些solaris sed中不支持的指令来产生Makefile,导致Makefile为空.
不过, config.status是已经搜集完后系统配置产生的,故而,在linux平台上运行,给出的结果也是一样的.
所以,可以在linux上放一份sed的源代码,而后copy solaris上产生的config.status到linux上,在linux上运行config.status,记录下已经改变过的文件, 将改动的文件考回来就行了,抑或打个diff,这边运用.
还有一种更复杂点和更不保险的方法,就是使用系统的intl库, 这样知需要在Makefile中,查找所有对libintl.so的引用,而后修改成对系统libintl.so的引用即可,同时,去掉make中的产生libintl的target.
而后执行make,居然又出新的错误:
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../intl -I.. -I../lib -I../intl -g -O2 -c regex.c
In file included from regex.c:61:
regex_internal.h:395: warning: `pure' attribute directive ignored
In file included from regex.c:61:
regex_internal.h:712: warning: `pure' attribute directive ignored
regex_internal.h:725: warning: `pure' attribute directive ignored
regex_internal.h:734: warning: `pure' attribute directive ignored
In file included from regex.c:63:
regex_internal.c:750: warning: `pure' attribute directive ignored
regex_internal.c:786: warning: `pure' attribute directive ignored
regex_internal.c:1272: warning: `pure' attribute directive ignored
regex_internal.c:1287: warning: `pure' attribute directive ignored
In file included from regex.c:64:
regcomp.c:292: warning: `always_inline' attribute directive ignored
In file included from regex.c:65:
regexec.c:1028: warning: `always_inline' attribute directive ignored
regexec.c: In function `build_trtable':
regexec.c:3299: `bool' undeclared (first use in this function)
regexec.c:3299: (Each undeclared identifier is reported only once
regexec.c:3299: for each function it appears in.)
regexec.c:3299: parse error before `dests_node_malloced'
regexec.c:3325: `dests_node_malloced' undeclared (first use in this function)
regexec.c:3325: `true' undeclared (first use in this function)
regexec.c:3365: `dest_states_malloced' undeclared (first use in this function)
regexec.c: In function `group_nodes_into_DFAstates':
regexec.c:3579: `bool' undeclared (first use in this function)
regexec.c:3579: parse error before `accepts_newline'
regexec.c:3581: `accepts_newline' undeclared (first use in this function)
*** Error code 1
make: Fatal error: Command failed for target `regex.o'
Current working directory /scratch/jd/tools/sed-4.1.5/lib
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='intl lib po sed doc testsuite'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /scratch/jd/tools/sed-4.1.5
*** Error code 1
make: Fatal error: Command failed for target `all'
原来是缺了bool的定义等等, bool在solaris中由/usr/include/stdbool.h定义, 而在linux中不存在.
故而,只需要让regexec.c把/usr/include/stdbool.h包含进来就可以了, 这之后继续make就没问题,而后install一下,再运行:
bash-2.05$ sed --version
GNU sed version 4.1.5
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
5 邮件中的句点行
我没有去了解过邮件正文的要求, 经常作的是把输出放到一个文本邮件中, 再把文本文件作为邮件正文. 但是最近收到的某些邮件总是乖乖的, 明明文件内容是完整的, 邮件内容却从某处开始缺失. 而且绝大多数都是从单独的句点行开始缺失, 我就怀疑是否邮件系统默认将单独句点行作为正文结束标识.
后来查找了一下, 果然如此, 在而后发送文件内容是,我总是把空白句点行替代掉, 这样才能收到完整的邮件.
参考:
阅读(2716) | 评论(1) | 转发(1) |