Files
master/chapter04/aboutsbus.html
2015-05-23 18:50:06 +08:00

68 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8">
<title>4.5.&nbsp;关于 SBU</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print">
</head>
<body class="lfs" id="lfs-7.7-systemd">
<div class="navheader">
<h4>Linux From Scratch - Version 7.7-systemd</h4>
<h3>第四章&nbsp;最后的准备工作</h3>
<ul>
<li class="prev">
<a accesskey="p" title="设置环境" href="settingenvironment.html">上一页</a><p>设置环境</p>
</li>
<li class="next">
<a accesskey="n" title="关于测试套件" href="abouttestsuites.html">下一页</a><p>关于测试套件</p>
</li>
<li class="up">
<a accesskey="u" href="chapter04.html" title=
"第四章&nbsp;最后的准备工作">返回</a>
</li>
<li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - Version 7.7-systemd">主页</a></li>
</ul>
</div>
<div class="sect1" lang="zh_CN" xml:lang="en">
<h1 class="sect1">
<a id="prepare-aboutsbus" name="prepare-aboutsbus"></a>4.5. 关于 SBU</h1>
<p>不少人在开始做之前都想要知道,编译和安装一个软件包到底需要多长的时间。实在是抱歉,因为 Linux From Scratch 能够运行于众多的硬件上,所以具体的编译时间无法一概而论。举一个简单的例子:在最快的硬件设备上,编译那种非常巨大的软件包(如 Glibc可能仅需要 20 分钟,在那种很慢很慢的硬件上呢,这个时间可能就变成 3 天了。所以,这里使用 SBU标准编译单位来指代具体的编译时间。</p>
<p>SBU 衡量方式如下。我们以<a title="第五章&nbsp;构建临时系统" class="xref" href="../chapter05/chapter05.html">第五章</a>编译的第一个软件包 Binutils 所用时间作为一个标准编译单位SBU其它软件的生成时间都以其为标准进行比较。</p>
<p>例如,假如编译一个软件耗时 4.5 SBU而编译安装初代 Binutils 用时 10 分钟的话,那么编译这个软件包<span class="emphasis"><em>大约</em></span>耗时 45 分钟。当然啦,对于大多数人来说,编译 Binutils 可用不了 10 分钟那么久。</p>
<p>一般来说SBU 的结果并不准确,因为影响编译的因素太多,例如宿主机的 GCC 版本的不同就会改变编译的时间。所以更多的时候,这仅仅是提供一个编译和安装时间的预估,有些情况下,预估时间和实际编译时间可能相差几十分钟。</p>
<div class="admon note">
<img alt="[Note]" src="../images/note.png"><h3>注意</h3>
<p>对于大多数带有多个处理器(或内核)的现代操作系统而言,可以通过设置环境变量或者是告知&nbsp;<span class="command">
<strong>make</strong></span>&nbsp;程序具体可用的处理器数目,通过“并行编译”来减少编译的时间。例如,对于&nbsp;Core2Duo 可以通过以下参数实现两个处理器同时编译:</p>
<pre class="userinput"><kbd class="command">export MAKEFLAGS='-j 2'</kbd></pre>
<p>或者直接这样编译:</p>
<pre class="userinput"><kbd class="command">make -j2</kbd></pre>
<p>当使用多处理器同时编译SBU 的结果可能和本书提供的建议值有所不同。在一些情况下,使用多处理器同时编译可能失败,分析错误日志变得异常困难:因为不同处理器之间的执行路线是交错的。如果你在编译的时候遇到问题,那么请回过来使用单处理器编译,以正确地查看错误消息。</p>
</div>
</div>
<div class="navfooter">
<div class="book">
<div class="titlepage">
<div class="author">
<span class="firstname">翻译团队:<a href="http://lctt.github.io/" target="_blank">LCTT</a></span>
<span class="surname">译者/校对:<a href="http://github.com/dongfengweixiao" target="_blank">dongfengweixiao</a>,<a href="http://github.com/wxy" target="_blank">wxy</a></span>
</div>
</div>
</div>
<ul>
<li class="prev">
<a accesskey="p" title="设置环境" href="settingenvironment.html">上一页</a><p>设置环境</p>
</li>
<li class="next">
<a accesskey="n" title="关于测试套件" href="abouttestsuites.html">下一页</a><p>关于测试套件</p>
</li>
<li class="up">
<a accesskey="u" href="chapter04.html" title=
"第四章&nbsp;最后的准备工作">返回</a>
</li>
<li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - Version 7.7-systemd">主页</a></li>
</ul>
</div>
</body>
</html>