简体   繁体   English

Emacs 22.3无法在Ubuntu 12.04上编译

[英]Emacs 22.3 does not compile on Ubuntu 12.04

I downloaded emacs 22.3 from 我从下载了emacs 22.3

http://ftp.gnu.org/pub/gnu/emacs/emacs-22.3.tar.gz http://ftp.gnu.org/pub/gnu/emacs/emacs-22.3.tar.gz

onto my Ubuntu 12.04.2 LTS desktop and compile/make doesn't work. 到我的Ubuntu 12.04.2 LTS桌面上,并且编译/制作不起作用。

Configure seems to work fine. 配置似乎工作正常。

Make fails very early on: in subdirectory lib-src there's a problem on line 148 of the makefile. Make很早就失败了:在子目录lib-src中,makefile的第148行出现问题。 And it does look like a problem: 它确实看起来像一个问题:

ALL_CFLAGS = -D_BSD_SOURCE -DHAVE_CONFIG_H
          -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}

That's lines 147 and 148: line 148 is supposed to be a continuation of line 147 I guess. 那就是第147行和第148行:我猜应该认为第148行是第147行的延续。 It begins with a tab. 它以标签开头。 No \\ at the end of line 147. I put one in and tried again. 在第147行的末尾没有\\。我放入一个并再次尝试。 I got an error on line 150. I put in another \\ . 我在第150行出现错误。我输入了另一个\\。 A few lines later things got a bit more serious, where absence of \\ actually resulted in things that weren't syntax errors but made make break in more subtle ways. 几行之后,事情变得更严重了,没有\\实际上导致的不是语法错误,而是以更微妙的方式使中断。

I shouldn't be editing Makefiles anyway (I can tell, their permissions were read-only ;-) ). 无论如何,我都不应该编辑Makefile(我知道它们的权限是只读的;-))。 What am I doing wrong? 我究竟做错了什么? I could persevere, but if I could instead eg feed a flag to make to eg run in emacs-22.3-makefile-compatibility mode, that would be much better. 我可以坚持不懈,但是如果我可以例如提供一个标志来例如以emacs-22.3-makefile-compatibility模式运行,那会更好。

[for those wondering "why" -- I have some scripts which I need for my work, and they have never worked in emacs >=23; [对于那些想知道“为什么”的人-我有一些我的工作需要的脚本,但是它们从未在> = 23的emacs中工作过; on my old machine I just compiled emacs22 myself no problem, but on this new Ubuntu machine I have no emacs22 and there's no emacs22 in ubuntu 12.04 repository so I'm a little desperate] 在我的旧机器上,我自己编译了emacs22没问题,但是在这台新的Ubuntu机器上,我没有emacs22,并且在ubuntu 12.04存储库中也没有emacs22,所以我有点绝望]


OK so it was suggested that I tried 好的,所以有人建议我尝试

$ CPPFLAGS="-P" ./configure

and this sorts out all of the problems with the carriage return/tabs in lib-src. 这样就可以解决lib-src中回车符/制表符的所有问题。 But actually it just gets to me to the point where I had managed to get manually: 但是实际上,这只是让我达到了手动获取的地步:

cd src; make all  \
          CC='gcc' CFLAGS='-g -O2 -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE  -P' \
          LDFLAGS='-Wl,-znocombreloc' MAKE='make'
make[1]: Entering directory `/home/buzzard/local/emacs-22.3/src'
gcc -c -D_BSD_SOURCE  -P -Demacs -DHAVE_CONFIG_H   -I. -I/home/buzzard/local/emacs-22.3/src -D_BSD_SOURCE  -g -O2 -Wno-pointer-sign  pre-crt0.c
make[1]: *** No rule to make target `/usr/lib/crt1.o', needed by `temacs'. Stop.
make[1]: Leaving directory `/home/buzzard/local/emacs-22.3/src'
make: *** [src] Error 2

Umm...I would post other bits and bobs if I knew what I was doing, but to be honest I've never understood make. 嗯...如果我知道自己在做什么,我会发布其他信息,但老实说,我从未理解过make。 I've always just hoped it would work... 我一直只是希望它能起作用...

It's a problem with newer gcc versions. 较新的gcc版本存在问题。 See this change in the Emacs repo which fixed this: 在Emacs仓库中查看此更改,此更改已解决:

http://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commit;h=16abbbf http://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commit;h=16abbbf

You should be able to workaraound the problem by using 您应该能够通过使用解决问题

CPPFLAGS="-P" ./configure

To circumvent the problem with /usr/lib/crt1.o not being found, you'll have to edit src/Makefile (you might first have to do chmod a+rw src/Makefile for editing it). 为了避免找不到/usr/lib/crt1.o的问题,您必须编辑src/Makefile (您可能必须先执行chmod a+rw src/Makefile进行编辑)。 On newer systems, crt1.o is not in /usr/lib but in /usr/lib/<arch directory>/ , so for example it might be in /usr/lib/i386-linux-gnu (yours might be different!). 在较新的系统上,crt1.o不在/usr/lib而是在/usr/lib/<arch directory>/ ,因此例如,它可能在/usr/lib/i386-linux-gnu (您可能有所不同! )。 Then in src/Makefile , change the lines 然后在src/Makefile ,更改行

STARTFILES = pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o

to

STARTFILES = pre-crt0.o /usr/lib/i386-linux-gnu/crt1.o /usr/lib/i386-linux-gnu/crti.o

and

LIBES = ... all kinds of stuff ...  /usr/lib/crtn.o $(GNULIB_VAR)

to

LIBES = ... all kinds of stuff ... /usr/lib/i386-linux-gnu/crtn.o $(GNULIB_VAR)

Again, your directory might be different! 同样,您的目录可能不同!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM