📄 13.htm
字号:
librt.so.1 => /lib/librt.so.1 (0x4001e000)
libc.so.6 => /lib/libc.so.6 (0x40030000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40153000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
</PRE>
<P>可在chrooted环境下使用<CODE>ls</CODE>检查上述库函数在你的<CODE>chroot</CODE>环境中是否可见。
<P>下面的命令也很有用:
<UL>
<LI><CODE>strace</CODE>: 跟踪系统调用和消息
<LI><CODE>ltrace</CODE>: 跟踪库函数调用 </LI></UL>
<HR>
<A name=s13.7.2.3></A>
<H4>13.7.2.3 使用内存查漏工具进行调试</H4>
<P>Debian中有几个内存查漏工具。
<UL>
<LI><CODE>njamd</CODE>
<LI><CODE>valgrind</CODE>
<LI><CODE>dmalloc</CODE>
<LI><CODE>electric-fence</CODE>
<LI><CODE>memprof</CODE>
<LI><CODE>memwatch</CODE> (not packaged, get this from <CODE><A
href="http://www.gnu.org/directory/devel/debug/memwatch.html">GNU
memwatch</A></CODE>.)
<LI><CODE>mpatrol</CODE>
<LI><CODE>leaktracer</CODE>
<LI><CODE>libgc6</CODE>
<LI><SAMP>Insure++</SAMP> from <CODE><A
href="http://www.parasoft.com/">Parasoft</A></CODE>. (non-free, commercial for
fee) </LI></UL>
<P>亦可查阅<CODE><A
href="http://www.cs.colorado.edu/homes/zorn/public_html/MallocDebug.html">Debugging
Tools for Dynamic Storage Allocation and Memory Management</A></CODE>.
<HR>
<A name=s13.7.3></A>
<H3>13.7.3 Flex – 更好的Lex</H3>
<P><CODE>flex</CODE>是一个快速的词法分析机生成器。
<P><CODE>flex</CODE>参考资源:
<UL>
<LI><SAMP>info flex</SAMP> (tutorial)
<LI><CODE>flex(1)</CODE> </LI></UL>
<P>需要提供你自己的<CODE>main()</CODE>或<CODE>yywrap()</CODE>,或者你的<CODE>program.l</CODE>象这样不带library编译(<CODE>yywrap</CODE>是一个宏;<SAMP>%option
main</SAMP>隐含地打开了<SAMP>%option noyywrap</SAMP>): <PRE> %option main
%%
.|\n ECHO ;
%%
</PRE>
<P>另外,还可以在<CODE>cc</CODE>命令行末尾加上-<SAMP>lfl</SAMP>链接选项进行编译(象AT&T-Lex使用<SAMP>-ll</SAMP>一样),此时就不需要<SAMP>%option</SAMP>了。
<HR>
<A name=s13.7.4></A>
<H3>13.7.4 Bison – 更好的Yacc</H3>
<P>Debian中有几个软件包提供了与Yacc兼容的LALR词法生成器:
<UL>
<LI><CODE>bison</CODE>: GNU LALR parser generator
<LI><CODE>byacc</CODE>: The Berkeley LALR parser generator
<LI><CODE>byyacc</CODE>: Backtracking parser generator based on
<CODE>byacc</CODE> </LI></UL>
<P><CODE>bison</CODE>参考资源:
<UL>
<LI><SAMP>info bison</SAMP> (tutorial)
<LI><CODE>bison(1)</CODE> </LI></UL>
<P>需要提供自己的<CODE>main()</CODE>和<CODE>yyerror()</CODE>。<CODE>main()</CODE>调用<CODE>yyparse()</CODE>,而<CODE>yyparse()</CODE>调用<CODE>yylex()</CODE>,通常由FleX创建。
<PRE> %%
%%
</PRE>
<HR>
<A name=s13.7.5></A>
<H3>13.7.5 Autoconf</H3>
<P><CODE>autoconf</CODE>一个shell脚本生成工具,由它生成的脚本能自动配置软件源码包,以适用于各种使用全套GNU
build系统的类UNIX系统。
<P><CODE>autoconf</CODE>会生成配置脚本<CODE>configure</CODE>。<CODE>configure</CODE>使用<CODE>Makefile.in</CODE>模版自动创建自定义<CODE>Makefile</CODE>。
<HR>
<A name=s13.7.5.1></A>
<H4>13.7.5.1 编译并安装程序</H4>
<P>Debian不会改动<CODE>/usr/local</CODE>下的文件(参阅<A
href="http://qref.sourceforge.net/Debian/reference/ch-system.zh-cn.html#s-diverse">多样性支持,
第 2.5 节</A>)。所以如果是从源码编译程序,并将其安装到<CODE>/usr/local</CODE>下,是不会影响到Debian的。 <PRE> $ cd src
$ ./configure --prefix=/usr/local
$ make
$ make install # this puts the files in the system
</PRE>
<HR>
<A name=s13.7.5.2></A>
<H4>13.7.5.2 卸载程序</H4>
<P>如果仍保存有源码,对其使用了<CODE>autoconf</CODE>/<CODE>automake</CODE>,并且记得是如何进行配置的: <PRE> $ ./configure <VAR>all-of-the-options-you-gave-it</VAR>
# make uninstall
</PRE>
<P>另一种方法是,如果可以确定安装过程将文件都放在了<CODE>/usr/local</CODE>,并且该目录下没有什么别的重要文件,可用下面的命令将其全部删除:
<PRE> # find /usr/local -type f -print0 | xargs -0 rm -f
</PRE>
<P>如果不能确定文件安装到什么位置,最好使用<CODE>checkinstall</CODE>,该命令可提供明确的卸载路径。
<HR>
<A name=s13.8></A>
<H2>13.8 准备文档</H2>
<HR>
<A name=s13.8.1></A>
<H3>13.8.1 <SAMP>roff</SAMP>排版</H3>
<P>传统上,<SAMP>roff</SAMP>是主要的Unix文字处理系统。
<P>参阅<CODE>roff(7)</CODE>、<CODE>groff(7)</CODE>、<CODE>groff(1)</CODE>、<CODE>grotty(1)</CODE>、<CODE>troff(1)</CODE>、<CODE>groff_mdoc(7)</CODE>、<CODE>groff_man(7)</CODE>、<CODE>groff_ms(7)</CODE>、<CODE>groff_me(7)</CODE>、<CODE>groff_mm(7)</CODE>以及<SAMP>info
groff</SAMP>。
<P><CODE>-me</CODE>宏提供了一个不错了说明文档。如果使用的是groff(1.18或更新的版本),找到<CODE>/usr/share/doc/groff/meintro.me.gz</CODE>并执行下面的命令:
<PRE> $ zcat /usr/share/doc/groff/meintro.me.gz | \
groff -Tascii -me - | less -R
</PRE>
<P>下面的命令将生成一个完整的纯文本文件: <PRE> $ zcat /usr/share/doc/groff/meintro.me.gz | \
GROFF_NO_SGR=1 groff -Tascii -me - | col -b -x > <VAR>meintro.txt</VAR>
</PRE>
<P>如果想打印出来,可使用PostScript输出: <PRE> $ groff -Tps <VAR>meintro.txt</VAR> | lpr
$ groff -Tps <VAR>meintro.txt</VAR> | mpage -2 | lpr
</PRE>
<HR>
<A name=s13.8.2></A>
<H3>13.8.2 SGML</H3>
<P>准备工作: <PRE> # apt-get install debiandoc-sgml debiandoc-sgml-doc
</PRE>
<P><CODE>debiandoc-sgml</CODE>参考资源:
<UL>
<LI><CODE>/usr/share/doc/debiandoc-sgml-doc</CODE>
<LI><CODE>debiandoc-sgml(1)</CODE>
<LI><EM>DocBook: The Definitive Guide</EM>, by Walsh and Muellner (O'Reilly)
</LI></UL>
<P>SGML能管理多重格式的文档。更简单的SGML系统是Debiandoc,本文档就使用到它完成的。只需对原始的文本文件的下列字符进行少许转换:
<UL>
<LI>"<" --> <SAMP>&lt;</SAMP>
<LI>">" --> <SAMP>&gt;</SAMP>
<LI>" " --> <SAMP>&nbsp;</SAMP> (non-breakable space)
<LI>"&" --> <SAMP>&amp;</SAMP>
<LI>"%" --> <SAMP>&percnt;</SAMP>
<LI>"©" --> <SAMP>&copy;</SAMP>
<LI>"–" --> <SAMP>&ndash;</SAMP>
<LI>"—" --> <SAMP>&mdash;</SAMP> </LI></UL>
<P>设置章节为非打印注释,输入: <PRE> <!-- State issue here ... -->
</PRE>
<P>设置章节为可控注释,输入: <PRE> <![ %FIXME; [ State issue here ... ]]>
</PRE>
<P>在SGML中,仅条目的<EM>首次声明</EM>(first definition)有效。例如: <PRE> <!entity % qref "INCLUDE">
<![ %qref; [ <!entity param "Data 1"> ]]>
<!entity param "Data 2">
&param;
</PRE>
<P>最终结果是“Data 1”。如果第一行使用“IGNORE”而非“INCLUDE”,则最终结果为“Data
2”(第二行是一个候选声明)。同样,重复出现的短语可分别提前在文档中定义。 <PRE> <!entity <VAR>whoisthis</VAR> "my">
Hello &<VAR>whoisthis</VAR>; friend.
This is &<VAR>whoisthis</VAR>; book.
</PRE>
<P>该定义的结果如下: <PRE> Hello my friend.
This is my book.
</PRE>
<P>可参阅<CODE><A
href="http://qref.sourceforge.net/Debian/reference/examples/">examples</A></CODE>目录中简短的SGML样例文件<CODE>sample.sgml</CODE>。
<P>当SGML文档不断增大后,TeX偶尔会出错。可通过修改<CODE>/etc/texmf/texmf.cnf</CODE>,增加缓冲池的容量来解决这个问题(更好的方法是编辑<CODE>/etc/texmf/texmf.d/95NonPath</CODE>然后运行<CODE>update-texmf</CODE>)。
<HR>
<A name=s-packaging></A>
<H2>13.9 打包</H2>
<P>准备工作: <PRE> # apt-get install debian-policy developers-reference \
maint-guide dh-make debhelper
# apt-get install packaging-manual # if Potato
</PRE>
<P>有关打包的参考资源:
<UL>
<LI><A
href="http://qref.sourceforge.net/Debian/reference/ch-system.zh-cn.html#s-pkg-basics">Debian软件包管理系统,
第 2.2 节</A> (basics)
<LI>Debian New Maintainers' Guide (tutorial)
<LI><CODE>dh-make(1)</CODE>
<LI>Debian Developer's Reference (best practice)
<LI>Debian Policy Manual (authoritative)
<LI>Packaging Manual (Potato) </LI></UL>
<HR>
<A name=s-pack-binary></A>
<H3>13.9.1 单个二进制文件打包</H3>
<P>Joey Hess的快速粗糙的打包法:生成一个单独的二进制包 <PRE> # mkdir -p mypkg/usr/bin mypkg/DEBIAN
# cp binary mypkg/usr/bin
# cat > mypkg/DEBIAN/control
Package: mypackage
Version: 1
Architecture: i386
Maintainer: Joey Hess <joeyh@debian.org>
Description: my little package
Don't expect much.
^D
# dpkg-deb -b mypkg
</PRE>
<HR>
<A name=s-pack-dh-make></A>
<H3>13.9.2 使用工具打包</H3>
<P>使用<CODE>dh_make</CODE>软件包中的<CODE>dh-make</CODE>工具创建一个基线包,接着按照<CODE>dh-make(1)</CODE>中描述的方法打包。会用到<CODE>debian/rules</CODE>中的<CODE>debhelper</CODE>。
<P>一个较老的方法是使用<CODE>debmake</CODE>软件包中的<CODE>deb-make</CODE>。不需要<CODE>debhelper</CODE>脚本,仅需要shell环境。
<P>有关多重源码包的例子,参阅“mc”(<SAMP>dpkg-source -x mc_4.5.54.dsc</SAMP>),其中用到Adam
Heath(<CODE><A
href="mailto:doogie@debian.org">doogie@debian.org</A></CODE>)的“sys-build.mk”以及“glibc”(<SAMP>dpkg-source
-x glibc_2.2.4-1.dsc</SAMP>)它由已故的Joel Klecker(<CODE><A
href="mailto:espy@debian.org">espy@debian.org</A></CODE>)所写的另一个系统打包。
<HR>
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-vcs.zh-cn.html">上一页</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/reference.zh-cn.html#contents">目录</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-preface.zh-cn.html">1</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-system.zh-cn.html">2</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-install.zh-cn.html">3</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-tutorial.zh-cn.html">4</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-woody.zh-cn.html">5</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-package.zh-cn.html">6</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-kernel.zh-cn.html">7</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-tips.zh-cn.html">8</A> ] [
<A href="http://qref.sourceforge.net/Debian/reference/ch-tune.zh-cn.html">9</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gateway.zh-cn.html">10</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-edit.zh-cn.html">11</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-vcs.zh-cn.html">12</A> ] [
13 ] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gnupg.zh-cn.html">14</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-support.zh-cn.html">15</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ap-appendix.zh-cn.html">A</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gnupg.zh-cn.html">下一页</A>
]
<HR>
<P>Debian 参考手册
<ADDRESS>CVS, 星期三 四月 28 19:36:38 UTC 2004<BR><BR>Osamu Aoki <CODE><A
href="mailto:osamu@debian.org">osamu@debian.org</A></CODE><BR>Translator: Hao
"Lyoo" Liu <CODE><A
href="mailto:iamlyoo@163.net">iamlyoo@163.net</A></CODE><BR><A
href="http://qref.sourceforge.net/Debian/reference/ap-appendix.zh-cn.html#s-authors">作者,
第 A.1 节</A><BR><BR></ADDRESS>
<HR>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -