Bug 221961

Summary: editors/emacs-devel build segfaults on aarch64
Product: Ports & Packages Reporter: gergely.czuczy
Component: Individual Port(s)Assignee: Ashish SHUKLA <ashish>
Status: Closed FIXED    
Severity: Affects Some People CC: gergely.czuczy, linimon
Priority: --- Flags: bugzilla: maintainer-feedback? (ashish)
Version: Latest   
Hardware: arm64   
OS: Any   

Description gergely.czuczy 2017-08-31 16:16:08 UTC
Hello,

editors/emacs-devel was marked broken on aarch64, due to the sbrk issue (they are still using sbrk, which is not available on aarch64). When manually removing the BROKEN directive, it seems to build, however the bootstrap-emacs segfaults:

87095 pure bytes used
mv -f emacs bootstrap-emacs
gmake -C ../lisp compile-first EMACS="../src/bootstrap-emacs"
gmake[4]: Entering directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp'
EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)'  -f batch-byte-compile emacs-lisp/macroexp.el
Fatal error 11: Segmentation faultgmake[4]: *** [Makefile:297: emacs-lisp/macroexp.elc] Segmentation fault (core dumped)
gmake[4]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp'
gmake[3]: *** [Makefile:739: bootstrap-emacs] Error 2
gmake[3]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/src'
gmake[2]: *** [Makefile:416: src] Error 2
gmake[2]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f'


-emacs.corepine64:/usr/ports/editors/emacs-devel# lldb work/emacs-f44184f/src/bootstrap-emacs -c work/emacs-f44184f/lisp/bootstrap-
(lldb) target create "work/emacs-f44184f/src/bootstrap-emacs" --core "work/emacs-f44184f/lisp/bootstrap-emacs.core"
Core file '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp/bootstrap-emacs.core' (aarch64) was loaded.
(lldb) bt
* thread #1, name = 'bootstrap-emacs', stop reason = signal SIGSEGV
  * frame #0: 0x0000000000158584 bootstrap-emacs`oblookup + 120
    frame #1: 0x000000000015843c bootstrap-emacs`intern_1 + 92
    frame #2: 0x00000000000fb0cc bootstrap-emacs`Fdo_auto_save + 220
    frame #3: 0x00000000000c5bd8 bootstrap-emacs`shut_down_emacs + 216
    frame #4: 0x00000000000c5a04 bootstrap-emacs`terminate_due_to_signal + 128
    frame #5: 0x00000000000df574 bootstrap-emacs`deliver_fatal_thread_signal + 128
    frame #6: 0x00000000000e0ec8 bootstrap-emacs`handle_sigsegv + 164
    frame #7: 0x00000000404cfe80 libthr.so.3`handle_signal(actp=0x0000000000539600, sig=11, info=0x0000000000539670, ucp=0x00000000005396c0) at thr_sig.c:244
    frame #8: 0x00000000404cf5a4 libthr.so.3`thr_sighandler(sig=11, info=0x0000000000539670, _ucp=0x00000000005396c0) at thr_sig.c:189
    frame #9: 0x0000fffffffff000
    frame #10: 0x0000000000040190 bootstrap-emacs`__start + 376
    frame #11: 0x00000000401c0018 ld-elf.so.1`.rtld_start at rtld_start.S:41


I've tried the latest git checkout as well (example is from that), it fails with it as well.

So, maybe not sbrk is the issue anymore, and it should build.

Best regards,
Gergely
Comment 1 gergely.czuczy 2017-08-31 16:25:24 UTC
I've forgot to add that I'm trying to build it on -CURRENT:
FreeBSD build-pine64.bealak.harmless.hu 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r322723M: Tue Aug 22 07:25:52 CEST 2017     toor@marvin.harmless.hu:/tank/rpi3/crochet/work.pine64vanilla/obj/arm64.aarch64/tank/rpi3/src/sys/GENERIC-NODEBUG  arm64
Comment 2 Ashish SHUKLA freebsd_committer freebsd_triage 2017-09-04 13:38:15 UTC
Hi,

Thanks for the report.

I don't have a 12-CURRENT host to test, although I will update the BROKEN message to provide a more clear reason. I'm committing an update shortly, if you can get it to build/work fine on your 12-CURRENT host, I'll remove BROKEN altogether.

Thanks!
Ashish
Comment 3 Ashish SHUKLA freebsd_committer freebsd_triage 2017-09-04 13:51:27 UTC
Added the change in r449247[1].

To force building on your platform, please try with -DTRYBROKEN.

[1] http://svnweb.freebsd.org/changeset/ports/449247


HTH
Ashish
Comment 4 gergely.czuczy 2017-09-04 19:29:44 UTC
Thanks. I've also reported this to the emacs devs, we're working on it.
Comment 5 gergely.czuczy 2017-09-04 19:30:07 UTC
And the emacs bug report's ID is 1713066.
Comment 6 gergely.czuczy 2017-09-04 19:42:06 UTC
Sorry, correction, it's 28308. I took a look at the wrong email, sorry.