你萌的 Emacs 是怎么编译的 (OSX 10.11+)

几个月之前我用

brew install emacs -vd --build-from-source --with-cocoa --with-imagemagick

一直报找不到 tput 的错,(cocoa 和 imagemagick 单独都能完美编译。 )

然后一直坚持用终端的Emacs,现在想试试用图形界面的Emacs,折腾一晚上了,最后没办法了,编译选项 --with-librsvg --with-glib --with-gnutls --with-cocoa , 也能显示图片,但是没有 imagemagick 的支持总觉得少了些什么。。

configure: error: The required function `tputs' was not found in any library.
The following libraries were tried (in order):
  libtinfo, 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.
/usr/local/Library/Homebrew/debrew.rb:11:in `raise'
BuildError: Failed executing: ./configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/24.5/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/24.5 --with-file-notification=gfile --with-xml2 --without-dbus --with-gnutls --with-rsvg --with-imagemagick --with-ns --disable-ns-self-contained

尝试过

brew install ncurses
CPPFLAGS=-I/usr/local/opt/ncurses/include LDFLAGS=-L/usr/local/opt/ncurses/lib ./configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/24.5/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/24.5 --with-file-notification=gfile --with-xml2 --without-dbus --with-gnutls --with-rsvg --with-imagemagick --with-ns --disable-ns-self-contained

没软用,感觉不是路径的问题呢

那么问题来了,这个锅该帅给OSX 还是 Emacs 还是 Homebrew 还是我呢 QAQ

*tput 是什么?

*你第二个的编译选项的问题是里面的 --with-glib 去点后面的问题应该就没有了 我一般用 brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick

brew info emacs 里面的 Options 除了 with-glib 编译会出错外。别的好像都还行。根据需要来。

  1. tput 就是在 --with-imagemagick 下找不到的东西啊,需要用到 ncurses 的,(系统应该是自带的)
  2. 和 --with-glib 没关系的, --with-librsvg --with-glib --with-gnutls --with-cocoa --> 通过 ; –with-cocoa --with-imagemagick --> 报错 ; –with-cocoa --with-imagemagick +随便什么东西 --> 报错;

估计是我不小心删了Mac的自带的库吧:joy:宝宝心里苦但是宝宝不说

imagemagick 删了 重新装下了 也可以用 brew弄的

直接下的binary = =

试过了,现在imagemagick是最新的版本。问题应该在Mac和Homebrew之间,Mac自带的curses编译的时候找不到。

:joy: 我也下过binary,但是binary不是没有GUI吗。。

brew install emacs --force-bottle -vd

祝好运 别的也不知道了

很早就看过了。还是蟹蟹你

讲道理是Emacs 24.5的锅了,编译25.0.94或者HEAD的就没问题了

从没遇到过编译问题,如果实在编译不过,试试

$ brew tap railwaycat/emacsmacport
$ brew cask install emacs-mac

或者去这里 GNU Emacs For Mac OS X 下载

1 个赞

brew install emacs-mac --with-spacemacs-icon

2 个赞

brew install emacs --with-cocoa --with-imagemagick --with-librsvg --with-mailutils --devel

我这段时间用

brew install emacs-mac --HEAD

比较多一些

我是下载源码编译的。 25.1 似乎只能使用 imagemagick 6。而 Homebrew 最新已经到7了。 先要

brew install imagemagick@6

然后

./configure --with-ns --with-modules --with-imagemagick IMAGEMAGICK_CFLAGS=-I/usr/local/include/ImageMagick-6 IMAGEMAGICK_LIBS="-lMagickCore-6.Q16HDRI -lMagick++-6.Q16HDRI -lMagickWand-6.Q16HDRI" && make install

编译失败

  CC       image.o
image.c:8243:10: fatal error: 'wand/MagickWand.h' file not found
#include <wand/MagickWand.h>
         ^
1 error generated.
make[1]: *** [image.o] Error 1
make: *** [src] Error 2

brew info 以后发现:

==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Older version of imagemagick

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/imagemagick@6/lib
    CPPFLAGS: -I/usr/local/opt/imagemagick@6/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/imagemagick@6/lib/pkgconfig

大概明白是怎么回事了。 这次换成IMAGEMAGICK_CFLAGS=-I/usr/local/opt/imagemagick@6/include 还是出错。。 看看文件结构。又明白了。 大概我不用说也明白错在哪里了。 然后 lib 也要改。

11 warnings generated.
  CC       nsselect.o
  CC       nsimage.o
make[1]: Circular bootstrap-emacs <- temacs dependency dropped.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../lisp update-subdirs
./temacs --batch --load loadup bootstrap
make[1]: ./temacs: No such file or directory
make[1]: *** [bootstrap-emacs] Error 1
make: *** [src] Error 2

又出错。没办法了。


参考: http://www.linuxfromscratch.org/blfs/view/svn/postlfs/emacs.html