Files
master/chapter05/gcc-libstdc++.html
2015-05-23 18:50:06 +08:00

202 lines
6.8 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.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content=
"application/xhtml+xml; charset=utf-8" />
<title>
5.8.&nbsp;Libstdc++-4.9.2
</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" href="glibc.html" title="Glibc-2.21">上一页</a>
<p>
Glibc-2.21
</p>
</li>
<li class="next">
<a accesskey="n" href="binutils-pass2.html" title=
"Binutils-2.25 - 第2遍">下一页</a>
<p>
Binutils-2.25 - 第2遍
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter05.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="wrap" lang="en" xml:lang="en">
<h1 class="sect1">
<a id="ch-tools-libstdcpp" name="ch-tools-libstdcpp"></a>5.8.
Libstdc++-4.9.2
</h1>
<div class="package" lang="en" xml:lang="en">
<p>
Libstdc++ 是标准的 C++ 库。g++ 编译器正确运行需要它。
</p>
<div class="segmentedlist">
<div class="seglistitem">
<div class="seg">
<strong class="segtitle">大概编译时间:</strong>
<span class="segbody">0.3 SBU</span>
</div>
<div class="seg">
<strong class="segtitle">所需磁盘空间:</strong>
<span class="segbody">798 MB</span>
</div>
</div>
</div>
</div>
<div class="installation" lang="en" xml:lang="en">
<h2 class="sect2">
5.8.1. 安装目标 Libstdc++
</h2>
<div class="admon note">
<img alt="[Note]" src="../images/note.png" />
<h3>
注意
</h3>
<p>
<span class="application">Libstdc++</span> 是 GCC 源文件的一部分。你首先应该解压 GCC tar 包,然后进入 <code class="filename">gcc-4.9.2</code> 文件夹。
</p>
</div>
<p>
为 Libstdc++ 创建一个文件夹并进入:
</p>
<pre class="userinput">
<kbd class="command">mkdir -pv ../gcc-build
cd ../gcc-build</kbd>
</pre>
<p>
准备编译 Libstdc++
</p>
<pre class="userinput">
<kbd class="command">../gcc-4.9.2/libstdc++-v3/configure \
--host=$LFS_TGT \
--prefix=/tools \
--disable-multilib \
--disable-shared \
--disable-nls \
--disable-libstdcxx-threads \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.9.2</kbd>
</pre>
<div class="variablelist">
<p class="title">
<strong>配置选项的含义:</strong>
</p>
<dl class="variablelist">
<dt>
<span class="term"><em class=
"parameter"><code>--host=...</code></em></span>
</dt>
<dd>
<p>
指示使用我们刚才编译的交叉编译器,而不是 <code class="filename">/usr/bin</code> 中的。
</dd>
<dt>
<span class="term"><em class=
"parameter"><code>--disable-libstdcxx-threads</code></em></span>
</dt>
<dd>
<p>
由于我们还没有编译 C 线程库C++ 的也还不能编译。
</p>
</dd>
<dt>
<span class="term"><em class=
"parameter"><code>--disable-libstdcxx-pch</code></em></span>
</dt>
<dd>
<p>
这个选项防止安装预编译包括的问题,这里并不需要。
</p>
</dd>
<dt>
<span class="term"><em class=
"parameter"><code>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.9.2</code></em></span>
</dt>
<dd>
<p>
这是 C++ 编译器搜索标准 include 文件的位置。在一般的编译中,这个信息自动从顶层文件夹中传入 Libstdc++
<span class="command"><strong>configure</strong></span> 选项。在我们的例子中,必须明确给出这信息。
</p>
</dd>
</dl>
</div>
<p>
编译 libstdc++:
</p>
<pre class="userinput">
<kbd class="command">make</kbd>
</pre>
<p>
安装库:
</p>
<pre class="userinput">
<kbd class="command">make install</kbd>
</pre>
</div>
<div class="content" lang="en" xml:lang="en">
<p>
该软件包的详细信息在 <a class="xref" href=
"../chapter06/gcc.html#contents-gcc" title=
"6.17.2.&nbsp;GCC 的内容">6.17.2, &ldquo;GCC 的内容&rdquo;</a>
</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/ictlyh" target="_blank">ictlyh</a>,</span>
</div>
</div>
</div>
<ul>
<li class="prev">
<a accesskey="p" href="glibc.html" title="Glibc-2.21">上一页</a>
<p>
Glibc-2.21
</p>
</li>
<li class="next">
<a accesskey="n" href="binutils-pass2.html" title=
"Binutils-2.25 - 第2遍">下一页</a>
<p>
Binutils-2.25 - 第2遍
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter05.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>