<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>编译点滴 &#187; portage</title>
	<atom:link href="http://www.lingcc.com/tag/portage/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lingcc.com</link>
	<description>编译器、虚拟机、程序设计语言、体系结构、软件调试、操作系统等等</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:56:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>前瞻-主流处理器中的数据并行支持(SIMD)</title>
		<link>http://www.lingcc.com/2010/05/04/10878/</link>
		<comments>http://www.lingcc.com/2010/05/04/10878/#comments</comments>
		<pubDate>Tue, 04 May 2010 12:46:15 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[后端优化与处理器]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[3dnow]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[avx]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mmx]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[SIMD]]></category>
		<category><![CDATA[sse]]></category>
		<category><![CDATA[sse2]]></category>
		<category><![CDATA[sse3]]></category>
		<category><![CDATA[sse4]]></category>
		<category><![CDATA[sse5]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[多媒体处理]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[整点]]></category>
		<category><![CDATA[科学计算]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10878</guid>
		<description><![CDATA[引言部分： 多媒体处理算法应用在很多媒体处理环境中，如对文本，手写数据，2D/3D图形和音频对象的捕捉、制造、存储和传输等。过去 都是使用昂贵的多媒体处理硬件协同工作来加速。现在，通用处理器通过在体系结构上增加媒体处理支持来减少使用协同处理器分配和返回带来的开销。在通用处理 器上一个基本的操作能同时作用多个元素的支持成为SIMD并行处理。通过SIMD扩展，通用护理器通过捕捉多媒体算法中潜在的并行特性来加速应用。 自 Intel在Pentium II和Pentium 处理器引入了MMX技术以来，IA-32架构已经引入了许多SIMD扩展，分别是：MMX，流SIMD扩展(SSE), 流SIMD扩展(SSE2)和流SIMD扩展(SSE3)，SSSE3，SSE4和高级向量扩展(AVX).这些扩展都提供了一组指令，能够为封装好的整点或浮点数据提供SIMD类型的操作。其他结构也 有自己的SIMD扩展。如AMD的3DNow！，Cell和PowerPC的AltiVec等等。 可惜的是，和CPU提供的其他技术一样，多媒体 指令系统扩展的潜能并没有完全的发挥出来。目前，已经有一些论文在倡导科学家，软件开发人员使用这些指令加速程序。 这篇评论试图更深入的介绍 Intel的SIMD扩展，回顾努力使用这些扩展的一些研究，讨论阻碍多媒体扩展广泛应用的问题，并试图给出一些针对行的解决方法，和潜在的性能提升点。 SIMD 技术： SIMD是最早提出的并行处理模式之一，也是最简单最普遍的并行方法，试图用一个指令对数据集合中的每个数据作相同的操作。如下 图所示： 虽然SIMD技术还没有广泛应用，但也没有完全小时。因为SIMD扩 展对于特定的应用仍然很有意义，这些应用的特点是本身有并行的任务，需要大量的独立数据运算，包括3D图形运算，图像处理，语音识别，科学计算，数据库查 询等。 MMX技术： MMX是在第五代奔腾处理器中作为附加扩展引入的，最早用在提升图像生成，加密，视频编解码和I/O处理 上，相对于无MMX技术的处理器，通常能带来1.5到2倍的加速.MMX能处理64位封装的整型，引入了8个64位寄存器来实现、四种MMX数据类型(封 装的字节，半字，字，双字）和57条MMX指令. 8个MMX寄存器是通用寄存器，是浮点寄存器(ST0-ST7)的低64位的重用.MMX的数据 类型可以是8个字节整型元素的数组，4个半字整型元素的数组，2个字整型元素的数组或者1个双字整数.做SIMD运算时，SIMD指令取两个MMX寄存器 中的操作数，作相应的SIMD运算，并将结果存入结果寄存器中。MMX的指令系统由57条指令构成.包括基本算术操作、比较操作、转换操作、逻辑操作、移 位操作、访存及寄存器间移动操作和状态指令。因为MMX寄存器复用浮点寄存器，必要时，需要对MMX寄存器清空以便正常的浮点运算可以进行。 MMX 引入了一种新的溢出方式：饱和溢出(Saturation overflow).传统的溢出很多都是反转溢出(wraparound overflow).对于反转溢出，即溢出高位。但对于图像处理，这样做就不合适，比如两个白色的像素点相加，因为溢出，取低位，可能会是一个黑色的点， 显然和实际不符。饱和移除就是为解决这个问题，即若溢出则保留最值，而不是简单的取最低的几位。MMX提供有符号和无符号两种饱和溢出。 流 SIMD扩展技术(SSE) SSE在Intel 奔腾III中引入，作MMX技术的升级，并保持向后兼容。SSE扩展包括增加对128位寄存器內封装的或者普通的单精度浮点值的操作。SSE扩展引入了一 个新数据类型：128位封装单精度浮点类型，有4个IEEE标准的32位单精度浮点类型组成.该单精度数可以在XMM寄存器內或者主存中。SSE引入5类 新寄存器：XMM寄存器：8个128位寄存器支持单精度运算(XMM0-XMM7),能被x87 FPU，MMX寄存器或通用寄存器访问；MXCSR寄存器：32位寄存器包含SIMD浮点操作的控制和状态信息；MMX寄存器：用于64位封装整型，或者 为某些在MMX和XMM寄存器之间运算的操作提供操作数；通用寄存器：因为MMX和XMM寄存器不能用于存地址，8个32位的通用寄存器就被引入用于保存 SSE模式下的操作数的存储地址；EFLAGS寄存器：用于记录某些比较结果的32位寄存器. SSE也引入了70条新指令，可以分为4 类：SIMD单精度浮点运算；MXCSR状态管理指令；64位SIMD整点指令(扩展原MMX指令集);cache控制，预取和取值指令。 目前很 多的图形软件采用了这项技术，如Adobe Photoshop会在有SSE扩展的机器上用SSE加速，微软也在DirectX 6.1和之后的音/视频驱动中加入了SSE，这些都已经包含在Windows 98,Me,2000,NT和XP。 流SIMD扩展技术 2(SSE2) SSE2在奔四和Xeon处理器中引入，SSE2允许更多的计算并行，并扩展了MMX和SSE中的指令，而且引入了两个双精度浮 点数据类型。具体引入特性如下：六中数据类型、支持新数据类型的指令和对已有SIMD整型操作的扩展、修改已有指令以便支持SSE2. 双精度 <a href='http://www.lingcc.com/2010/05/04/10878/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F17%2F11227%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">向量处理器VS标量处理器中的向量扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F03%2F11619%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">自动向量化</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/12/10931/' rel='bookmark' title='前瞻-拿起SIMD的武器II'>前瞻-拿起SIMD的武器II</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2010/05/10/10928/' rel='bookmark' title='前瞻-拿起SIMD的武器I'>前瞻-拿起SIMD的武器I</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<h4>引言部分：</h4>
<p>多媒体处理算法应用在很多媒体处理环境中，如对文本，手写数据，2D/3D图形和音频对象的捕捉、制造、存储和传输等。过去 都是使用昂贵的多媒体处理硬件协同工作来加速。现在，通用处理器通过在体系结构上增加媒体处理支持来减少使用协同处理器分配和返回带来的开销。在通用处理 器上一个基本的操作能同时作用多个元素的支持成为SIMD并行处理。通过SIMD扩展，通用护理器通过捕捉多媒体算法中潜在的并行特性来加速应用。</p>
<div>自 Intel在Pentium II和Pentium 处理器引入了MMX技术以来，IA-32架构已经引入了许多SIMD扩展，分别是：MMX，流SIMD扩展(SSE),  流SIMD扩展(SSE2)和流SIMD扩展(SSE3)，SSSE3，SSE4和高级向量扩展(AVX).这些扩展都提供了一组指令，能够为封装好的整点或浮点数据提供SIMD类型的操作。其他结构也 有自己的SIMD扩展。如AMD的3DNow！，Cell和PowerPC的AltiVec等等。<span id="more-10878"></span><br />
可惜的是，和CPU提供的其他技术一样，多媒体 指令系统扩展的潜能并没有完全的发挥出来。目前，已经有一些论文在倡导科学家，软件开发人员使用这些指令加速程序。<br />
这篇评论试图更深入的介绍 Intel的SIMD扩展，回顾努力使用这些扩展的一些研究，讨论阻碍多媒体扩展广泛应用的问题，并试图给出一些针对行的解决方法，和潜在的性能提升点。</p>
<h4>SIMD 技术：</h4>
<p>SIMD是最早提出的并行处理模式之一，也是最简单最普遍的并行方法，试图用一个指令对数据集合中的每个数据作相同的操作。如下 图所示：</p>
</div>
<div id="attachment_10879" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/05/simd-model.jpg"><img class="size-medium wp-image-10879" title="simd-model" src="http://www.lingcc.com/wp-content/uploads/2010/05/simd-model-300x140.jpg" alt="" width="300" height="140" /></a><p class="wp-caption-text">单指令流多数据流模型</p></div>
<p>虽然SIMD技术还没有广泛应用，但也没有完全小时。因为SIMD扩 展对于特定的应用仍然很有意义，这些应用的特点是本身有并行的任务，需要大量的独立数据运算，包括3D图形运算，图像处理，语音识别，科学计算，数据库查 询等。</p>
<h5>MMX技术：</h5>
<p>MMX是在第五代奔腾处理器中作为附加扩展引入的，最早用在提升图像生成，加密，视频编解码和I/O处理 上，相对于无MMX技术的处理器，通常能带来1.5到2倍的加速.MMX能处理64位封装的整型，引入了8个64位寄存器来实现、四种MMX数据类型(封 装的字节，半字，字，双字）和57条MMX指令.<br />
8个MMX寄存器是通用寄存器，是浮点寄存器(ST0-ST7)的低64位的重用.MMX的数据 类型可以是8个字节整型元素的数组，4个半字整型元素的数组，2个字整型元素的数组或者1个双字整数.做SIMD运算时，SIMD指令取两个MMX寄存器 中的操作数，作相应的SIMD运算，并将结果存入结果寄存器中。MMX的指令系统由57条指令构成.包括基本算术操作、比较操作、转换操作、逻辑操作、移 位操作、访存及寄存器间移动操作和状态指令。因为MMX寄存器复用浮点寄存器，必要时，需要对MMX寄存器清空以便正常的浮点运算可以进行。<br />
MMX 引入了一种新的溢出方式：饱和溢出(Saturation overflow).传统的溢出很多都是反转溢出(wraparound  overflow).对于反转溢出，即溢出高位。但对于图像处理，这样做就不合适，比如两个白色的像素点相加，因为溢出，取低位，可能会是一个黑色的点， 显然和实际不符。饱和移除就是为解决这个问题，即若溢出则保留最值，而不是简单的取最低的几位。MMX提供有符号和无符号两种饱和溢出。</p>
<h5>流 SIMD扩展技术(SSE)</h5>
<p>SSE在Intel  奔腾III中引入，作MMX技术的升级，并保持向后兼容。SSE扩展包括增加对128位寄存器內封装的或者普通的单精度浮点值的操作。SSE扩展引入了一 个新数据类型：128位封装单精度浮点类型，有4个IEEE标准的32位单精度浮点类型组成.该单精度数可以在XMM寄存器內或者主存中。SSE引入5类 新寄存器：XMM寄存器：8个128位寄存器支持单精度运算(XMM0-XMM7),能被x87  FPU，MMX寄存器或通用寄存器访问；MXCSR寄存器：32位寄存器包含SIMD浮点操作的控制和状态信息；MMX寄存器：用于64位封装整型，或者 为某些在MMX和XMM寄存器之间运算的操作提供操作数；通用寄存器：因为MMX和XMM寄存器不能用于存地址，8个32位的通用寄存器就被引入用于保存 SSE模式下的操作数的存储地址；EFLAGS寄存器：用于记录某些比较结果的32位寄存器.<br />
SSE也引入了70条新指令，可以分为4 类：SIMD单精度浮点运算；MXCSR状态管理指令；64位SIMD整点指令(扩展原MMX指令集);cache控制，预取和取值指令。<br />
目前很 多的图形软件采用了这项技术，如Adobe Photoshop会在有SSE扩展的机器上用SSE加速，微软也在DirectX  6.1和之后的音/视频驱动中加入了SSE，这些都已经包含在Windows 98,Me,2000,NT和XP。</p>
<h5>流SIMD扩展技术 2(SSE2)</h5>
<p>SSE2在奔四和Xeon处理器中引入，SSE2允许更多的计算并行，并扩展了MMX和SSE中的指令，而且引入了两个双精度浮 点数据类型。具体引入特性如下：六中数据类型、支持新数据类型的指令和对已有SIMD整型操作的扩展、修改已有指令以便支持SSE2.<br />
双精度 SIMD运算的支持增强了在XMM寄存器上作高精度计算的能力。SSE2也让XMM寄存器可以作128封装整型的运算。现在程序员可以使用完备的SIMD 寄存器、数据类型和指令来开发混合单/双精度浮点，64位/128位整点的数据.SSE2并没有引入新的寄存器，只是做了功能扩展。</p>
<h5>流 SIMD扩展技术3(SSE3,SSSE3)</h5>
<p>SSE3在奔腾四为了支持超线程而引入。SSE3扩展包括13条新指令.SSE3并没有引入新的数据类型和寄存 器.</p>
<p>SSSE3在Intel Core架构中引入，增加了16条指令，每条指令都能在64位的MMX寄存器或128位的XMMS寄存器上运算</p>
<h5>流 SIMD扩展技术4(SSE4)</h5>
<p>SSE4 2006年9月发布，AMD k10和Intel Core中有使用，包括54条新指令。SSE4中增加了并非特定于多媒体应用的指令，如STTNI指令可以加速文本和字 符串处理；ATA能加速冗余校验。</p>
<h5>流 SIMD扩展技5(SSE5)</h5>
<p>SSE5是AMD 2007年8月发布的，作为AMD64结构在128 SSE基础上的补充。</p>
<h5>高级向量扩展 (AVX)</h5>
<p>Intel  2008年3月发布的SIMD扩展.寄存器从128位扩展为256位，并使用新的寄存器名YMM0-YMM15，已有的128位指令使用256位寄存器的 低128位.使用无副作用指令格式，即所有形如a=a+b的操作都会会被替换为c=a+b，这样操作数计算的结构不会污染原操作数，所有的有两个操作数的 XMM指令都会用这种方式扩展为3个操作数的形式.访存中对SIMD数据对齐的要求放宽。<br />
AVX中指令的编码方式也有改变，通过 修改前缀使得无副作用指令格式得意实现。AVX扩展适用于多媒体、科学计算和经济方面的应用，能有效增加并行性和浮点SIMD运算的吞吐率，降低寄存器载 入开销。目前Linux 2.6.30、Windows 7 SP1和Windows Server 2008 R2 SP1都有AVX增强.</p>
<h5>3DNow!技术</h5>
<p>3DNow！是AMD在MMX的基础上作的扩展，和SSE对MMX的扩展相似。最早用在 AMD-K6-2处理器上，之后在AMD-K6-III和AMD  Athlon处理器上实现。3DNow！是一组指令，有效缓解了传统多浮点运算和多媒体应用的瓶颈。3DNow！使用MMX寄存器但增加了45条浮点指 令，能同时对1个或2个单精度浮点值作运算.3DNow！支持加、减、乘、除、和整点之间的转换、比较、绝对值、数据预取等操作。根据AMD提供的资 料，3DNow！的带来，如同SSE为MMX带来的同等提升，但指令和复杂度降低。但SSE和3DNow！不兼容。目前微软的Windows  9X，NT和所有最新系统，DirectX 6.x可以使用3DNow！加速，<a href="http://www.amd.com/us-en/Corporate/VirtualPressRoom/0,,51_104_557_560,00.html" target="_blank">OpenGL也可以使用3DNow！加速.</a><br />
3DNow！为高分辨率的显示提高了帧频率，更接近 现场的高保真音频等等。</p>
<h5>小小结：</h5>
<p>操作系统对某个体系结构的支持，已经远远不是单纯的某个指令集能解决的问题。为了用户体验和应用性能提升，需要更多的软/硬件协同的设计。软件设计中需要哪条指令更高效的运行，哪些指令用不到，都可以给硬件设计作参考。这也是Wintel联盟如此紧密的原因。与CPU架构密切相关的SIMD指令，作为改进普通中端用户多媒体体验的关键，更是在Windows系统中占据不可替代的作用。</p>
<p>在Gentoo portage中做了个简单的调研，发现现在使用SIMD加速的包很少，如mplayer，ffmpeg，gimp，大多数都为多媒体应用程序，支持最多的也只有sse，sse2,3DNow和mmx，再新的根本没有。而且Intel等芯片设计厂商也有一些未公开的特殊指令，只提供给某些合作伙伴使用，再加上开源爱好者们没有那么多的时间和精力去根据已有的程序和算法，按照某个芯片独特的SIMD支持，设计并验证针对它的软件修改。那很多开源软都难用到这些特性。性能也就没办法和Windows下的相比。</p>
<p>这小小结，只是愤青的一点感慨而已。既得利益集团是不会在乎这些的。</p>
<p>敬请期待SIMD系列下文《前瞻-拿起SIMD的武器!》</p>
<p>PS：原文根据ayaya的评论做了很多更正，谢谢ayaya：）</p>
<p>参考：<br />
<a href="http://comjnl.oxfordjournals.org/cgi/content/abstract/bxm099">A Review of SIMD Multimedia Extensions and their Usage in Scientific and Engineering Applications.</a></p>
<p>http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions</p>
<p>http://en.wikipedia.org/wiki/SSSE3</p>
<p>http://en.wikipedia.org/wiki/SSE4</p>
<p>http://en.wikipedia.org/wiki/SSE5</p>
<p>http://en.wikipedia.org/wiki/Advanced_Vector_Extensions</p>
<p>http://en.wikipedia.org/wiki/CVT16_instruction_set</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F17%2F11227%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">向量处理器VS标量处理器中的向量扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F03%2F11619%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">自动向量化</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F04%2F10878%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/12/10931/' rel='bookmark' title='前瞻-拿起SIMD的武器II'>前瞻-拿起SIMD的武器II</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2010/05/10/10928/' rel='bookmark' title='前瞻-拿起SIMD的武器I'>前瞻-拿起SIMD的武器I</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/05/04/10878/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Gentoo 沙盘简介</title>
		<link>http://www.lingcc.com/2010/03/07/10707/</link>
		<comments>http://www.lingcc.com/2010/03/07/10707/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 11:06:11 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10707</guid>
		<description><![CDATA[emerge一个软件包时Portage的工作方式: 1,Portage下载源码tar包和补丁(如果需要的话) 2,Portage解压缩tar包到指定位置,所有的编译将在该目录展开,Portage默认使用/var/tmp/portage/packagename/work 3,解压和打补丁(如果需要的话)后(ebuild中的src_unpack()函数),Portage开始编译,一般情况下在特定目录(ebuild使用${WORKDIR}变量指定目录)下执行configure和make命令. 4,编译完成后,portage将所有指定目录下的文件合并到正在运行的系统中.(通常为/,但通过合并时设置ROOT=”/路径”可以修改),为了避免非法或不正确的ebuild对整个文件系统造成不可逆的破坏,我们需要严格限制文件系统的哪个区域允许portage在解压和编译时修改,这就是沙盘工作的路径,默认时,沙盘启动,并限定ebuild(和它执行过程中的明林)都在指定的区域内写磁盘.若ebuild越过沙盘保护的环境,试图在外部区域写磁盘,就构成了沙盘越界. 沙盘的用途: 沙盘是portage用来协助调试ebuild的机制.主要目的是提供一个安全的受保护的环境系统来运行功能未知的程序.实质上,它提供了一个可以用于编译源码包但不会干扰操作系统其他部分运行的环境. 在ebuild的src_unpack,src_compile,src_test和src_install阶段,ebuild.sh都在沙盘内操作. http://bugday.gentoo.org/sandbox.html http://devmanual.gentoo.org/general-concepts/sandbox/index.html 相关文章： 使用crossdev安装龙芯的O32 gnu交叉工具链 Ebuild and emerge gentoo的相关配置-make.conf Gentoo中的交叉编译利器&#8211;crossdev gentoo如何处理被屏蔽(masked)的包 by 杨珂 转自linuxsir 用crossdev装龙芯的n32 gnu交叉工具链<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F21%2F11673%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Debian和Gentoo系统中Emacs 23不能使用ibus解决方法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>emerge一个软件包时Portage的工作方式:<br />
1,Portage下载源码tar包和补丁(如果需要的话)<br />
2,Portage解压缩tar包到指定位置,所有的编译将在该目录展开,Portage默认使用/var/tmp/portage/packagename/work<br />
3,解压和打补丁(如果需要的话)后(ebuild中的src_unpack()函数),Portage开始编译,一般情况下在特定目录(ebuild使用${WORKDIR}变量指定目录)下执行configure和make命令.<br />
4,编译完成后,portage将所有指定目录下的文件合并到正在运行的系统中.(通常为/,但通过合并时设置ROOT=”/路径”可以修改),为了避免非法或不正确的ebuild对整个文件系统造成不可逆的破坏,我们需要严格限制文件系统的哪个区域允许portage在解压和编译时修改,这就是沙盘工作的路径,默认时,沙盘启动,并限定ebuild(和它执行过程中的明林)都在指定的区域内写磁盘.若ebuild越过沙盘保护的环境,试图在外部区域写磁盘,就构成了沙盘越界.<br />
<span id="more-10707"></span><br />
沙盘的用途:<br />
沙盘是portage用来协助调试ebuild的机制.主要目的是提供一个安全的受保护的环境系统来运行功能未知的程序.实质上,它提供了一个可以用于编译源码包但不会干扰操作系统其他部分运行的环境.</p>
<p>在ebuild的src_unpack,src_compile,src_test和src_install阶段,ebuild.sh都在沙盘内操作.</p>
<p>http://bugday.gentoo.org/sandbox.html</p>
<p>http://devmanual.gentoo.org/general-concepts/sandbox/index.html</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F21%2F11673%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Debian和Gentoo系统中Emacs 23不能使用ibus解决方法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/03/07/10707/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用crossdev安装龙芯的O32 gnu交叉工具链</title>
		<link>http://www.lingcc.com/2010/01/07/10594/</link>
		<comments>http://www.lingcc.com/2010/01/07/10594/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 21:30:43 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[crossdev]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[make.conf]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[O32]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[交叉编译 cross compile]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10594</guid>
		<description><![CDATA[先来介绍一下n32和O32是啥，N32和O32就是MIPS系统上不同的ABI，即Application Binary Interface。MIPS体系结构最早只有o32的系统，但后来改进了寄存器的功能和分配方式，于是就又有了N32，相对于O32，N32的速度更快些。但二者目前在龙芯系统上还无法兼容。因为龙芯目前官方只支持O32，而N32有只有zhllg的overlay中有，所以使用gentoo来安装O32的工具链需要额外解决些问题，所以才有了这篇文章，之所以之前又写了N32的安装方法，是因为有zhllg大牛的技术支持，使得能直接安装N32的工具链。 言归正转，开始安装我们的O32工具链，因为使用crossdev(如果你还不知道什么是crossdev，请参考Gentoo中的交叉编译利器–crossdev)，我们仍旧需要配置龙芯的overlay。详细的配置过程参见用crossdev装龙芯的n32 gnu交叉工具链，我这里只简单列出命令： cd /root git clone git://www.gentoo-cn.org/var/git/loongson.git cd /usr/local/portage/ mkdir loongson cd loongson ln -s /root/loongson-overlay/sys-libs/ sys-libs ##glibc指向overlay中的glibc ln -s /root/loongson-overlay/sys-devel/ sys-devel ##将gcc指向overlay中的gcc 接下来修改make.conf，确保/usr/local/portage/loongson在你所有overlay查找的最前面： PORTDIR_OVERLAY="/usr/local/portage/loongson $PORTDIR_OVERLAY" 这样做是为了确保使用龙芯overlay中的gcc和binutils。 下面还不能直接执行 crossdev -t mipsel-unknown-linux-gnu 因为现在overlay还不支持O32的工具链，需要我们做些修改，这些修改是我安装的时候google并参考zhllg在n32工具链的bugfix做的，目前能正常安装并能编译运行helloworld，应该没有任何问题:) 在目录/usr/local/portage/loongson/sys-libs/glibc下，做如下修改 files/eblits/src_compile.eblit 160a161,167 + if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then + # remove "-32" gcc switch, since gcc <a href='http://www.lingcc.com/2010/01/07/10594/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">用crossdev装龙芯的n32 gnu交叉工具链</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>先来介绍一下n32和O32是啥，N32和O32就是MIPS系统上不同的ABI，即Application Binary Interface。MIPS体系结构最早只有o32的系统，但后来改进了寄存器的功能和分配方式，于是就又有了N32，相对于O32，N32的速度更快些。但二者目前在龙芯系统上还无法兼容。因为龙芯目前官方只支持O32，而N32有只有zhllg的overlay中有，所以使用gentoo来安装O32的工具链需要额外解决些问题，所以才有了这篇文章，之所以之前又写了<a href="../../../../2010/01/05/10588/">N32的安装方法</a>，是因为有zhllg大牛的技术支持，使得能直接安装N32的工具链。<span id="more-10594"></span></p>
<p>言归正转，开始安装我们的O32工具链，因为使用crossdev(如果你还不知道什么是crossdev，请参考<a href="../../../../2009/12/31/10534/">Gentoo中的交叉编译利器–crossdev</a>)，我们仍旧需要配置龙芯的overlay。详细的配置过程参见<a href="../../../../2010/01/05/10588/">用crossdev装龙芯的n32 gnu交叉工具链</a>，我这里只简单列出命令：<code><br />
cd /root<br />
git clone git://www.gentoo-cn.org/var/git/loongson.git<br />
cd /usr/local/portage/<br />
mkdir loongson<br />
cd loongson<br />
ln -s /root/loongson-overlay/sys-libs/  sys-libs    ##glibc指向overlay中的glibc<br />
ln -s /root/loongson-overlay/sys-devel/  sys-devel  ##将gcc指向overlay中的gcc<br />
</code><br />
接下来修改make.conf，确保/usr/local/portage/loongson在你所有overlay查找的最前面：<code><br />
PORTDIR_OVERLAY="/usr/local/portage/loongson $PORTDIR_OVERLAY"</code><br />
这样做是为了确保使用龙芯overlay中的gcc和binutils。</p>
<p>下面还不能直接执行<br />
<code>crossdev -t mipsel-unknown-linux-gnu</code><br />
因为现在overlay还不支持O32的工具链，需要我们做些修改，这些修改是我安装的时候google并参考zhllg在n32工具链的bugfix做的，目前能正常安装并能编译运行helloworld，应该没有任何问题:)</p>
<p>在目录/usr/local/portage/loongson/sys-libs/glibc下，做如下修改<br />
<code>files/eblits/src_compile.eblit<br />
160a161,167<br />
+     if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then<br />
+         # remove "-32" gcc switch, since gcc for other arch don't have this<br />
+         sed -i '2 s/-mabi=32//g' "${S}"/ports/sysdeps/mips/mips32/Makefile<br />
+         # fix stdio_lim.h missing problem<br />
+         sed -i 's/_MIPS_SZPTR/32/' "${S}"/ports/sysdeps/mips/bits/wordsize.h<br />
+<br />
+     fi<br />
files/eblits/src_install.eblit<br />
203a204,207<br />
+     if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then<br />
+         sed -i 's/\(__WORDSIZE.\+\)\(32\|64\)$/\1_MIPS_SZPTR/' \<br />
+             "${D}"/$(alt_headers)/bits/wordsize.h || die "restore wordsize.h failed"<br />
+     fi</code><br />
上面修改共三处，第一处解决emerge glibc-header时报的 gcc doesn&#8217;t support -mabi=32 错。修改方式是直接删除此选项，因为我们使用x86上的gcc而这个选项是支持O32的gcc才能接受的选项。<br />
第二，三处修改解决同一个问题，Emerging cross-gcc-stage1时出错/usr/mipsel-unknown-linux-gnu/sys-include/stdio.h  error: bits/stdio_lim.h: No such file or directory。 对于这个错误，你有两种修改方式，可以直接touch stdio_lim.h这个文件，这是很多手工编译工具链时给的建议。这里我们使用另一种方法，阻止该文件被include到stdio.h中，这是zhllg在N32工具链中使用的方式。</p>
<p>修改完了之后别忘了重新生成ebuild校验。<br />
<code>ebuild glibc-2.10.1.ebuild manifest<br />
ebuild glibc-2.9_p20081201-r2.ebuild manifest</code></p>
<p>bug修改完成，接下来，你就可以直接使用crossdev安装了。<br />
<code>crossdev -t mipsel-unknown-linux-gnu</code></p>
<p>Enjoy it！</p>
<p>PS：</p>
<ol>
<li>这是自己第一次修改ebuild，呵呵其实很简单，但自己一直都把自己当成用户，没有做过这种事，不敢做，所以浪费了很多时间，看着自己改出来的bug，心情很不一样哈。</li>
<li>我已经将上面的修改提交给了zhllg，等他做了相应的修改，就可以直接crossdev安装了。请关注此文。</li>
</ol>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">用crossdev装龙芯的n32 gnu交叉工具链</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/01/07/10594/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>用crossdev装龙芯的n32 gnu交叉工具链</title>
		<link>http://www.lingcc.com/2010/01/05/10588/</link>
		<comments>http://www.lingcc.com/2010/01/05/10588/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:51:08 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[crossdev]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[make.conf]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[交叉编译 cross compile]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[链接]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10588</guid>
		<description><![CDATA[不管怎样，龙芯是咱们应该骄傲的，但是用它来编译东西确实很慢，我们很需要一个交叉编译器，能够在性能稍好的平台上为龙芯平台编译程序，x86是目前比较常见的平台，本博在实际工作中，需要在gentoo系统上安装支持龙芯n32的交叉编译器，下面分享一下本博的安装过程。
crossdev是gentoo系统下很方便的交叉编译环境安装和卸载工具，想进一步了解可以参考本博的这篇文章，这里只讨论有了crossdev之后的安装过程。
首先，我们需要支持n32的gcc,glibc，linux-header,insight和binutils.其中，gcc,gdb,insight和 linux-header都已经有了官方支持，我们还需要glibc的一些patch。头疼打patch这种繁重的劳动？别急，已经有国内的开源爱好者们做好了这些，我们仅仅需要几个附加步骤即可。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用crossdev安装龙芯的O32 gnu交叉工具链</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>不管怎样，龙芯是咱们应该骄傲的，但是用它来编译东西确实很慢，我们很需要一个交叉编译器，能够在性能稍好的平台上为龙芯平台编译程序，x86是目前比较常见的平台，本博在实际工作中，需要在gentoo系统上安装支持龙芯n32的交叉编译器，下面分享一下本博的安装过程。<br />
crossdev是gentoo系统下很方便的交叉编译环境安装和卸载工具，想进一步了解可以参考本博的这篇文章<a href="../../../../2009/12/31/10534/">Gentoo中的交叉编译利器–crossdev</a>，这里只讨论有了crossdev之后的安装过程。<br />
首先，我们需要支持n32的gcc,glibc，linux-header,insight和binutils.其中，gcc,gdb,insight和linux-header都已经有了官方支持，我们还需要glibc的一些patch。头疼打patch这种繁重的劳动？别急，已经有国内的开源爱好者们做好了这些，我们仅仅需要几个附加步骤即可。<span id="more-10588"></span></p>
<p>我们需要首先有gentoo的龙芯overlay，这个overlay是gentoo开发者zhllg维护的龙芯gentoo n32系统的overlay，因为我们需要n32的glibc，所以就需要这个overlay。虽然你可以直接只下载glibc的相关文件，但是推荐你直接clone整个overlay，这样的话，以后你就可以直接用git工具和zhllg的overlay更新了。如果不懂什么是overlay，可以参考这个链接<a href="http://www.gentoo.org/proj/en/overlays/userguide.xml">Gentoo Overlays: Users&#8217; Guide</a>。你需要一个位置存放overlay的内容，因为我们只需要glibc，所以你最好放在/usr/local/portage/以外的地方，然后在/usr/local/portage/做glibc的链接到龙芯的overlay里，这样能避免安装其他软件中的龙芯支持，搞乱你自己的x86系统。假定你在/root下存放overlay。你需要执行以下命令:<code><br />
cd /root<br />
git clone git://www.gentoo-cn.org/var/git/loongson.git<br />
cd /usr/local/portage/<br />
mkdir loongson<br />
cd loongson<br />
ln -s /root/loongson-overlay/sys-libs/  sys-libs    ##glibc指向overlay中的glibc<br />
ln -s /root/loongson-overlay/sys-devel/  sys-devel  ##将gcc指向overlay中的gcc</code><br />
至于为啥要把gcc也做软链接到龙芯的overlay，其实是因为历史遗留问题，原来的gcc4不支持，需要打补丁，现在不需要了，不过以后可能还需要，所以就做了这个软链接，不过你到overlay里，ls -l一下可以看到其实overlay里gcc也是链接，指向/usr/portage/下的gcc。</p>
<p>接下来就要告诉emerge，从overlay中找工具链中的gcc/binutils/glibc。我们要编辑/etc/make.conf文件，添加本地龙芯的portage，这里要注意，之所以我在/usr/local/portage下又创建文件夹是因为我有layman。另外你需要确保/usr/local/portage/loongson在你所有overlay查找的最前面：<code><br />
PORTDIR_OVERLAY="/usr/local/portage/loongson $PORTDIR_OVERLAY"</code><br />
这样做是为了确保使用龙芯overlay中的gcc和binutils。</p>
<p>接下来就能直接安装了：<code><br />
crossdev -t mips64el-unknown-linux-gnu</code></p>
<p>之后你就能享受交叉编译了，mipsel-unknown-linux-gnu-gcc 编译个helloword试试吧:)</p>
<p>龙芯是咱们自己的东西，大家一起努力才能让龙芯走向世界！</p>
<p>这里要注意几个问题：<br />
1，如果你是新安装的glibc，龙芯overlay中的glibc是2.10的，你gentoo系统的glibc的版本不能比这个低才行，不然会有冲突，具体的错误提示我忘记了。<br />
2，一定要让龙芯overlay在PORTDIR_OVERLAY的最前面。<br />
3，具体安装以下内容<br />
linux-headers-2.6.27-r2 from portage.<br />
binutils-2.19.1-r1 from loongson overlay.<br />
gcc-4.4.2 from portage. The gcc in loongson overlay currently is just a symlink to portage gcc.<br />
glibc-2.10.1  from loongson overlay.</p>
<p>参考</p>
<p>http://r0bertz.blogspot.com.sixxs.org/2009/11/update-on-building-mips64el-cross.html</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F07%2F10594%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用crossdev安装龙芯的O32 gnu交叉工具链</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F05%2F10588%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/01/05/10588/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ebuild and emerge</title>
		<link>http://www.lingcc.com/2010/01/02/10570/</link>
		<comments>http://www.lingcc.com/2010/01/02/10570/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 13:22:14 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[IT生活]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[USE]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10570</guid>
		<description><![CDATA[记录自己学习ebuild的一点东西。但是还不完整。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F08%2F10609%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC中的pie和fpie选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/05/03/10884/' rel='bookmark' title='安装LLVM2.7 step by step'>安装LLVM2.7 step by step</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>折腾了半天的ebuild,将记录张贴如下：</p>
<li>ebuild 包含下载，解压，编译安装包的全部信息，还有卸载和配置内容。大多数ebuild用bash脚本编写。简单来说就是一个Portage系统的底层z直接接 口,它可以通过命令执行ebuild文件中提供的子功能。包括下载源码包(fetch),解压(unpack),配置(configure),编译 (make),安装目标文件(install)甚至包括重新打包为二进制压缩包(package)</li>
<li>例如，以我现在正在安装的cross-mips64el-unknown-linux-gnu/gcc为例，需要使用gcc-4.4.2.ebuild。运行 ebuild gcc-4.4.2.ebuild help 会得到能执行的命令，如下<span id="more-10570"></span></li>
<p><code>ebuild /usr/local/portage/loongson/cross-mips64el-unknown-linux-gnu/gcc/gcc-4.4.2.ebuild  help</code><br />
你就可以看到ebuild能执行的命令了，这里列举几个和安装有关的。<br />
help        : show this help screen,帮助信息<br />
setup       : execute package specific setup actions，执行设置命令，检测系统环境和系统变量设置以及设置必要的环境变量<br />
fetch       : download source archive(s) and patches，在指定的URL下载源码包<br />
unpack      : unpack sources (auto-dependencies if needed) 解压源码包<br />
prepare     : prepare sources (auto-dependencies if needed)<br />
configure   : configure sources (auto-fetch/unpack if needed) 执行configure脚本得到makefile，在gcc的ebuild里，configure和make一起完成了。<br />
compile     : compile sources (auto-fetch/unpack/configure if needed) 执行make命令<br />
test        : test package (auto-fetch/unpack/configure/compile if needed)  执行make test<br />
install     : install the package to the temporary install directory  执行make install，安装到/var下的指定目录<br />
qmerge      : merge image into live filesystem, recording files in db  将make install得到的镜像安装到系统中，并升级db<br />
merge       : do fetch, unpack, compile, install and qmerge  <em>将上面几步一起完成<br />
unmerge     : remove package from live filesystem </em>相当于emerge -C<br />
config      : execute package specific configuration actions<br />
package     : create a tarball package in /usr/portage/packages/All  <em>将编译出的二进制文件打包<br />
rpm         : build a <a title="The tiddler 'RedHat' doesn't yet exist" href="javascript:;">RedHat</a> RPM package </em>生成rpm包<br />
clean       : clean up all source and temporary files  删除/var/tmp/portage/下编译使用的所有临时文件。<br />
可 见基本上emerge是ebuild分解动作的连续执行，但是有个疑问，ebuild是在何时根据use的配置configure。根据上面的这些命令， 应该是在setup时。在setup的过程中，ebuild会根据当前的系统设置和USE设置，检测系统，并export很多的系统变量。并保存到文件 environment中</p>
<li>ebuild的命名：pkg-ver{_suf{#}}}{-r#}.ebuild</li>
<li>ebuild 的内容，头部，变量，函数和帮助函数四部分。其中，变量包括:包和版本相关变量(P,PN,PV,PR,PVR,PF,CATEGORY,A),目录 (WORKDIR,FILESDIR,S,T,D)。几个关键函数:pkg_setup(),pkg_nofetch,src_unpack(解压到 WORKDIR),src_prepare(准备源码，包括打补丁),src_configure(configure在这部分完 成),src_compile(编译过程),src_test(运行包里面的测试集测试),src_install(包含所有安装目标文件夹信 息),pkg_config(安装之后的配置)</li>
<li>portage相关</li>
<li>portage使用python和bash编写，基于ebuild。</li>
<li>emerge &#8211;sync emerge-webrsync同步portage树</li>
<li>emerge search pdf ,emerge searchdesc pdf 前者搜索包名称中有pdf的，后者搜索包介绍中有pdf的。</li>
<li>emerge 命令是比较基本的软件包管理工具，它会自动的完成下载源码包，解压，configure,make,make install的功能，其中下载源码包默认就在/usr/portage/distfiles/文件夹下。解压，configure,make 都在/var/tmp/portage/下。</li>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F08%2F10609%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC中的pie和fpie选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/05/03/10884/' rel='bookmark' title='安装LLVM2.7 step by step'>安装LLVM2.7 step by step</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/01/02/10570/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gentoo中的交叉编译利器&#8211;crossdev</title>
		<link>http://www.lingcc.com/2009/12/31/10534/</link>
		<comments>http://www.lingcc.com/2009/12/31/10534/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 14:03:21 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[crossdev]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[make.conf]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[交叉编译 cross compile]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10534</guid>
		<description><![CDATA[本文介绍使用gentoo 上的crossdev 交叉编译环境构建工具便捷高效构建交叉编译器的过程<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F21%2F10761%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo安装texlive2009–字体</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F19%2F10892%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">走进Debian和Gentoo中的系统初始化过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/03/08/10709/' rel='bookmark' title='GNU工具链学习笔记'>GNU工具链学习笔记</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<li>什么是Crossdev[I]</li>
<p><code>sys-devel/crossdev<br />
Available versions:  0.9.18-r10 ~0.9.19 **99999999<br />
Installed versions:  0.9.18-r10(03:44:50 PM 11/29/2009)<br />
Homepage:            http://www.gentoo.org/<br />
Description:         Gentoo Cross-toolchain generator</code><br />
交叉编译时很多嵌入式开发必须的工具，因为资料太少，遇到的问题又很难解决，所以交叉的开发环境一直让很多程序员头疼。我们就来了解一下gentoo下如何构建交叉编译环境。<br />
先说说工具链，工具链是用来组建一个系统的工具包集合，因为它们使用输入和输出连接在一起，所以称为链。通常工具链包括以下几部分：<span id="more-10534"></span></p>
<ul> binutils&#8211;用来生成二进制的基本工具(包括汇编器和连接起)</ul>
<ul> gcc&#8211;GNU编译器集(C和C++编译器)</ul>
<ul> glibc/uclibc/newlib&#8211;系统C语言库</ul>
<ul> linux-headers&#8211;系统文件库需要的内核头文件</ul>
<ul> gdb&#8211;GNU调试工具</ul>
<p>一般的Gentoo系统都将工具链作为基础系统的一部分，并且将工具链配置为能生成本机的二进制文件。为了能编译其他平台上的二进制文件，就需要交叉工具链，Gentoo提供了一个简单但很强大的工具CrossDev来管理工具链，它可以编译安装任意GCC支持的交叉工具链，因为Gentoo将工具链的文件安装在平台特定的目录下，所以Crossdev得到的交叉工具链不会干扰到本地的工具链。手工编造一个交叉工具链太痛苦了。。。。<!--more--></p>
<li>工具链使用的环境变量</li>
<p>工具链的环境变量总是让人很头疼，下面我们做个详细的介绍<br />
变量名&#8212;生成交叉工具链时的含义&#8212;生成目标平台二进制文件时的含义<br />
CBUILD&#8211;编译交叉工具链的平台&#8212;编译程序的平台<br />
CHOST&#8211;交叉工具链运行的平台&#8212;使用交叉工具链生成的二进制文件将运行的平台<br />
CTARGET&#8211;使用交叉工具链生成的二进制文件将运行的平台&#8211;使用交叉工具链生成的二进制文件将运行的平台(内容虽然重复，但设置它没有坏处，有些二进制包需要它)<br />
ROOT&#8211;将要安装的虚/路径<br />
PORTAGE_CONFIGROOT&#8211;portage能找到配置文件的虚/路径(如/etc/make.conf)<br />
若我们有个AMD64的gentoo机器，和一个想要开发程序的ARM PDA。那上面的变量可以设置如下：<br />
CBUILD&#8211;x86_64-pc-linux-gnu&#8211;x86_64-pc-linux-gnu<br />
CHOST&#8211;x86_64-pc-linux-gnu&#8211;arm-unknown-linux-gnu<br />
CTARGET&#8211;arm-unknown-linux-gnu&#8211;not set<br />
ROOT&#8212;[not set -- defaults to /]&#8212;[/path/where/you/install]<br />
PORTAGE_CONFIGROOT&#8212;[not set -- defaults to /]&#8212;-[/path/where/your/portage/env/for/arm/pda/is]</p>
<li>一些术语</li>
<p>cross-compiler	CHOST！=CTARGET的工具链<br />
canadian cross	加拿大式交叉编译CBUILD != CHOST &amp;&amp; CHOST != CTARGET的工具链<br />
CBUILD	build system 编译二进制文件所使用平台<br />
CHOST	host system 运行二进制文件所使用平台<br />
CTARGET	target system 编译得到的二进制文件将要运行的平台<br />
sysroot	system root 编译器用来查找它的标准头文件和库的根目录<br />
hardfloat	系统用来处理浮点数学运算的硬件浮点单元(FPU)<br />
softfloat	若系统没有硬件FPU,就需要所有的浮点数使用定点数学运算近似<br />
PIE		位置无关的执行(-fPIE -pie)<br />
PIC		位置无关代码(-fPIC)<br />
CRT		C语言运行时</p>
<li>系统元组</li>
<p>系统元组标记整个系统的特征，具体的内容由GNU config项目规定。具体的模式是机器(machine)-类型(vendor)-内核(kernel)-操作系统(operating system)。比如，博主我的电脑上就是i686-pc-linux-gnu.下表是一些比较常见的配置</p>
<table style="height: 258px;" width="513">
<tbody>
<tr>
<td><strong>机器</strong></td>
<td>类型</td>
<td><strong>内核</strong></td>
<td>操作系统</td>
</tr>
<tr>
<td>alpha<br />
arm / armeb<br />
avr / avr32<br />
bfin<br />
cris<br />
hppa / hppa1.1 / hppa2.0 / hppa64<br />
ia64<br />
i386 / i486 / i586 / i686<br />
m68k<br />
mips / mipsel / mips64 / mips64el<br />
nios / nios2<br />
powerpc / powerpc64<br />
sparc / sparcv8 / sparcv9 / sparc64<br />
s390 / s390x<br />
sh / sh3 / sh4 / sheb / sh3eb / sh4eb / sh64<br />
vax<br />
x86_64</td>
<td>gentoo<br />
pc<br />
softfloat [1]<br />
unknown</td>
<td>elf [2]<br />
freebsd6.2<br />
linux<br />
mingw32 / mingw64<br />
uclinux [3]</td>
<td>gnu [4]<br />
gnueabi [5]<br />
uclibc [6]<br />
uclibceabi</td>
</tr>
</tbody>
</table>
<p>来说说这其中几个比较有趣的：</p>
<ul> 类型那部分几乎可以随便设置，</ul>
<ul> 当操作系统指定为elf时，你就可以不用操作系统，而是直接把编译出的代码放到硬件上运行。</ul>
<ul>uclinux编译出的FLAT二进制文件，能在MMU不可用的Linux上运行</ul>
<ul> 操作系统中指定gnu表明系统库为libc</ul>
<li>言归正传，装我们的交叉编译器</li>
<p>我们的第一步当然是<code><br />
emerge -av crossdev</code><br />
这个命令会安装所有交叉编译相关的包。在博主的电脑上，就需要安装以下包<code><br />
emerge -pv crossdev</code></p>
<p>These are the packages that would be merged, in order:</p>
<p>Calculating dependencies&#8230; done!<br />
[ebuild  N    ] dev-util/unifdef-1.20  65 kB<br />
[ebuild  N    ] sys-devel/crossdev-0.9.18-r10  0 kB</p>
<p>Total: 2 packages (2 new), Size of downloads: 65 kB</p>
<p>注意，crossdev只是一个工具，我们的最终目的是使用crossdev编译一个交叉工具链出来，有必要先看看帮助，直接运行crossdev命令<br />
<code><br />
# crossdev<br />
Usage: crossdev [options] --target TARGET<br />
Options:<br />
--b, --binutils ver   Specify version of binutils to use<br />
--g, --gcc ver        Specify version of gcc to use<br />
--k, --kernel ver     Specify version of kernel headers to use<br />
--l, --libc ver       Specify version of libc to use<br />
-S, --stable          Use latest stable versions as default<br />
-C, --clean target    Uninstall specified target<br />
-P, --portage opts    Options to pass to emerge (see emerge(1))<br />
--with[out]-headers   Build C library headers before C compiler?<br />
Stage Options:<br />
-s0, --stage0         Build just binutils<br />
-s1, --stage1         Also build a C compiler (no libc/C++)<br />
-s2, --stage2         Also build kernel headers<br />
-s3, --stage3         Also build the C library (no C++)<br />
-s4, --stage4         Also build a C++ compiler [default]<br />
Extra Fun (must be run after above stages):<br />
--ex-only             Skip the stage steps above<br />
--ex-gcc              Build extra gcc targets (gcj/ada/etc...)<br />
--ex-gdb              Build a cross gdb<br />
--ex-insight          Build a cross insight<br />
Target (-t) takes a tuple ARCH-VENDOR-OS-LIBC; see 'crossdev -t help'</code><br />
上面可以看到，我们能用crossdev指定binutils gcc kernel和libc的版本，还有不同的编译stage来指定不同规模的工具链。甚至在Extra Fun中包含了gdb，扩展的gcc等支持，insight是gdb的图形化接口，博主没有用过，所以不知道。<br />
再来看看crossdev支持的系统元组们<br />
<code><br />
# crossdev -t help<br />
Supported Architectures:<br />
- alpha                                     - arm / armeb<br />
- hppa (parisc)                             - ia64<br />
- i386 / i486 / i586 / i686 (x86)           - m68k<br />
- mips / mipsel / mips64 / mips64el<br />
- powerpc (ppc) / powerpc64 (ppc64)<br />
- sparc / sparc64                           - s390 / s390x<br />
- sh / sh[1-5] / sh64                       - x86_64 (amd64)<br />
Supported C Libraries:<br />
- glibc (gnu)<br />
- klibc       [prob wont work]<br />
- newlib      [bare metal/no operating system]<br />
- uclibc      [not all arches are ported]<br />
Special Targets:<br />
- avr      http://www.nongnu.org/avr-libc/<br />
- bfin     http://blackfin.uclinux.org/<br />
- h8300    http://h8300-hms.sourceforge.net/<br />
- mingw32  http://www.mingw.org/<br />
- msp430   http://mspgcc.sourceforge.net/<br />
- nios2    http://www.altera.com/products/ip/processors/nios2/ni2-index.html<br />
- xc16x    http://www.infineon.com/<br />
- ee / iop / dvp (ps2) [Playstation 2 targets]<br />
- ppu / spu (cell) [Cell/Playstation 3 targets]<br />
Softfloat toolchains:<br />
Include 'softfloat' in the 'vendor' field<br />
e.g. armeb-softfloat-linux-uclibc  powerpc-booya_softfloat-linux-gnu<br />
</code><br />
不懂的话您就看看上面关于系统元组的介绍，具体我就不解释了，好了，现在看是安装。开动拉。。。。。因为博主要安装mips64el-unknown-linux-gnu的编译器，就直接运行了<br />
<code><br />
# crossdev --target mips64el-st-linux-gnu<br />
-------------------------------------------------------------------------------------------------------------------------------------------------------------<br />
* Host Portage ARCH:     x86<br />
* Target Portage ARCH:   mips<br />
* Target System:         mips64el-st-linux-gnu<br />
* Stage:                 4 (C/C++ compiler)</code></p>
<p>* binutils:              binutils-[latest]<br />
* gcc:                   gcc-[latest]<br />
* headers:               linux-headers-[latest]<br />
* libc:                  glibc-[latest]</p>
<p>* PORTDIR_OVERLAY:       /usr/local/portage/layman/gentoo-china<br />
* PORT_LOGDIR:           /var/log/portage<br />
* PKGDIR:                /usr/portage/packages/cross/mips64el-st-linux-gnu<br />
* PORTAGE_TMPDIR:        /var/tmp/cross/mips64el-st-linux-gnu<br />
_  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  &#8211;  _  &#8211;  ~  -<br />
* Forcing the latest versions of {binutils,gcc}-config/gnuconfig &#8230;                                                                                  [ ok ]<br />
* Log: /var/log/portage/cross-mips64el-st-linux-gnu-binutils.log<br />
* Emerging cross-binutils &#8230;<br />
这是个非常漫长的过程。。。。。。。。。因为是mips64el的，遇到了glibc checkfail的问题。这个问题正在解决中，以后再汇报。<br />
下面假设你安装的是arm的<br />
＃crossdev -t arm-unknown-linux-gnu</p>
<p>最后，再说说<br />
mips64el-unknown-linux-gnu 和mips64el-st-linux-gnu。其实没有区别，你可以简单的理解为是谁制作了这个工具链，比如st就代表这个工具链是ST作的，比如，我曾经使用的一个mips64el-st-linux-gnu就是曾经从意法半导体的网站上下载的，不过现在好像链接已经没有了。而mips64el-unknown-linux-gnu是上面crossdev自己编译出来的，在gentoo的overlay中，使用的就是unknown，所以就沿用了unknown</p>
<p>你可以参考下面几个链接<br />
<a href="http://www.gentoo.org/proj/en/base/embedded/handbook">http://www.gentoo.org/proj/en/base/embedded/handbook</a></p>
<p>http://psas.pdx.edu/GentooCrossCompilerHowto/</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F21%2F10761%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo安装texlive2009–字体</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F19%2F10892%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">走进Debian和Gentoo中的系统初始化过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F31%2F10534%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/03/08/10709/' rel='bookmark' title='GNU工具链学习笔记'>GNU工具链学习笔记</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2009/12/31/10534/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>GCC初窥</title>
		<link>http://www.lingcc.com/2009/12/29/10503/</link>
		<comments>http://www.lingcc.com/2009/12/29/10503/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 12:44:03 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[GCC]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[编译理论实践和应用]]></category>
		<category><![CDATA[3dnow]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[builtin]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[LLVM]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[sse]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[后端]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[选项学习]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10503</guid>
		<description><![CDATA[这是gcc maillist中某国际友人 laurent@guerby.net 做的2个小时报告的ppt，报告题目为。最近一直想深入了解gcc，而这个ppt基本包含本博想了解的内容，所以将其翻译并分享到这里。翻译过程中，很多地方可能有错，请大家不吝赐教。

什么是GCC
GCC--GNU Compiler Collection,即GNU 编译器集合。GCC即可作为本地编译器也能作为交叉编译器，它支持很多高级语言和多个编译和目标平台。GCC的网址 http://gcc.gnu.org.它是FSF基金会版权所有的自由软件.<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F16%2F11210%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC Internal 中文文档上线</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F27%2F11679%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC几个选项学习</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F28%2F11567%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">仔细端详GCC 4.6的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F23%2F11157%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">open64中的gcc前端</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/16/10746/' rel='bookmark' title='来仔细看看GCC 4.5.0'>来仔细看看GCC 4.5.0</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>这是gcc maillist中某国际友人 laurent@guerby.net 做的2个小时报告的ppt，报告题目为GCC Toulibre 20091216。最近一直想深入了解gcc，而这个ppt基本包含本博想了解的内容，所以将其翻译并分享到这里。翻译过程中，很多地方可能有错，请大家不吝赐教。原版的ppt见文末。</p>
<ul>
<li>什么是GCC</li>
</ul>
<p>GCC&#8211;GNU Compiler Collection,即GNU 编译器集合。GCC即可作为本地编译器也能作为交叉编译器，它支持很多高级语言和多个编译和目标平台。GCC的网址 <a href="http://gcc.gnu.org">http://gcc.gnu.org</a>.它是FSF基金会版权所有的自由软件.<span id="more-10503"></span></p>
<ul>
<li>GCC支持的语言</li>
</ul>
<p>已经在代码树中：c(gcc),c++(g++),Java(gcj),Ada(GNAT),Objective-C(gobjc),Objective-C++(gobjc++),Fortran(gfortran),不在代码树中,但已经支持的Modula-2,Modula-3,Pascal(gpc),PL/1,D(gdc),Mercury,VHDL(ghdl).</p>
<ul>
<li>GCC支持的目标平台</li>
</ul>
<p>已经在代码树中的,可以在gcc-4.5/gcc/config子文件夹中找到,包括:alpha,arc,arm,avr,bfin,cris,crx,fr30,frv,h8300,i386,ia64,iq2000,lm32,m32c,m32r,m68hc11,m68k,mcore,mep,mips,mmix,mn10300,moxie,pa,pdp11,picochip,rs6000,rx,s390,score,sh,soft-fp,sparc,spu,stormy16,v850,vax,vms,xtensa<br />
不在代码数中但已经支持的,可在GNU_Compiler_Collection的Wikipedia中找到,包括PDP-10和Z8000等14中终端.</p>
<ul>
<li>gcc易编译</li>
</ul>
<p>至少对于本地编译gcc,仅需以下几步<br />
<code><br />
$ tar xfj gcc-4.4.2.tar.bz2<br />
$ mkdir build &amp;&amp; cd build<br />
$ ../gcc-4.4.2/configure –prefix=/opt/gcc<br />
$ make bootstrap &amp;&amp; make install<br />
$ make -k check<br />
</code></p>
<ul>
<li>gcc编译很快</li>
</ul>
<p>具体速度依赖编译所用机器,在2&#215;4个核的X86_64上仅需15分钟.在ARM Cortex A8@800Mhz上需要大约7小时.编译需要约512M内存.注意,对于开发版的GCC,因为需要很多内建的检测,所以编译会较慢.</p>
<ul>
<li>自举</li>
</ul>
<p>编译器是用程序语言编写并被编译成机器码以便执行的,所以使用特定编程语言写出的编译器是能够编译它自己的(译者注:写编译器的语言和编译器编译的语言要相同),这就是编译器的自举.GCC的自举过程为首先系统编译器编译生成stage1,而后stage1被用来编译它自己生成stage2.接着stage2被用来编译生成stage3,其中stage2和stage3生成的要完全相同.(译者注:现在一个简单的make命令，将自动完成make bootstrap)</p>
<ul>
<li>编译前的准备工作.</li>
</ul>
<p>目前多数发布的是4.3或4.4.在debian或者ubuntu上可以使用命令<br />
<code><br />
$apt-get build-dep gcc<br />
</code><br />
来得到编译环境.在windowss上也能通过Cygwin或Mingw得到</p>
<ul>
<li>生成一个交叉编译器</li>
</ul>
<p>生成一个交叉编译器更难,因为GCC,GNU libc和Linux内核都需要链接并依赖彼此的头文件和常量.另外你可能还需要代码树之外的补丁.推荐使用预编译好的工具链,如gcc-avr或者是Crosstool-ng之类的工具.</p>
<ul>
<li>GCC项目历史</li>
</ul>
<p>1985年Richard Stallman开始了GCC作为GNU C编译器的项目；<br />
1991年GCC 1.x=&gt;GCC 2.x;<br />
1997年EGCS启动;<br />
1999年EGCS成为官方GCC2.95,GCC引入委员会;<br />
2001年GCC 3.x;<br />
2005年GCC4.x,并6个月至1年发布一次.</p>
<ul>
<li>贡献者</li>
</ul>
<p>下面数据基于快速修改记录处理(quick ChangeLog parsing)生成.依次为:年份==修改记录===邮件数<br />
1998 == 1685 == 107<br />
1999 == 2629 == 196<br />
2000 == 5588 == 326<br />
2001 == 6356 == 355<br />
2002 == 7259 == 371<br />
2003 == 10440 == 443<br />
2004 == 12857 == 440<br />
2005 == 11657 == 407<br />
2006 == 9221 == 356<br />
2007 == 8611 == 366<br />
2008 == 7789 == 357<br />
2009 == 9028 == 341</p>
<ul>
<li>基于GCC的有偿工作</li>
</ul>
<p>有Redhat,Novell等系统集成商,AdaCore,CodeSourcery等开发工具提供商,IBM,AMD,Intel,ST半导体等芯片提供商,Google(15人为C++支持工作,15人为GCC架构工作),还有科研机构如INRIA Saclay等.</p>
<ul>
<li>gcc是个相当大的项目</li>
</ul>
<p>gcc-4.5-20091210/gcc除去测试集,使用SLOCCOUNT计数,并按语言分组(按比例从大到小):ANSI C:1067922(67.18%);Ada:485301(30.53%);asm:30379(1.91%);更多的统计数据如下:<br />
31006 == 108 == asm<br />
170569 == 62 == texi<br />
189382 == 999 == ads<br />
230459 == 714 == h<br />
300237 == 229 == md<br />
707707 == 871 == adb<br />
1365750 == 772 == c<br />
共识别3033097行</p>
<ul>
<li>GCC中的选项</li>
</ul>
<p>-O0=&gt;无优化,和其他编译器有不同<br />
-O1=&gt;优化,但最小化编译时间<br />
-O2=&gt;有更多耗时的优化<br />
-O3=&gt;非常耗时的优化,如自动内联和向量化<br />
-Os=&gt;代码大小优化<br />
怎样得到-O1具体的优化选项?<br />
<code><br />
$gcc -Q --help=optimizers -O1<br />
</code><br />
输出结果:<br />
<code><br />
The following options control optimizations:<br />
-falign-jumps              [disabled]<br />
-falign-labels             [disabled]<br />
-falign-loops              [enabled]<br />
...<br />
</code><br />
4.3约140个,4.4约160个,4.5约180。这样我们就能查看gcc中O0,O1,O2,O3,Os中所有相关的优化选项。<br />
目标机相关的指令有哪些?运行命令<br />
<code><br />
$ gcc -Q --target-help<br />
Target specific options:<br />
-m128bit-long-double sizeof(long double) is 16<br />
-m32 Generate 32bit i386 code<br />
-m3dnow Support 3DNow! built-in functions<br />
-m64 Generate 64bit x86-64 code<br />
....<br />
</code><br />
此外还有一些选项,如<br />
-march=&#8230;. =&gt; 选择一个指令集(注意,得到的可执行代码可能不能运行)<br />
-mtune=&#8230; =&gt; 在指定的指令集中,针对某个目标机做 优化(atom,core2,opteron等)<br />
-native  =&gt;自动检测当前处理器</p>
<ul>
<li>如何找到有趣的选项</li>
</ul>
<p>在<a href="http://www.spec.org">http://www.spec.org</a>上找SPECint和SPECfp的详细结果,测量峰值时使用的选项都在文档中,或者使用自动调优工具,如Acovea,  <a href="http://www.coyotegulch.com/products/acovea/">http://www.coyotegulch.com/products/acovea/</a></p>
<ul>
<li>内建功能(Builtins)</li>
</ul>
<p>gcc特用的,但一些其他编译器有提供的功能.这些功能很有趣,因为都是机器无关的.<br />
例如:<br />
<code><br />
int __builtin_ffs(unsigned int x)<br />
</code><br />
返回1+x的最小指数(?),或者当x为0时返回0<br />
还有一些机器相关的内联汇编,如asm(“fsinx %1,%0&#8243;:”=f” (result):”f”(angle));</p>
<ul>
<li>GCC如何工作?</li>
</ul>
<p><code><br />
$ls -l /usr/bin/gcc-4.1<br />
-rwxr-xr-x 1 root root 205952 2006-12-11 00:12 /usr/bin/gcc<br />
</code><br />
可以看到,gcc程序很小,这仅仅是一个驱动器.它将根据命令行调用很多程序来完成任务.真正的编译器如下:<br />
<code><br />
5.3M /usr/lib/gcc/x86_64-linux-gnu/4.1.2/cc1<br />
5.8M/usr/lib/gcc/x86_64-linux-gnu/4.1.2/cc1plus<br />
7.7M /usr/lib/gcc/x86_64-linux-gnu/4.1.2/gnat1<br />
5.2M /usr/lib/gcc/x86_64-linux-gnu/4.1.2/jc1<br />
</code><br />
因此真正的顺序是:gcc=&gt;xx1=&gt;as或ld.(译者注:请参见本文末尾的gcc -v helloworld.c)</p>
<ul>
<li>Binutils是什么?</li>
</ul>
<p>GCC指示一个文本文件到文本文件的转换器,Binutils做生成可执行机器码的工作.<br />
运行命令<br />
<code><br />
$gcc -S file.c<br />
</code><br />
将只生成汇编文件file.s</p>
<ul>
<li>GCC的内部架构</li>
</ul>
<p>前端:每种编程语言有一个前端,包含该编程语言的词法分析，语法分析和语义分析，并将其翻译成统一的中间代码表示，接着该中间表示将会lower成GIMPLE。<br />
中端:操作GIMPLE，依次做机器无关和机器相关的转换和优化。<br />
后端:使用目标机器描述生成目标机器汇编文件。<br />
RTL即寄存器转换语言。在优化时，可能需要对程序遍历数以百遍。</p>
<ul>
<li>目标机器描述</li>
</ul>
<p>这是一个模式匹配引擎，它描述每个机器指令的作用。它是一个包含分段C语言代码的文本文件。如gcc/config/i386/i386.md.机器描述的质量将影响最终生成的目标代码的质量。仅需对每个目标机创建一个描述，就能将所有的语言移植到该机器上。</p>
<ul>
<li>关于Moxie</li>
</ul>
<p>Moxie的博客   <a href="http://moxielogic.org/blog/">http://moxielogic.org/blog/</a>。已有贡献，简化虚拟指令系统结构设计，为整个GNU工具链做贡献，现在已经可以运行Binutils，GCC，qemu和Linux。gcc/config/moxie/*.md有560行，gcc/config/moxie/*少于2000行。</p>
<ul>
<li>中间代码形式</li>
</ul>
<p>对于代码：<br />
<code><br />
int f(int x, int y) {<br />
int tmp;<br />
tmp=x;<br />
if (x&gt;0) tmp=-x;<br />
return tmp+y;<br />
}<br />
</code><br />
<code><br />
$ gcc -S -O3 -fdump-tree-all t.c</code><br />
得到共100多个文件。<br />
例如t.c.003t.original内容如下：<br />
<code><br />
f (int x, int y)<br />
{<br />
int D.2705;<br />
int tmp;<br />
tmp = x;<br />
if (x &gt; 0) goto ; else goto ;<br />
:<br />
tmp = -x;<br />
:<br />
D.2705 = tmp + y;<br />
return D.2705;<br />
}</code><br />
t.c.024t.ssa如下<br />
<code><br />
f (int x, int y) {<br />
int tmp;<br />
int D.2705;<br />
: tmp_3 = x_2(D);<br />
if (x_2(D) &gt; 0) goto ;<br />
else     goto ;<br />
:<br />
tmp_4 = -x_2(D);<br />
:<br />
# tmp_1 = PHI<br />
D.2705_6 = tmp_1 + y_5(D);<br />
return D.2705_6;<br />
}</code></p>
<ul>
<li>GCC与GDB</li>
</ul>
<p>使用选项-g生成调试信息。在汇编文集中插入很多运行无关的代码,如DWARF(和ELF).GDB通过读入这些代码来映射运行中每个点的行号，内存你和寄存器。GCC甚至可以在优化时生产调试信息，但是所生成的信息将很难跟踪。</p>
<ul>
<li>GCC和GDB中的bug</li>
</ul>
<p>GCC可能产生错误的调试信息，GDB可能错误的读入调试信息，用户界面可能和GDB通信时出错，因此在实际中，需要在这几个项目中获得帮助来搞定bug，希望这些项目之间有更好的沟通。</p>
<ul>
<li>GCC中的bug</li>
</ul>
<p>GCC每次发布都伴随着数以百计的已知bug(其他的编译器也一样),GCC中紧急bug类型(bugzilla中的关键字):wrong-code,accepts-invalid,编译器内部出错时很容易找出、ice-on-valid、ice-on-invalid、wrong-debug、missed-optimization、rejects-valid、memory-hog、compile-time-hog、assemble-failure、build</p>
<ul>
<li>如何报告GCC bug</li>
</ul>
<p>链接：<a href="http://gcc.gnu.org/bugs">http://gcc.gnu.org/bugs</a> 是个很好的必读资源，包含通常的非gcc bug。 若真是bug，可以运行<br />
<code><br />
$gcc -v -save-temps -O1 myfile.c</code><br />
生成myfile.i文件，通常情况下，添加这两个附件并连同平台名称和编译器输出就足够了。出错和不出错的版本信息也很有帮助。</p>
<ul>
<li>GCC4.5的新特性</li>
</ul>
<p>在链接  <a href="http://gcc.gnu.org/gcc-4.5/changes.html">http://gcc.gnu.org/gcc-4.5/changes.html</a>中能找到，具体如下<br />
第一，增加一个全新的链接时优化器(-flto),使用这一选项时，GCC能够为每个输入文件得到一个bytecode表示，并将它写入每个目标文件的特定ELF段中。当目标文件需要链接在一起时，所有的函数体将从这些ELF段中读出，并将其作为转换单元的一部分表示。这将使得过程间优化能在不同的文件间进行(甚至不同的语言间),为生成代码的性能提升提供可能。为使用链接时优化器，-flto选项需要在编译时和最终链接过程中指定，若程序不需要任何符号输出，将-flto和-fwhopr以及-fwhole-program一起使用可以让过程间优化器使用更激进的假设进而提升性能；第二，自动并行化可以作为Graphite的一部分打开，在打开-ftree-parallelize-loops=的同时，指定-floop-parallelize-all可以打开基于Graphite的优化；第三，现在可以在不修改源码的前提下扩展编译器。新加入的选项-fplugin=file.so告诉编译器载入共享目标文件file.so，并将它作为编译器的一部分运行。内部的文档描述了插件和编译器之间交互的细节以及如何交互。见  <a href="http://gcc.gnu.org/wiki/GCC_PluginAPI">http://gcc.gnu.org/wiki/GCC_PluginAPI</a></p>
<ul>
<li>如何提问和贡献</li>
</ul>
<p><a href="http://gcc.gnu.org/">http://gcc.gnu.org/</a> 有详细的用户手册。gcc-help@gcc.gnu.org 是gcc帮助用的邮件列表<br />
IRC用户帮助 =&gt; irc.freenode.org #gcc<br />
http://gcc.gnu.org/ml =&gt;邮件列表归档<br />
gcc-patches@gcc.gnu.org  补丁<br />
gcc@gcc.gnu.org<br />
gcc-testresults@gcc.gnu.org<br />
IRC开发频道 =&gt; irc.oftc.net #gcc</p>
<ul>
<li>GCC外的其他编译器</li>
</ul>
<p>自由的:LLVM和Open64，有插件时变得很有趣。<br />
非自由的:ICC（Intel),XLC(IBM)&#8230;<br />
评测编译器很难，最好基于你自己的代码，做自己的设置。当心bug和技术支持。如果你想做多平台，那GCC是很难搞定的。</p>
<ul>
<li>GCC编译农场(GCC Compile Farm)</li>
</ul>
<p>链接<a href=" http://gcc.gnu.org/wiki/CompileFarm"> http://gcc.gnu.org/wiki/CompileFarm</a>。 目的:为自由软件开发者提供方便访问且多样的体系结构用来编译和测试(并不局限于GCC).由FSF法国提供支持。很多研究所，个人和公司提供机器，主机和帮助。AMD和Genesi贡献了机器。</p>
<ul>
<li>结论</li>
</ul>
<p>GCC是一个庞大的老项目，但是它依旧活力十足，并有很多公司提供支持。学习GCC非常艰巨。即便高质量到Bug报告也是对GCC的贡献。</p>
<div id="__ss_2780061" style="width: 425px; text-align: left;"><a style="font: 14px Helvetica,Arial,Sans-serif; display: block; margin: 12px 0 3px 0; text-decoration: underline;" title="Gcc Toulibre 20091216" href="http://www.slideshare.net/erlv/gcc-toulibre-20091216">Gcc Toulibre 20091216</a><object style="margin: 0px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=gcc-toulibre-20091216-091227020235-phpapp02&amp;stripped_title=gcc-toulibre-20091216" /><param name="allowfullscreen" value="true" /><embed style="margin: 0px;" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=gcc-toulibre-20091216-091227020235-phpapp02&amp;stripped_title=gcc-toulibre-20091216" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration: underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration: underline;" href="http://www.slideshare.net/erlv">erlv</a>.</div>
</div>
<p>附：在译者电脑上运行gcc -v helloworld.c的输出。<br />
<code><br />
$ gcc -v helloworld.c<br />
Using built-in specs.<br />
Target: i686-pc-linux-gnu<br />
Configured with: /var/tmp/portage/sys-devel/gcc-4.4.2/work/gcc-4.4.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.2 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.2/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.4.2/python --disable-libgcj --with-arch=i686 --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.2 p1.0'<br />
Thread model: posix<br />
gcc version 4.4.2 (Gentoo 4.4.2 p1.0)<br />
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'<br />
/usr/libexec/gcc/i686-pc-linux-gnu/4.4.2/cc1 -quiet -v helloworld.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase helloworld.c -mtune=generic -march=i686 -auxbase helloworld -version -o /tmp/ccRoxwan.s<br />
ignoring nonexistent directory "/usr/local/include"<br />
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/include"<br />
#include "..." search starts here:<br />
#include &lt;...&gt; search starts here:<br />
/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include<br />
/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed<br />
/usr/include<br />
End of search list.<br />
GNU C (Gentoo 4.4.2 p1.0) version 4.4.2 (i686-pc-linux-gnu)<br />
compiled by GNU C version 4.4.2, GMP version 4.3.1, MPFR version 2.4.1-p1.<br />
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072<br />
Compiler executable checksum: bfddefec40932d7559ac2c097447ec05<br />
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'<br />
/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o /tmp/cc0ViYlD.o /tmp/ccRoxwan.s<br />
GNU assembler version 2.18 (i686-pc-linux-gnu) using BFD version (GNU Binutils) 2.18<br />
COMPILER_PATH=/usr/libexec/gcc/i686-pc-linux-gnu/4.4.2/:/usr/libexec/gcc/i686-pc-linux-gnu/4.4.2/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/libexec/gcc/i686-pc-linux-gnu/4.4.2/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/bin/<br />
LIBRARY_PATH=/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../:/lib/:/usr/lib/<br />
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'<br />
/usr/libexec/gcc/i686-pc-linux-gnu/4.4.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../crt1.o /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../crti.o /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/crtbegin.o -L/usr/lib/gcc/i686-pc-linux-gnu/4.4.2 -L/usr/lib/gcc/i686-pc-linux-gnu/4.4.2 -L/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../.. /tmp/cc0ViYlD.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/crtend.o /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../crtn.o<br />
</code></p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F16%2F11210%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC Internal 中文文档上线</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F27%2F11679%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC几个选项学习</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F28%2F11567%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">仔细端详GCC 4.6的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F23%2F11157%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F29%2F10503%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">open64中的gcc前端</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/01/08/10609/' rel='bookmark' title='GCC中的pie和fpie选项'>GCC中的pie和fpie选项</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/16/10746/' rel='bookmark' title='来仔细看看GCC 4.5.0'>来仔细看看GCC 4.5.0</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2009/12/29/10503/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</title>
		<link>http://www.lingcc.com/2008/03/28/9963/</link>
		<comments>http://www.lingcc.com/2008/03/28/9963/#comments</comments>
		<pubDate>Mon, 29 Nov 1999 16:00:00 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[crossdev]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://lingcc.net/blog/?p=9963</guid>
		<description><![CDATA[原文是英文wiki里Dealing with masked packages那篇 http://gentoo-wiki.com/TIP_Dealing_with_masked_packages 感觉这篇很重要，在wiki里做为TIP类，自然表示可以带来很多方便，特别是后面那几个脚本 早就想翻译这篇了， 一直没动手，眼看下周就要开学了，要忙开学的事情。 所以今天赶紧把它译了出来 里面有一些专有词汇 如有问题请大家指正 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; 相关连的那篇也翻译了: Package.keywords的小技巧 原文 http://gentoo-wiki.com/TIP_package.keywords 同步的中文wiki http://zh.gentoo-wiki.com/Package.ke&#8230;8A%80%E5%B7%A7 wiki里这两篇文章的相关联系已经更新 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 其他更新 HOWTO 用Cedega运行极品飞车9 http://zh.gentoo-wiki.com/HOWTO_%E7%&#8230;3%9E%E8%BD%A69 原文： http://gentoo-wiki.com/HOWTO_RUN_Nee&#8230;ed_with_Cedega &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 处理被屏蔽(masked)的包 本文内容： 介绍 被关键字(keyword)屏蔽(masked)的包 被不明的关键字屏蔽 被严格屏蔽(Hard masked)的包 手动进行严格屏蔽 编辑/etc/portage/package.keywords文件的简便方法 开放一大群有联系的包 介绍 首先，被关键字(keyword)屏蔽(masked)的包都是测试中的或者不稳定的包： 注意： &#34;(masked by: ~keyword)&#34; Masked By ~keyword Package Example 代码: # emerge gnome-extra/gdesklets-core '''Calculating dependencies''' !!! <a href='http://www.lingcc.com/2008/03/28/9963/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F08%2F27%2F9982%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zz Linux下的段错误的原因及调试</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/04/09/10732/' rel='bookmark' title='Gentoo上安装Texlive2009'>Gentoo上安装Texlive2009</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>原文是英文wiki里Dealing with masked packages那篇<br />
http://gentoo-wiki.com/TIP_Dealing_with_masked_packages<br />
感觉这篇很重要，在wiki里做为TIP类，自然表示可以带来很多方便，特别是后面那几个脚本<br />
早就想翻译这篇了， 一直没动手，眼看下周就要开学了，要忙开学的事情。<br />
所以今天赶紧把它译了出来 里面有一些专有词汇 如有问题请大家指正 </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em>相关连的那篇也翻译了: Package.keywords的小技巧<br />
原文 http://gentoo-wiki.com/TIP_package.keywords</p>
<p>同步的中文wiki http://zh.gentoo-wiki.com/Package.ke&#8230;8A%80%E5%B7%A7<br />
</em><br />
wiki里这两篇文章的相关联系已经更新<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
其他更新<br />
HOWTO 用Cedega运行极品飞车9 http://zh.gentoo-wiki.com/HOWTO_%E7%&#8230;3%9E%E8%BD%A69<br />
原文： http://gentoo-wiki.com/HOWTO_RUN_Nee&#8230;ed_with_Cedega</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>
<font size="+1"><strong>处理被屏蔽(masked)的包</strong></font></p>
<p>本文内容：<br />
介绍<br />
被关键字(keyword)屏蔽(masked)的包<br />
被不明的关键字屏蔽<br />
被严格屏蔽(Hard masked)的包<br />
手动进行严格屏蔽<br />
编辑/etc/portage/package.keywords文件的简便方法<br />
开放一大群有联系的包</p>
<p><font size="+1"><strong>介绍</strong></font><br />
首先，被关键字(keyword)屏蔽(masked)的包都是测试中的或者不稳定的包：<br />
注意： &quot;(masked by: ~keyword)&quot;<br />
Masked By ~keyword Package Example</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 146px;" class="alt2">
<div style="text-align: left;" dir="ltr"># emerge gnome-extra/gdesklets-core

  '''Calculating dependencies'''     !!! all ebuilds that could satisfy &quot;gnome-extra/gdesklets-core&quot; have been masked.  !!! possible candidates are:  - gnome-extra/gdesklets-core-0.26 (masked by: ~keyword)  - gnome-extra/gdesklets-core-0.26.1 (masked by: ~keyword)  !!! Error calculating dependencies. Please correct.</div>
</pre>
</div>
<p>其次，被严格屏蔽(Hard masked)的包:<br />
注意: &quot;(masked by: package.mask)&quot;<br />
Hard Masked Package Example</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 178px;" class="alt2">
<div style="text-align: left;" dir="ltr"># emerge -pv filewatcher

These are the packages that I would merge, in order:

Calculating dependencies   !!! All ebuilds that could satisfy &quot;filewatcher&quot; have been masked.!!! One of the following masked packages is required to complete your request:- app-admin/filewatcher-2.4.0 (masked by: package.mask)# Elfyn McBratney &lt;beu@gentoo.org&gt; (28 Apr 2005)# Masked for testing.</div>
</pre>
</div>
<p><font size="+1"><strong>如果你仍然想安装这些包，那该怎么办呢&#8230;&#8230; </strong></font></p>
<p><font size="+1"><strong>被关键字(keyword)屏蔽(masked)的包</strong></font></p>
<p>现在的新方法是：</p>
<p>echo &quot;gnome-extra/gdesklets-core&quot; &gt;&gt; /etc/portage/package.keywords<br />
或者</p>
<p>echo &quot;=gnome-extra/gdesklets-core-2.10.9&quot; &gt;&gt; /etc/portage/package.keywords</p>
<p>如果你想开放一个特定的版本。</p>
<p>注意：你不需要在package.keywords里面指明电脑架构，除非你想使用其他架构中的软件，当然这是不推荐的。</p>
<p>如果emerge指示某个软件包被 &quot;~* keyword&quot;屏蔽， 你需要逐字的把他写下来，例如:</p>
<p>echo &quot;~gnome-extra/gdesklets-core-2.10.9 ~*&quot; &gt;&gt; /etc/portage/package.keywords</p>
<p>如果你在用crossdev为多种架构建立软件包，例如：</p>
<p>echo &quot;~gnome-extra/gdesklets-core-2.10.9 ~*&quot; &gt;&gt; /etc/portage/package.keywords/cross-i686-pc-linux-gnu</p>
<p><em>OSB: 在cross-i686-pc-linux-gnu中i686-pc-linux-gnu的名字要根据各架构做相应改变。</em></p>
<p>到此，在做了以上任一步骤后，需使用一下命令编译这个包：</p>
<p>emerge =gnome-extra/gdesklets-core-2.10.9</p>
<p>关于package.keywords这个文件的更多信息请点击这里http://zh.gentoo-wiki.com/Package.ke&#8230;8A%80%E5%B7%A7.</p>
<p>如果你在命令行模式下，app-portage/flagedit是自动向packages.keywords里面添加项目的工具。</p>
<p>使用实例：</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 34px;" class="alt2">
<div style="text-align: left;" dir="ltr">flagedit gnome-extra/gdesklets-core -- +~x86</div>
</pre>
</div>
<p>Kuroo是一个有用的KDE程序，可以让你浏览portage树并且对任何包进行指定安装。</p>
<p>它使你能安装具有任何依赖性的包，但是，这个程序目前由于不稳定而被屏蔽，比如 ~x86, 所以你不能安逸的在实际安装中使用它（即使它只是portage的前端）。</p>
<p>即使你不想把kuroo用于实际安装，但在开放依赖包时你还是需要它。</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 34px;" class="alt2">
<div style="text-align: left;" dir="ltr">emerge -pv kuroo</div>
</pre>
</div>
<p>它编辑标准的portage文件。</p>
<p><font size="+1"><strong>旧方法 (不提倡)</strong></font></p>
<p>ACCEPT_KEYWORDS=&quot;~x86&quot; emerge gnome-extra/gdesklets-core</p>
<p>这种方法已经不被提倡了，它出现在这里仅仅是因为历史原因，不要用这个方法。 <br />
请阅读<a target="_blank" href="http://forums.gentoo.org/viewtopic.php?p=1060314#1060314">http://forums.gentoo.org/viewtopic.p&#8230;060314#1060314</a> 这是关于为什么ACCEPT_KEYWORDS不好的帖子。</p>
<p>简而言之，是因为emerge -u world会对用ACCEPT_KEYWORDS安装的包降级，这会造成潜在的致命改变并且使你的系统陷入瘫痪。<br />
-U（功能：仅仅升级）这个参数也不被提倡了，这有一个充分的原因：如果包坏了，portage应该使它降级，-U确会对此操作造成阻碍。</p>
<p><font size="+1"><strong>被不明的关键字屏蔽</strong></font></p>
<p>在你试图安装一个没有在你的架构上测试过的软件时，这个问题很常见。 <br />
向package.keywords文件中，在你要安装的那个包后面加&quot;~*&quot;以开放这个包。 例如：</p>
<p>echo &quot;net-ftp/vsftpd -* ~*&quot; &gt;&gt; /etc/portage/package.keywords</p>
<p>如果你有被9999屏蔽的CVS包，你可以做如下操作：</p>
<p>echo &quot;media-gfx/retina **&quot; &gt;&gt; /etc/portage/package.keywords</p>
<p>牢记，如果你在一个没有测试个架构里安装软件，这个软件也许没法运行。</p>
<p><font size="+1"><strong>被严格屏蔽(Hard masked)的包</strong></font></p>
<p>开放被严格屏蔽(Hard masked)的包，需要把它们加到/etc/portage/package.unmask文件中。<br />
所用命令和package.keywords稍有不同：</p>
<p>echo &quot;=app-admin/filewatcher-2.4.0&quot; &gt;&gt; /etc/portage/package.unmask</p>
<p>这将开放2.4.0版的app-admin/filewatcher。 如果你想开放这个包的所有版本，仅仅写它的名字就行了：</p>
<p>echo &quot;app-admin/filewatcher&quot; &gt;&gt; /etc/portage/package.unmask</p>
<p>当然也可以像 http://gentoo-wiki.com/TIP_package.keywords 里面那么操作。</p>
<p>注意：由于这些包的不稳定性，被严格屏蔽的包一般也被同样关键字被屏蔽。 你多半须要向package.unmask和package.keywords中都加人这个包。</p>
<p><font size="+1"><strong>手动进行严格屏蔽</strong></font></p>
<p>很少的情况下，你需要避免这些包的安装。 <br />
这也许是个例子，如，某软件ebuild脚本里的一个bug造成那个包在你的系统上编译失败，这会使得像emerge &#8211;update &#8211;deep world这类命令无法顺利执行。</p>
<p>你可以跳过那个包的ebuild，这是通过把它的名字加到/etc/portage/package.mask来实现的：</p>
<p>echo &quot;=sys-apps/file-4.17-r1&quot; &gt;&gt; /etc/portage/package.mask</p>
<p>所用命令和上述package.unmask的一样。</p>
<p><font size="+1"><strong>编辑/etc/portage/package.keywords文件的简便方法</strong></font><br />
<font size="+1"><strong>flagedit</strong></font><br />
# 安装: emerge flagedit<br />
# 使用: flagedit &lt;atom&gt; &#8212; +&lt;keyword&gt;，例如 flagedit dev-util/libconf &#8212; +~x86<br />
<font size="+1"><strong>gimme</strong></font><br />
这个脚本使编译那些被关键字~arch屏蔽的包变得简单</p>
<p>/usr/bin/gimme </p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 498px;" class="alt2">
<div style="text-align: left;" dir="ltr">#!/bin/bash

############### gimme version 0.5.4 ################# Script to add package names to package.keywords. ## Originally by Tekmanx, re-written by Hackeron    ## re-re-written by Gherald and edited by D. Watzke #####################################################

source /sbin/functions.sh

 [[$EUID != 0]]  &amp;&amp; { eerror &quot;You are not root!&quot; exit 1}

 [[-z &quot;$1&quot;]]  &amp;&amp; { eerror &quot;Please specify a package name (eg. gimme &lt;package-name&gt;)&quot; exit 1}

 [[-d /etc/portage]]  || mkdir -p /etc/portage

# Get fully-qualified ebuild nameFQN=$(ACCEPT_KEYWORDS=&quot;~x86&quot; emerge -p $1 | grep &quot;$1&quot; | grep 'ebuild ' | tail -n2 | \head -n1 | sed -e 's/\[ebuild.......\]\ //' -e 's/\[[[:digit:]].*\]//' -e 's/-[[:digit:]].*$//')

# We think there is either none or more than one package matching $1# so we let the user deal with it [[-z &quot;$FQN&quot;]]  &amp;&amp; emerge $@ -a; exit

if grep -q &quot;^ *[\&gt;\&lt;=]*$FQN *&quot; /etc/portage/package.keywords; then ewarn &quot;/etc/portage/package.keywords already contains \&quot;$EXISTING\&quot;&quot; emerge $@ -a; exitelse einfo &quot;Adding $FQN to package.keywords and emerging in 5 seconds.&quot;; sleep 5 echo $FQN &gt;&gt; /etc/portage/package.keywords emerge $@ -afi</div>
</pre>
</div>
<p>把这个文件命名为&quot;gimme&quot;并保存到/usr/bin/然后执行：</p>
<p>chmod 755 /usr/bin/gimme</p>
<p>现在你就可以使用这个脚本了，例如：</p>
<p>gimme gdesklets-core</p>
<p><font size="+1"><strong>/etc/portage/package.unmask的脚本</strong></font></p>
<p>这个脚本使开放那些被严格屏蔽的包变得简单。<br />
/usr/local/bin/unmask</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 498px;" class="alt2">
<div style="text-align: left;" dir="ltr">#!/bin/bash## This script will unmask any package masked by the actual profile.## First we search for what is actually masked # in /usr/portage/profiles/package.mask then add a corresponding # line in /etc/portage/package.unmask### Original by drax@sweon.net

source /sbin/functions.sh

[ &quot;$UID&quot; -ne &quot;0&quot; ] &amp;&amp; eerror &quot;You must be root to run this script.&quot; &amp;&amp; exit[ -z &quot;$1&quot; ] &amp;&amp; eerror &quot;Please state a package name (eg. unmask kde-base/kode)&quot; &amp;&amp; exit[ ! -d /etc/portage ] &amp;&amp; einfo &quot;Creating /etc/portage directory&quot; &amp;&amp; mkdir /etc/portage

if [ &quot;$(grep &quot;$1&quot;-[0-9] /etc/portage/package.unmask 2&gt;/dev/null)&quot; ]; then    ewarn &quot;$1 already exists in package.unmask&quot;else    PKG_LINE=&quot;$(grep &quot;$1&quot;-[0-9] /usr/portage/profiles/package.mask 2&gt;/dev/null)&quot;    if [ ! $PKG_LINE ]; then PKG_LINE=&quot;$(grep &quot;$1&quot; /usr/portage/profiles/package.mask 2&gt;/dev/null)&quot;    fi    if [ ! $PKG_LINE ]; then      ewarn &quot;Could not find $1 in /usr/portage/profiles/package.mask&quot; &amp;&amp; exit 1    else      ebegin &quot;Adding $1 to package.unmask&quot;      echo $PKG_LINE &gt;&gt; /etc/portage/package.unmask      eend $?    fifi</div>
</pre>
</div>
<p>
同样，把这个文件命名为&quot;unmask&quot;并保存到/usr/local/bin然后执行：</p>
<p>chmod 755 /usr/local/bin/unmask</p>
<p>现在你就可以使用这个脚本了，例如：</p>
<p>unmask kde-base/kode # this version of unmask requires the full package name, including app-category/</p>
<p>也可以配合gimme一起使用，例如：</p>
<p>unmask kde-base/kode &amp;&amp; gimme kode</p>
<p>潇洒去吧 <img border="0" class="inlineimg" title="心情好" src="http://www.linuxsir.org/bbs/images/smilies/Jump2.gif" /></p>
<p><font size="+1"><strong>开放一大群有联系的包</strong></font><br />
从Portage 2.1起，很多/etc/portage/package.*的文件能够被目录代替。这些目录里的文件可以自动被Portage连结在一起。</p>
<p>这个对于X模块(xorg)来说特别有用，几乎300个的和这个模块有联系的包都需要被开放。因而，你可以复制 http://www.gentoo.org/proj/en/deskto&#8230;x-packages.txt<br />
到/etc/portage/package.keywords/xorg (也许同样需要复制到 /etc/portage/package.unmask/xorg)。如果不这样的话/etc/portage/package.keywords里会 有一大窜东西，而使得这个文件不好管理。</p>
<p><font size="+1"><strong>脚本：开放所有被依赖的包</strong></font></p>
<p>/bin/gimme-everything</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 338px;" class="alt2">
<div style="text-align: left;" dir="ltr">#!/bin/bash## This script will unmask any package masked by specified keyword## It is using flagedit to remove keyword# Usage:  /bin/gimme-everything &quot;=gnome-2.14.2&quot; &quot;+~amd64&quot;# Sorry that this is in one command line, but it was composed in one ;)## author: mmazurek[at]wallix.com

while true; do   if emerge &quot;$1&quot; | grep '!!! All ebuilds'; then      emerge &quot;$1&quot; | grep '!!! All ebuilds' | while read line; do         n=$(echo $line | sed -e &quot;s/.*\&quot;\(.*\)\&quot;.*/\\1/&quot;);         flagedit &quot;$n&quot; -- &quot;$2&quot;;      done;   else      break;   fi;done</div>
</pre>
</div>
<p><font size="+1"><strong>脚本：开放所有被依赖的包 2</strong></font><br />
这个脚本不需要flagedit.<br />
/sbin/unmask</p>
<div style="margin: 5px 20px 20px 0px;">
<div style="margin-bottom: 2px;" class="smallfont">代码:</div>
<pre style="border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 640px; height: 498px;" class="alt2">
<div style="text-align: left;" dir="ltr">#!/usr/bin/perl -wuse strict;

sub emerge{        my $package = shift;        $_ = `emerge -pv &quot;${package}&quot; 2&gt;&amp;1`;

        if(m/^- (\S+) \(masked by:.*package.mask/mi) {                print &quot;Unmasking ${1} in package.unmask\n&quot;;                print UNMASK &quot;=${1}\n&quot;;                return 1;        }        if(m/^- (\S+) \(masked by:.*keyword/mi) {                print &quot;Unmasking ${1} in package.keywords\n&quot;;                print KEYWORDS &quot;=${1}\n&quot;;                return 1;        }        if(m/^!!! masked or don't exist:\n(\S+)/mi) {                while(emerge($1) != 0){}                return 1;        }        return 0;}

open(UNMASK, &quot;&gt;&gt;/etc/portage/package.unmask&quot;);open(KEYWORDS, &quot;&gt;&gt;/etc/portage/package.keywords&quot;);our $package = $ARGV[0];$package =~ s/&quot;/\\&quot;/g;while(emerge($package) != 0){}print &quot;Done\n&quot;;close(UNMASK);close(KEYWORDS);</div>
</pre>
</div>
<p>使用：</p>
<p>unmask &quot;&gt;media-video/mplayer-1.0_rc1&quot;</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F27%2F9904%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">gentoo的相关配置-make.conf</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F02%2F10570%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ebuild and emerge</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F09%2F10732%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo上安装Texlive2009</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F07%2F10707%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gentoo 沙盘简介</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F08%2F27%2F9982%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9963%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zz Linux下的段错误的原因及调试</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/04/09/10732/' rel='bookmark' title='Gentoo上安装Texlive2009'>Gentoo上安装Texlive2009</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2008/03/28/9963/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

