最开始用apt-get install emacs,但没有安装成功。于是自己下载了一个emacs-24.3.tar.gz的压缩包,解压后一看,发现里面全是源文件,要自己编译。
于是先阅读了一下里面的README文件,得知编译与安装步骤都在INSTALL文件中有。于是我一下的步骤都是参考的INSTALL文件。
1.打开一个终端,cd到刚才解压的目录,运行./configure命令,运行了一阵子,我正感觉良好呢,它却报错了,如下:
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.
看来编译这个并不是那么容易的,上面这段错误提示的大意是没有装GTK+等图形开发库,如果不想在图形界面下使用Emacs,可以使用--without-x选项进行编译(这不废话吗,能用图形界面却不用,难道要回到原始的字符界面?)
那就装GTK+吧,命令如下(注意是GTK用于开发的开发库):
sudo apt-get install libgtk2.0-dev
装好后,再运行./configure,没想到又报错了,如下:
configure: error: 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
好吧,几个图像开发库也要装,继续:
sudo apt-get install libxpm-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libgif-dev
sudo apt-get install libtiff4-dev
然后再运行./configure,这下终于可以正常地跑到结束了,看输出的信息,该生成的文件都生成了。于是,运行make,再运行sudo make install,经过一段时间后,编译结束,但中间报了两个error,Cannot open load file: case-table。在网上查阅资料,说是Emacs源文件不能放在中文目录下。而我的恰好放在中文目录下,改变目录后,因为前面编译过,所以运行make clean,make distclean来清理一下,再重新运行./configure,make,sudo make install,这次是彻底没错误了,貌似中间连一个warning都没看到。好了,再到终端里敲emacs,这次这位编辑器的大神终于露出了他的真容,不容易啊。