接上文《autoconf-archive源码安装》, 链接如下:
autoconf-archive源码安装_蓝天居士的博客-CSDN博客
上篇文章在构建autoconf-archive的时候,第一步引导构建就出现了错误,如下所示:
$ ./bootstrap.sh
./bootstrap.sh:行18: gnulib-tool:未找到命令
根据提示,需要gnulib-tool,这个工具也可以说命令在gnulib包中。本文就对于gnulib包进行源码构建,构建并在系统中安装之后,再继续执行autoconf-archive中的步骤。
0. 源码地址
gnulib源码下载地址经由https://savannah.gnu.org搜索"gnulib"到gnulib - GNU portability library - Summary [Savannah]
在其中点击上图中箭头位置,转到Gnulib - GNU Portability Library - GNU Project - Free Software Foundation
这就是gnulib的github网址,暨上游地址。
1. 源码下载
运行以下命令下载源码:
$ git clone https://git.savannah.gnu.org/git/gnulib.git
正克隆到 'gnulib'...
remote: Counting objects: 261470, done.
remote: Compressing objects: 100% (31052/31052), done.
接收对象中: 68% (179166/261470), 43.39 MiB | 42.00 KiB/s
remote: Total 261470 (delta 230370), reused 261429 (delta 230340)
接收对象中: 100% (261470/261470), 62.18 MiB | 53.00 KiB/s, 完成.
处理 delta 中: 100% (230370/230370), 完成.
下载完成后,源码内容如下所示(由于文件过多,在此不列出tree结果):
$ ls gnulib/
all-modules cfg.mk check-AC_LIBOBJ check-module COPYING doc examples gnulib-tool.py lib Makefile MODULES.html.sh posix-modules README tests users.txt
build-aux ChangeLog check-copyright config DEPENDENCIES etc gnulib-tool gnulib-tool.py.TODO m4 modules NEWS pygnulib STATUS-libposix top
2. 查看帮助
源码下载后,进入源码根目录,并使用./gnulib-tools --help命令查看帮助。如下所示:
$ cd gnulib
$ ./gnulib-tool --help
Usage: gnulib-tool --list
gnulib-tool --find filename
gnulib-tool --import [module1 ... moduleN]
gnulib-tool --add-import [module1 ... moduleN]
gnulib-tool --remove-import [module1 ... moduleN]
gnulib-tool --update
gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
gnulib-tool --test --dir=directory [module1 ... moduleN]
gnulib-tool --megatest --dir=directory [module1 ... moduleN]
gnulib-tool --extract-description module
gnulib-tool --extract-comment module
gnulib-tool --extract-status module
gnulib-tool --extract-notice module
gnulib-tool --extract-applicability module
gnulib-tool --extract-filelist module
gnulib-tool --extract-dependencies module
gnulib-tool --extract-recursive-dependencies module
gnulib-tool --extract-autoconf-snippet module
gnulib-tool --extract-automake-snippet module
gnulib-tool --extract-include-directive module
gnulib-tool --extract-link-directive module
gnulib-tool --extract-recursive-link-directive module
gnulib-tool --extract-license module
gnulib-tool --extract-maintainer module
gnulib-tool --extract-tests-module module
gnulib-tool --copy-file file [destination]
Operation modes:
--list print the available module names
--find find the modules which contain the specified file
--import import the given modules into the current package
--add-import augment the list of imports from gnulib into the
current package, by adding the given modules;
if no modules are specified, update the current
package from the current gnulib
--remove-import reduce the list of imports from gnulib into the
current package, by removing the given modules
--update update the current package, restore files omitted
from version control
--create-testdir create a scratch package with the given modules
--create-megatestdir create a mega scratch package with the given modules
one by one and all together
--test test the combination of the given modules
(recommended to use CC="gcc -Wall" here)
--megatest test the given modules one by one and all together
(recommended to use CC="gcc -Wall" here)
--extract-description extract the description
--extract-comment extract the comment
--extract-status extract the status (obsolete etc.)
--extract-notice extract the notice or banner
--extract-applicability extract the applicability
--extract-filelist extract the list of files
--extract-dependencies extract the dependencies
--extract-recursive-dependencies extract the dependencies of the module
and its dependencies, recursively, all
together, but without the conditions
--extract-autoconf-snippet extract the snippet for configure.ac
--extract-automake-snippet extract the snippet for library makefile
--extract-include-directive extract the #include directive
--extract-link-directive extract the linker directive
--extract-recursive-link-directive extract the linker directive of the
module and its dependencies,
recursively, all together
--extract-license report the license terms of the source files
under lib/
--extract-maintainer report the maintainer(s) inside gnulib
--extract-tests-module report the unit test module, if it exists
--copy-file copy a file that is not part of any module
--help Show this help text.
--version Show version and authorship information.
General options:
--dir=DIRECTORY Specify the target directory.
For --import, this specifies where your
configure.ac can be found. Defaults to current
directory.
--local-dir=DIRECTORY Specify a local override directory where to look
up files before looking in gnulib's directory.
--cache-modules Enable module caching optimization.
--no-cache-modules Disable module caching optimization.
--verbose Increase verbosity. May be repeated.
--quiet Decrease verbosity. May be repeated.
Options for --import, --add/remove-import, --update:
--dry-run Only print what would have been done.
Options for --import, --add/remove-import:
--with-tests Include unit tests for the included modules.
Options for --create-[mega]testdir, --[mega]test:
--without-tests Don't include unit tests for the included modules.
Options for --import, --add/remove-import,
--create-[mega]testdir, --[mega]test:
--with-obsolete Include obsolete modules when they occur among the
dependencies. By default, dependencies to obsolete
modules are ignored.
--with-c++-tests Include even unit tests for C++ interoperability.
--without-c++-tests Exclude unit tests for C++ interoperability.
--with-longrunning-tests
Include even unit tests that are long-runners.
--without-longrunning-tests
Exclude unit tests that are long-runners.
--with-privileged-tests
Include even unit tests that require root
privileges.
--without-privileged-tests
Exclude unit tests that require root privileges.
--with-unportable-tests
Include even unit tests that fail on some platforms.
--without-unportable-tests
Exclude unit tests that fail on some platforms.
--with-all-tests Include all kinds of problematic unit tests.
--avoid=MODULE Avoid including the given MODULE. Useful if you
have code that provides equivalent functionality.
This option can be repeated.
--conditional-dependencies
Support conditional dependencies (may save configure
time and object code).
--no-conditional-dependencies
Don't use conditional dependencies.
--libtool Use libtool rules.
--no-libtool Don't use libtool rules.
Options for --import, --add/remove-import:
--lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
--source-base=DIRECTORY
Directory relative to --dir where source code is
placed (default "lib").
--m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
placed (default "m4").
--po-base=DIRECTORY Directory relative to --dir where *.po files are
placed (default "po").
--doc-base=DIRECTORY Directory relative to --dir where doc files are
placed (default "doc").
--tests-base=DIRECTORY
Directory relative to --dir where unit tests are
placed (default "tests").
--aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
tools are placed (default comes from configure.ac).
--gnu-make Output for GNU Make instead of for the default
Automake
--lgpl[=2|=3orGPLv2|=3]
Abort if modules aren't available under the LGPL.
Also modify license template from GPL to LGPL.
The version number of the LGPL can be specified;
the default is currently LGPLv3.
--makefile-name=NAME Name of makefile in the source-base and tests-base
directories (default "Makefile.am", or
"Makefile.in" if --gnu-make).
--tests-makefile-name=NAME
Name of makefile in the tests-base directory
(default as specified through --makefile-name).
--automake-subdir Specify that the makefile in the source-base
directory be generated in such a way that it can
be 'include'd from the toplevel Makefile.am.
--automake-subdir-tests
Likewise, but for the tests directory.
--macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
'gl_INIT'. Default is 'gl'.
--po-domain=NAME Specify the prefix of the i18n domain. Usually use
the package name. A suffix '-gnulib' is appended.
--witness-c-macro=NAME Specify the C macro that is defined when the
sources in this directory are compiled or used.
--vc-files Update version control related files.
--no-vc-files Don't update version control related files
(.gitignore and/or .cvsignore).
Options for --create-[mega]testdir, --[mega]test:
--single-configure Generate a single configure file, not a separate
configure file for the tests directory.
Options for --import, --add/remove-import, --update,
--create-[mega]testdir, --[mega]test:
-s, --symbolic, --symlink Make symbolic links instead of copying files.
--local-symlink Make symbolic links instead of copying files, only
for files from the local override directory.
-h, --hardlink Make hard links instead of copying files.
--local-hardlink Make hard links instead of copying files, only
for files from the local override directory.
Options for --import, --add/remove-import, --update:
-S, --more-symlinks Deprecated; equivalent to --symlink.
-H, --more-hardlinks Deprecated; equivalent to --hardlink.
Report bugs to <bug-gnulib@gnu.org>.
3. 创建链接
$ sudo ln -s /home/penghao/TPM/dependencies/gnulib/gnulib/gnulib-tool /usr/bin/gnulib-tool
$ ls -l /usr/bin/gnulib-tool
lrwxrwxrwx 1 root root 56 12月 9日 23:28 /usr/bin/gnulib-tool -> /home/penghao/TPM/dependencies/gnulib/gnulib/gnulib-tool
此时,autoconf-archive之前./bootstrap时的错误就可以解决了。后边的步骤回到本文开头的链接中,感兴趣的读者可以看看。
在此,额外补充一些关于gnulib的知识,以下内容引用自:
glibc、glib和gnulib区别--转帖_honghuzhilangzixin的博客-CSDN博客
------------------------------------------------------------------------------------------------------------------------
glibc、glib和gnulib区别
All three are used for completely different tasks.
这个应该理解成:三者各自适合不同的开发场景;类比什么时候项目用C开发,什么项目又可以基于JVM用JAVA开发。
1. glibc
[ http://www.gnu.org/s/libc/ ]
任何类unix系统都需要一个C库,功能上包括系统调用与基本C函数。可以理解成实现C函数库一个最基本的库,也就是CRT(C Runtime C运行时库)。不同的平台上都各自有自己的C运行库,windows的包含在VC里;
重点:C语言基本库
2. gnulib
[ http://www.gnu.org/software/gnulib/ ]
GUN组织有一个美好的愿景:只要是遵守GNU POSIX标准开发的软件,就可以运行在任何GNU POSIX标准操作系统上。当你需要开发POSIX标准的软件时,你自然先需要这么一个标准库,这就是GNULIB;现实中,各操作系统所提供的开发API甚至C标准函数都不是完全一样的。
重点:POSIX标准
3. glib
[ http://www.gtk.org/ ]
A. 理解GLib的关键在于了解它的历史,简单说来,GLib来自于GTK,GTK源自于GIMP.GIMP是GNU Image Manipulation Program(GNU图像处理程序)的缩写;
B. Glib是什么,有什么?Glib的开发并不与glibc冲突,Glib延伸了C的功能,添加了许多数据结构,添加了一些开发图形系统需要的一些消息处理机制……它是GIMP组织在实际开发中不断地提炼出来的产物。
重点:GTK开发
--------------------------------------------------------------------------------------------------------------------------