系统为Linux debian 2.6.32-5-686。这是裸系统,连xwindows都没有。帐户为root,不是的注意一下权限。这里想说明安装过程及出现的问题,故打印的信息较多,以供出现错误的读者对比。不需要这些信息的读者勿喷。

  网上流行的安装方法:

sh autogen.sh 或 ./configure 

make

make install

注意,sh autogen.sh 或 ./configure 只运行其中一个就可以,功能一样。只是autogen.sh调用autoconf来配置参数,./configure就不多说了。配置libev时,两者打印的信息基本是一样了。如果用./configure,就不用安装autoconf之类的了。

  下面以sh autogen.sh的方法来安装。先安装autoconf,因为autogen.sh需要。

root@debian:/home/xzc/cpp/libev-4.15# cat autogen.sh 
#!/bin/sh

autoreconf --install --symlink --force
root@debian:/home/xzc/cpp/libev-4.15# apt-get install autoconf  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  automake autotools-dev
Suggested packages:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool gettext
The following NEW packages will be installed:
  autoconf automake autotools-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1476 kB of archives.
After this operation, 4387 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.nctu.edu.tw/debian/ squeeze/main autoconf all 2.67-2 [793 kB]
Get:2 http://debian.nctu.edu.tw/debian/ squeeze/main autotools-dev all 20100122.1 [71.9 kB]
Get:3 http://debian.nctu.edu.tw/debian/ squeeze/main automake all 1:1.11.1-1+squeeze1 [611 kB]
Fetched 1476 kB in 2s (493 kB/s)
Selecting previously deselected package autoconf.
(Reading database ... 24937 files and directories currently installed.)
Unpacking autoconf (from .../autoconf_2.67-2_all.deb) ...
Selecting previously deselected package autotools-dev.
Unpacking autotools-dev (from .../autotools-dev_20100122.1_all.deb) ...
Selecting previously deselected package automake.
Unpacking automake (from .../automake_1%3a1.11.1-1+squeeze1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up autoconf (2.67-2) ...
Setting up autotools-dev (20100122.1) ...
Setting up automake (1:1.11.1-1+squeeze1) ...
update-alternatives: using /usr/bin/automake-1.11 to provide /usr/bin/automake (automake) in auto mode

可以看到,系统还一起安装了automake。现在再运行sh autogen.sh

root@debian:/home/xzc/cpp/libev-4.15# sh autogen.sh 
configure.ac:21: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

看来还缺了libtool,那就装一个呗

root@debian:/home/xzc/cpp/libev-4.15# apt-get install libtool
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  binutils cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libc6-dev libgmp3c2 libgomp1 libltdl-dev libltdl7 libmpfr4 linux-libc-dev manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-4.4-locales gcc-multilib make automake1.9 flex bison gdb gcc-doc gcc-4.4-multilib libmudflap0-4.4-dev gcc-4.4-doc
  libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7 glibc-doc libtool-doc gfortran fortran95-compiler gcj
The following NEW packages will be installed:
  binutils cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libc6-dev libgmp3c2 libgomp1 libltdl-dev libltdl7 libmpfr4 libtool linux-libc-dev manpages-dev
0 upgraded, 15 newly installed, 0 to remove and 26 not upgraded.
Need to get 856 kB/19.5 MB of archives.
After this operation, 55.8 MB of additional disk space will be used.

现在再来sh autogen.sh

root@debian:/home/xzc/cpp/libev-4.15# sh autogen.sh 
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
root@debian:/home/xzc/cpp/libev-4.15# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... none
checking dependency style of gcc... none
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking sys/inotify.h usability... yes
checking sys/inotify.h presence... yes
checking for sys/inotify.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking port.h usability... no
checking port.h presence... no
checking for port.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/eventfd.h usability... yes
checking sys/eventfd.h presence... yes
checking for sys/eventfd.h... yes
checking sys/signalfd.h usability... yes
checking sys/signalfd.h presence... yes
checking for sys/signalfd.h... yes
checking for inotify_init... yes
checking for epoll_ctl... yes
checking for kqueue... no
checking for port_create... no
checking for poll... yes
checking for select... yes
checking for eventfd... yes
checking for signalfd... yes
checking for clock_gettime... no
checking for clock_gettime syscall... yes
checking for nanosleep... yes
checking for library containing floor... -lm
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
View Code

相关文章: