/ 中存储网

告诉你Ubuntu安装Emacs出现到依赖问题及解决方案的方法及命令

2015-06-05 18:08:08 来源:中存储网

Ubuntu软件中心emacs的版本是23,自己在网上下了最新版24.3,通过编译安装到时候遇到来很多依赖问题,接下来将这些问题整理了出来:

1.执行./configure命令出现如下错误:
 
configure: error: You seem to be running X, but no X development libraries
were found.  You should install the relevant development files for X
and for the toolkit you want, such as Gtk+, Lesstif or Motif.  Also make
sure you have development files for image handling, i.e.
tiff, gif, jpeg, png and xpm.
If you are sure you want Emacs compiled without X window support, pass
--without-x
to configure.
 
根据提示是缺少X windows系统的开发库。一旦不想在图形界面下使用Emacs,可以使用--without-x选项进行编译(废话),那么只有把GTK+安装上才能通过configure了。
 
sudo apt-get install libgtk2.0-dev

2.在configure中增加编译选项,./configure --with-x-toolkit=gtk3,这次配置未提示上述错误,但又出现接下来错误:
 
The following required libraries were not found:
libXpm libjpeg libgif/libungif libtiff
Maybe some development libraries/packages are missing?
If you don't want to link with them give
--with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no
as options to configure
 
提示缺少libXpm libjpeg libgif/libungif libtiff
 
几个图像开发库也要装上
 
sudo apt-get install libxpm-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libgif-dev
sudo apt-get install libtiff4-dev

3.利用apt-get install 将上述缺少的包及其开发包安装后,继续./configure,还有错误:
 
configure: error: The required function `tputs' was not found in any library.
These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package.
 
提示缺少必须的函数'tputs',有可能在libncurses-dev中,那么尝试安装这个包,再configure。

 
4.因为前面编译过,所以运行make clean && make distclean来清理一下
 

5.再通过./configure,终端有如下提示:
 
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lib/Makefile
config.status: creating lib-src/Makefile
config.status: creating oldXMenu/Makefile
config.status: creating doc/emacs/Makefile
config.status: creating doc/misc/Makefile
config.status: creating doc/lispintro/Makefile
config.status: creating doc/lispref/Makefile
config.status: creating src/Makefile
config.status: creating lwlib/Makefile
config.status: creating lisp/Makefile
config.status: creating leim/Makefile
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing mkdirs commands
config.status: executing epaths commands
creating src/epaths.h
[ -r "/home/wkd/src/emacs-24.2/src/config.in" ] || ( cd /home/wkd/src/emacs-24.2 && autoheader )
config.status: executing gdbinit commands

 
6.sudo make,sudo make install 安装成功
整个编译过程,主要是仔细查看configure的输出,看缺乏哪些库,只要把缺乏的库安装上,就能configure成功,这是关键。