📄 0520source_code_and_tarball.htm
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
<meta name="Author" content="VBird, 鸟哥" >
<meta name="Description" content="谈一下,在 Linux 里面的套件管理,用最原始的原始码与 tarball 来管理的。" >
<title>鸟哥的 Linux 私房菜 -- 原始码与 Tarball 套件管理员</title>
<style type="text/css">
body {
background-color: #D3D3D3;
color: #000000;
background-attachment:fixed ;
}
body,th,td,input,select,textarea,select,checkbox {
font-family: '新细明体', 'Times New Roman', serif;
font-size: 11pt ;
}
a:link {text-decoration: none; color: blue}
a:visited {text-decoration: none; color: blue}
a:active {text-decoration: none; color: blue}
a:hover {text-decoration: underline; color: #ff0000}
table.head1 {width:100%; background-color: #FFCCCC;
border-style:groove;border-width:5px;border-color: #FFCCCC; margin:0;
padding: 5px 5px}
td.head1 {font: 10pt "新细明体", serif; color: #000099; }
td.info1 {font: 11pt "新细明体", serif; color: #000066; text-align:center; width:14%}
td.info2 {font: 11pt "新细明体", serif; color: #000066; text-align:center; width:12%}
*.info21 {font: 11pt "新细明体", serif; color: #000066; }
*.info22 {font: 11pt "新细明体", serif; color: blue ; }
*.info23 {font: 11pt "新细明体", serif; color: green ; }
td.info3 {font: 11pt "新细明体", serif; color: #000066; text-align:justify}
*.text_head0 {font-size:18pt; font-family:'标楷体','Times New Roman','Times', serif; }
*.text_head_en {font-size:18pt; font-family:'Times New Roman','Times', serif; }
*.text_h1 {font: 15pt "新细明体", serif; color: #0000BB; font-weight: bold }
*.text_h2 {font: 13pt "新细明体", serif; color: #0000BB; font-weight: bold }
*.text_import1 {font: 11pt "新细明体", serif; color: #000088; font-weight: bold }
*.text_import2 {font: 11pt "新细明体", serif; color: #000088; font-weight: normal}
*.text_vbird {font: 11pt "新细明体", serif; color: #000088; font-weight: normal;
font-style: italic;}
*.text_history {font: 10pt "新细明体", serif; color: #000066; }
*.text_date {font: 10pt "新细明体", serif; color: #3333FF; }
*.block1 {padding: 10px 20px 10px 25px; text-align:left }
*.block2 {padding: 10px 0px 10px 25px; text-align:left }
table.term2 {width: 350px; background-color: #000000;
border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
table.term {width: 580px; background-color: #000000;
border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
td.term {font: 10pt "细明体", Fixedsys, serif; color: #FFFFFF; }
*.term_hd {font: 10pt "细明体", Fixedsys, serif; color: #BBBBBB; }
*.term_note {font: 10pt "细明体", Fixedsys, serif; color: #777777; font-weight: normal }
*.term_note_b {font: 10pt "细明体", Fixedsys, serif; color: #FF77FF; font-weight: bolder }
*.term_command {font: 10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: bolder }
*.term_write {font: 10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: normal }
*.term_say {font: 10pt "细明体", Fixedsys, serif; color: #FF6666; font-weight: normal }
</style>
</head>
<body style="margin:0; padding:0">
<center>
<!-- 这里是关于页首按钮处的按钮程式 -->
<div style="text-align:center">
<span style="font-weight:bolder; color:#3333FF"><span class="text_head0">鸟哥的<span class="text_head_en">
Linux </span>私房菜</span></span><br />
<span style="color:#000080">为取得较佳浏览结果,请爱用 <a href="http://moztw.org" target="_blank">firefox</a>
浏览本网页</span><br />
<a href="http://linux.vbird.org/" target="_blank"
onmouseover="document.head_icon1.src='../images/icon_VBird_on.jpg'"
onfocus="document.head_icon1.src='../images/icon_VBird_on.jpg'"
onmouseout="document.head_icon1.src='../images/icon_VBird_off.jpg'">
<img alt="前往鸟哥的 Linux 私房菜馆首页" title="前往鸟哥的 Linux 私房菜馆首页" name="head_icon1"
src="../images/icon_VBird_off.jpg" border="0" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_basic"
onmouseover="document.head_icon2.src='../images/icon_basic_on.jpg'"
onfocus="document.head_icon2.src='../images/icon_basic_on.jpg'"
onmouseout="document.head_icon2.src='../images/icon_basic_off.jpg'">
<img src="../images/icon_basic_off.jpg" border="0"
alt="前往 Linux 基础文件,新手请从头学起"
title="前往 Linux 基础文件,新手请从头学起" name="head_icon2" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_server"
onmouseover="document.head_icon3.src='../images/icon_server_on.jpg'"
onfocus="document.head_icon3.src='../images/icon_server_on.jpg'"
onmouseout="document.head_icon3.src='../images/icon_server_off.jpg'">
<img src="../images/icon_server_off.jpg" border="0"
alt="前往 Linux 架站文件,网路基础那章节请务必参考!"
title="前往 Linux 架站文件,网路基础那章节请务必参考!" name="head_icon3" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_security"
onmouseover="document.head_icon4.src='../images/icon_security_on.jpg'"
onfocus="document.head_icon4.src='../images/icon_security_on.jpg'"
onmouseout="document.head_icon4.src='../images/icon_security_off.jpg'">
<img src="../images/icon_security_off.jpg" border="0"
alt="前往『网路安全』相关文件网页" title="前往『网路安全』相关文件网页" name="head_icon4" /></a>
<a href="http://phorum.vbird.org" target="_blank"
onmouseover="document.head_icon5.src='../images/icon_forum_on.jpg'"
onfocus="document.head_icon5.src='../images/icon_forum_on.jpg'"
onmouseout="document.head_icon5.src='../images/icon_forum_off.jpg'">
<img src="../images/icon_forum_off.jpg" border="0"
alt="前往 Linux 新手讨论区,发问前务必查阅发文规则"
title="前往 Linux 新手讨论区,发问前务必查阅发文规则" name="head_icon5" /></a>
<a target="_blank" href="http://linux.vbird.org/adsl"
onmouseover="document.head_icon6.src='../images/icon_adsl_on.jpg'"
onfocus="document.head_icon6.src='../images/icon_adsl_on.jpg'"
onmouseout="document.head_icon6.src='../images/icon_adsl_off.jpg'">
<img src="../images/icon_adsl_off.jpg" border="0"
alt="前往『ADSL连线分享』相关文件网页" title="前往『ADSL连线分享』相关文件网页" name="head_icon6" /></a>
<a href="http://www.study-area.org" target="_blank"
onmouseover="document.head_icon7.src='../images/icon_study-area.jpg'"
onfocus="document.head_icon7.src='../images/icon_study-area.jpg'"
onmouseout="document.head_icon7.src='../images/icon_study-area.jpg'">
<img src="../images/icon_study-area.jpg" border="0"
alt="前往 Study Area 网站" title="前往 Study Area 网站" name="head_icon7" /></a>
<br />
</div>
<table summary="本文内容的排版" style="width:750px;
background-image:url('../images/VBirdLinux.jpg');
background-attachment:fixed;" border="0" cellspacing="0" cellpadding="0">
<tr><td style="width:16px; height:16px; background-image:url('../images/border-top-left.jpg');
font-size:6px"> </td>
<td style="width:718px; height:16px; font-size:6px;
background-image:url('../images/border-top-center.jpg')"> </td>
<td style="width:16px; height:16px; background-image:url('../images/border-top-right.jpg');
font-size:6px"> </td></tr>
<tr><td style="width:16px; font-size:6px;
background-image:url('../images/border-middle-left.jpg')"> </td>
<td width="718">
<!-- 本文的档头部分 -->
<div style="text-align:center">
<a href="0520source_code_and_tarball.php">
<span class="text_head0">原始码与<span class="text_head_en"> Tarball </span>套件管理员</span></a><br />
</div>
<div style="text-align:left">
<a href="0520source_code_and_tarball.php?thisscreen=800x600"><!--切换解析度为 800x600--></a>
</div>
<div style="text-align:right">
<span class="text_history">最近更新日期∶2005/10/01</span>
</div>
<!-- 本文的档头部分 -->
<table class="head1" summary="排版∶文章档头的说明"><tr><td class="head1">
我们在 <a href="0110whatislinux.php">Linux 是什么</a> 一文当中,提到了 GNU 与
GPL 还有开放源码等咚咚,不过,前面都还没有提到真正的开放源码是什么的讯息!在这一章当中,我们将藉由
Linux 作业系统里面的执行档,来理解什么是可执行的程式,以及了解什么是编译器。
另外,与程式息息相关的函式库 (library) 的资讯也需要了解一番!不过,
在这个章节当中,鸟哥并不是要您成为一个开放源码的程式设计师,
而是希望您可以了解如何将开放源码的程式设计、加入函式库的原理、透过编译而成为可以执行
的 binary file ,最后该执行档可被我们所使用的一连串过程!<br><br>
了解上面的咚咚有什么好处呢?!因为在 Linux 的世界里面,我们常常需要自行安装套件在自己的
Linux 系统上面,所以如果您有简单的程式编译概念,那么将很容易进行套件的安装,
甚至在发生套件编译过程中的错误时,您也可以自行作一些简易的修订呢!而最传统的套件安装过程,
自然就是由原始码编译而来的棉!所以,在这里我们将介绍最原始的套件管理方式∶使用
Tarball 来安装与升级管理我们的套件喔!
</td></tr></table><br>
<!-- 本文的连结区部分 -->
<div class=block1>
<span class="text_h1">
1. <a href="#intro">前言</a>∶<br>
<span class=text_h2>
1.1 <a href="#intro_whatisopensource">什么是开放源码、编译器与可执行档</a>?<br>
1.2 <a href="#intro_library">什么是函式库</a>?<br>
1.3 <a href="#intro_make">什么是 make 与 configure</a> ?<br />
1.4 <a href="#intro_tarball">什么是 Tarball 的套件</a>?<br />
1.5 <a href="#intro_howto">如何安装与升级套件</a>?<br />
</span>
2. <a href="#simple_ex">一个简单的范例</a>∶<br/>
<span class=text_h2>
2.1 <a href="#simple_ex_hello">印出 Hello World</a><br />
2.2 <a href="#simple_ex_function">副程式的编译</a><br />
2.3 <a href="#simple_ex_lib">加入连结的函式库</a><br />
2.4 <a href="#simple_ex_gcc">gcc 的用法</a><br />
</span>
3. <a href="#make">make 的简易用法</a>∶<br />
<span class=text_h2>
3.1 <a href="#make_why">为什么要用 make</a> ?<br />
3.2 <a href="#make_makefile">make 的基本语法与变数</a><br />
</span>
4. <a href="#tarball">Tarball 的管理与建议</a>∶<br />
<span class=text_h2>
4.1 <a href="#tarball_pack">使用原始码管理套件所需要的基础套件</a><br />
4.2 <a href="#tarball_step">Tarball 安装的基本步骤</a><br>
4.3 <a href="#tarball_common">一般 Tarball 套件安装的建议事项( 如何移除?升级? )</a><br />
4.4 <a href="#tarball_exntp">一个简单的范例、利用 ntp 来示范</a><br />
4.5 <a href="#tarball_patch">利用 patch 更新原始码</a><br />
</span>
5. <a href="#library">函式库管理</a>∶<br />
<span class=text_h2>
5.1 <a href="#library_dyna_sta">动态与静态函式库</a><br />
5.2 <a href="#library_ldconfig">ldconfig 与 /etc/ld.so.conf</a>, <a href="#library_ldd">ldd</a><br />
</span>
6. <a href="#check">检验套件软体的正确性</a>∶<br />
<span class=text_h2>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -