Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 639562

Summary: app-editors/emacs-18.59-r11 build failure with glibc-2.26 or with PIE
Product: Gentoo Linux Reporter: Ulrich Müller <ulm>
Component: Current packagesAssignee: GNU Emacs project <gnu-emacs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 642232    
Attachments: build.log
emerge --info
build.log after fixing the SIGUNUSED problem

Description Ulrich Müller gentoo-dev 2017-12-03 06:57:32 UTC
Compilation fails with glibc-2.26 due to SIGUNUSED being undefined:

x86_64-pc-linux-gnu-gcc -m32 -march=core2 -ggdb -O2 -pipe -Wno-implicit -Demacs   -c -o emacs.o emacs.c
In file included from config.h:33:0,
                 from emacs.c:26:
emacs.c: In function ‘main’:
s-linux.h:229:16: error: ‘SIGUNUSED’ undeclared (first use in this function)
 #define SIGSYS SIGUNUSED /* rename to harmless work-alike */
                ^
m-intel386.h:177:36: note: in definition of macro ‘signal’
 #define signal(sig, func) (signal (sig, (void (*) (int)) (func)))
                                    ^~~
emacs.c:426:15: note: in expansion of macro ‘SIGSYS’
       signal (SIGSYS, fatal_error_signal);
               ^~~~~~
s-linux.h:229:16: note: each undeclared identifier is reported only once for each function it appears in
 #define SIGSYS SIGUNUSED /* rename to harmless work-alike */
                ^
m-intel386.h:177:36: note: in definition of macro ‘signal’
 #define signal(sig, func) (signal (sig, (void (*) (int)) (func)))
                                    ^~~
emacs.c:426:15: note: in expansion of macro ‘SIGSYS’
       signal (SIGSYS, fatal_error_signal);
               ^~~~~~
make[2]: *** [<builtin>: emacs.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src'
make[1]: *** [Makefile:11: doall] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src'
make: *** [Makefile:51: src] Error 2
 * ERROR: app-editors/emacs-18.59-r11::gentoo failed (compile phase):
 *   emake failed
Comment 1 Ulrich Müller gentoo-dev 2017-12-03 06:58:33 UTC
Created attachment 507812 [details]
build.log
Comment 2 Ulrich Müller gentoo-dev 2017-12-03 06:59:28 UTC
Created attachment 507814 [details]
emerge --info
Comment 3 Ulrich Müller gentoo-dev 2017-12-03 07:06:20 UTC
The issue with glibc-2.26 is actually trivial to fix, since SIGUNUSED was only an alias for SIGSYS:

--- emacs-18.59/src/s-linux.h~
+++ emacs-18.59/src/s-linux.h
@@ -225,8 +225,6 @@
 #define MAXNAMLEN NAME_MAX     /* missing SYSV-ism */
 #endif
 
-#undef SIGSYS
-#define SIGSYS SIGUNUSED       /* rename to harmless work-alike */
 #define VSWTCH VSWTC           /* mis-spelling in termios.h? */
 
 /* we have non-standard standard I/O (iostream) ... */


However, after fixing this, there is a segmentation fault in temacs:

x86_64-pc-linux-gnu-gcc -m32 -nostdlib  -Wl,-O1 -Wl,--as-needed -o temacs pre-crt0.o /usr/lib32/crt1.o /usr/lib32/crti.o dispnew.o scroll.o xdisp.o window.o term.o cm.o  emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o fns.o print.o lread.o abbrev.o syntax.o unexelf.o mocklisp.o bytecode.o process.o callproc.o  doprnt.o terminfo.o lastfile.o  -lncurses  -lc /usr/lib32/crtn.o -lgcc -lc
fileio.o: In function `report_file_error':
/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src/fileio.c:119: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src/fileio.c:118: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
fileio.o: In function `Fmake_temp_name':
/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src/fileio.c:455: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib32/crt1.o: warning: relocation against `__libc_csu_fini' in readonly section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in a shared object.
rm -f ../etc/DOC
../etc/make-docfile dispnew.o scroll.o xdisp.o window.o term.o cm.o  emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o fns.o print.o lread.o abbrev.o syntax.o unexelf.o mocklisp.o bytecode.o process.o callproc.o  doprnt.o ../lisp/simple.elc ../lisp/help.elc ../lisp/files.elc ../lisp/window.elc ../lisp/indent.elc ../lisp/loaddefs.el ../lisp/paths.el ../lisp/startup.elc ../lisp/lisp.elc ../lisp/page.elc ../lisp/register.elc ../lisp/paragraphs.elc ../lisp/lisp-mode.elc ../lisp/text-mode.elc ../lisp/fill.elc ../lisp/c-mode.elc ../lisp/isearch.elc ../lisp/replace.elc ../lisp/abbrev.elc ../lisp/buff-menu.elc ../lisp/subr.elc ../lisp/version.el > ../etc/DOC
./temacs -batch -l inc-vers
make[2]: *** [xmakefile:23: xemacs] Segmentation fault
make[2]: Leaving directory '/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src'
make[1]: *** [Makefile:11: doall] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-editors/emacs-18.59-r11/work/emacs-18.59/src'
make: *** [Makefile:51: src] Error 2
 * ERROR: app-editors/emacs-18.59-r11::gentoo failed (compile phase):
 *   emake failed
Comment 4 Ulrich Müller gentoo-dev 2017-12-03 07:07:26 UTC
Created attachment 507816 [details]
build.log after fixing the SIGUNUSED problem
Comment 5 Larry the Git Cow gentoo-dev 2017-12-07 21:03:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10fd6109c66bf8273951837ca7c3a5a07c5e88e2

commit 10fd6109c66bf8273951837ca7c3a5a07c5e88e2
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2017-12-07 21:02:29 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2017-12-07 21:02:29 +0000

    app-editors/emacs: Fix compilation with glibc-2.26.
    
    Bug: https://bugs.gentoo.org/639562
    Package-Manager: Portage-2.3.16, Repoman-2.3.6

 app-editors/emacs/Manifest               | 2 +-
 app-editors/emacs/emacs-18.59-r11.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)}
Comment 6 Ulrich Müller gentoo-dev 2017-12-07 21:13:06 UTC
The issue with missing SIGUNUSED in glibc-2.26 headers is fixed, and building with gcc-5.4.0 succeeds.

However, it still segfaults when trying to build with gcc-6.4.0, see the end of comment #3.
Comment 7 Larry the Git Cow gentoo-dev 2017-12-10 23:58:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=378170ef0a5bcc0c7511badf188575b7e6055ccc

commit 378170ef0a5bcc0c7511badf188575b7e6055ccc
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2017-12-10 23:52:34 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2017-12-10 23:56:50 +0000

    app-editors/emacs: Fix Emacs 18 build failure with 17.0 profiles.
    
    Adding -no-pie to LDFLAGS also does the trick for emacs-18.59.
    Rearrange toolchain flag manipulation a bit.
    
    Closes: https://bugs.gentoo.org/639562
    Package-Manager: Portage-2.3.17, Repoman-2.3.6

 app-editors/emacs/emacs-18.59-r11.ebuild | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)