Closed Xparx closed 5 years ago
I just ran a build on Travis against the current Emacs master so it doesn't seem to be anything having to do with changes to Emacs modules.
What is your OS and gcc version? There have been issues with Emacs's module code when compiling on Ubuntu 16.04 using gcc 5.4.0, see https://github.com/dzop/emacs-jupyter/issues/22#issuecomment-488981358 and related links. Your issue looks like it is something different though since you are getting a segfault.
Can you run
emacs -nw -Q -batch -L . -l ert -l zmq-tests.el \
--eval "(ert-run-tests-batch-and-exit)"
under gdb
and show the output of the backtrace
command after the segfault.
Thanks for the answer.
My OS is Ubuntu 18.04.2
$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The output from gdb
(gdb) file emacs
Reading symbols from emacs...(no debugging symbols found)...done.
(gdb) run -nw -Q -batch -L . -l ert -l zmq-tests.el --eval "(ert-run-tests-batch-and-exit)"
Starting program: /usr/bin/emacs -nw -Q -batch -L . -l ert -l zmq-tests.el --eval "(ert-run-tests-batch-and-exit)"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdbe5c700 (LWP 18427)]
Loading /home/at145/src/emacs-zmq/emacs-zmq.so (module)...
Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
286 Qt = GLOBREF(INTERN("t"));
(gdb)
Running backtrace (not sure this is what you asked for)
(gdb) bt
#0 0x00007fffdb2c1828 in emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
#1 0x000055555572dd48 in ()
#2 0x0000555555729a9e in ()
#3 0x0000555555701901 in ()
#4 0x000055555573c4c0 in ()
#5 0x000055555570187f in ()
#6 0x000055555573c4c0 in ()
#7 0x000055555570187f in ()
#8 0x000055555573c4c0 in ()
#9 0x0000555555703ca4 in ()
#10 0x00005555557294fc in ()
#11 0x0000555555729da6 in ()
#12 0x0000555555710f1f in ()
#13 0x0000555555703ca4 in ()
#14 0x00005555557292d8 in ()
#15 0x000055555572a236 in ()
#16 0x0000555555701901 in ()
#17 0x000055555573c4c0 in ()
#18 0x0000555555704196 in ()
#19 0x000055555570187f in ()
#20 0x0000555555704909 in ()
#21 0x000055555572998c in ()
#22 0x0000555555701901 in ()
#23 0x000055555573c4c0 in ()
#24 0x000055555570187f in ()
#25 0x000055555573c4c0 in ()
#26 0x000055555570187f in ()
#27 0x000055555573c4c0 in ()
#28 0x0000555555703694 in ()
#29 0x00005555557039da in ()
#30 0x0000555555705728 in ()
#31 0x0000555555700aee in ()
#32 0x0000555555684b98 in ()
#33 0x0000555555700a5d in ()
#34 0x0000555555683ca8 in ()
---Type <return> to continue, or q <return> to quit---
#35 0x0000555555688a96 in ()
#36 0x0000555555688dc6 in ()
#37 0x00005555555a78a7 in ()
#38 0x00007fffec69ab97 in __libc_start_main (main=
0x5555555a6b00, argc=12, argv=0x7fffffffddc8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffddb8)
at ../csu/libc-start.c:310
#39 0x00005555555a854a in ()
It does look like this is the same problem that I mentioned since the line that segfaults, emacs-zmq.c:286
, is the same line that causes issues in the link I posted and which is discussed in more detail at https://github.com/dzop/emacs-zmq/issues/9#issuecomment-478137806.
The problem has something to do with a bad gcc
optimization interfering with the way that the Emacs C module code is supposed to work, specifically the module_intern
function which INTERN("t")
eventually calls. Its curious though, what I gather from an emacs-devel thread discussing the problem and the related gcc
bug, this particular issue should be fixed in gcc
>= 6.
Can you re-build your Emacs with lower optimizations (or just the emacs-module.c
file) and see if the problem goes away. Not really sure about what else to do other than try a different compiler to build Emacs with.
Thanks for the advice. I'm not compiling my own emacs but rely on the emacs-snapshot ppa meaning that that version is compiled with a gcc version < 6.
I vill see if I can do something about that. Thanks again.
Closing since this has to do with compiling Emacs using a gcc
version < 6.
Hi @nnicandro, sadly it seems that I'm having a similar issue for gcc
version > 6.
AFAIK, emacs
on Fedora was built with libgcc-12.2.1-4.fc37.x86_64
-O2
.--with-modules
libzmq
's release-draft
rather than git-draft
this time)
sudo dnf -y groupinstall 'Development Tools'
sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/network:messaging:zeromq:release-draft/Fedora_Rawhide/network:messaging:zeromq:release-draft.repo`
sudo dnf -y install autoconf automake pkg-config libtool gdb gcc-c++ asciidoc xmlto libsodium-devel libunwind-devel zeromq-devel-4.3.3
sudo dnf -y install emacs
export ZMQ_LIBS=/usr/lib64/libzmq.so
, go into directory, call make
emacs
, follow the README steps (melpa, require zmq, etc etc)
emacs-zmq.so
into ~/.emacs.d/elpa/zmq-20230214.36
diriectory, then retry (require 'zmq)
And here's the gdb + backtrace.
(gdb) file emacs
Reading symbols from emacs...
This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.fedoraproject.org/
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
Reading symbols from .gnu_debugdata for /usr/bin/emacs-28.2...
(No debugging symbols found in .gnu_debugdata for /usr/bin/emacs-28.2)
Missing separate debuginfos, use: dnf debuginfo-install emacs-28.2-3.fc37.x86_64
(gdb) run -nw -Q -batch -L . -l ert -l zmq-tests.el --eval "(ert-run-tests-batch-and-exit)"
Starting program: /usr/bin/emacs -nw -Q -batch -L . -l ert -l zmq-tests.el --eval "(ert-run-tests-batch-and-exit)"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Loading /var/home/weaver/.emacs.d/elpa/zmq-20230214.36/emacs-zmq (module)...
Program received signal SIGSEGV, Segmentation fault.
emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
286 emacs-zmq.c: No such file or directory.
(gdb) bt
#0 emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
#1 0x0000000000621f98 in Fmodule_load ()
#2 0x0000000000613719 in Fload ()
#3 0x00000000005f754b in Ffuncall ()
#4 0x0000000000634de4 in exec_byte_code ()
#5 0x00000000005f74ff in Ffuncall ()
#6 0x0000000000634de4 in exec_byte_code ()
#7 0x00000000005ee00a in eval_sub ()
#8 0x000000000062368d in readevalloop.lto_priv ()
#9 0x000000000061383e in Fload ()
#10 0x0000000000613c45 in save_match_data_load ()
#11 0x00000000006040c6 in Frequire ()
#12 0x00000000005ee00a in eval_sub ()
#13 0x00000000006234b2 in readevalloop.lto_priv ()
#14 0x00000000006239c5 in Feval_buffer ()
#15 0x00007fffe9a3547b in F6c6f61642d776974682d636f64652d636f6e76657273696f6e_load_with_code_conversion_0 ()
from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/mule-3352613d-82b9a969.eln
#16 0x00000000005f754b in Ffuncall ()
#17 0x00000000006130af in Fload ()
#18 0x00007fffe99d270e in F636f6d6d616e642d6c696e652d31_command_line_1_0 () from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#19 0x00000000005f754b in Ffuncall ()
#20 0x00007fffe99ca1e0 in F636f6d6d616e642d6c696e65_command_line_0 () from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#21 0x00000000005f754b in Ffuncall ()
#22 0x00007fffe99c637c in F6e6f726d616c2d746f702d6c6576656c_normal_top_level_0 () from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#23 0x00000000005edf3f in eval_sub ()
#24 0x00000000005631c9 in top_level_2 ()
#25 0x00000000005e70f7 in internal_condition_case ()
#26 0x000000000056364a in top_level_1 ()
#27 0x00000000005e7039 in internal_catch ()
#28 0x0000000000563a3f in command_loop ()
#29 0x0000000000563b47 in recursive_edit_1 ()
#30 0x0000000000563cca in Frecursive_edit ()
#31 0x000000000046ae05 in main ()
And the gdb + backtrace following the command from #37
(gdb) run -nw -Q -batch --module-assertions -L . -l zmq --eval "(zmq-context)"
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/emacs -nw -Q -batch --module-assertions -L . -l zmq --eval "(zmq-context)"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Loading /var/home/weaver/.emacs.d/elpa/zmq-20230214.36/emacs-zmq (module)...
Program received signal SIGSEGV, Segmentation fault.
emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
286 emacs-zmq.c: No such file or directory.
(gdb) bt
#0 emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
#1 0x0000000000621f98 in Fmodule_load ()
#2 0x0000000000613719 in Fload ()
#3 0x00000000005f754b in Ffuncall ()
#4 0x0000000000634de4 in exec_byte_code ()
#5 0x00000000005f74ff in Ffuncall ()
#6 0x0000000000634de4 in exec_byte_code ()
#7 0x00000000005ee00a in eval_sub ()
#8 0x000000000062368d in readevalloop.lto_priv ()
#9 0x000000000061383e in Fload ()
#10 0x00007fffe99d270e in F636f6d6d616e642d6c696e652d31_command_line_1_0 ()
from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#11 0x00000000005f754b in Ffuncall ()
#12 0x00007fffe99ca1e0 in F636f6d6d616e642d6c696e65_command_line_0 ()
from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#13 0x00000000005f754b in Ffuncall ()
#14 0x00007fffe99c637c in F6e6f726d616c2d746f702d6c6576656c_normal_top_level_0 ()
from /usr/bin/../lib64/emacs/28.2/native-lisp/28.2-7454ea71/preloaded/startup-bbc6ea72-9c04c94d.eln
#15 0x00000000005edf3f in eval_sub ()
#16 0x00000000005631c9 in top_level_2 ()
#17 0x00000000005e70f7 in internal_condition_case ()
#18 0x000000000056364a in top_level_1 ()
#19 0x00000000005e7039 in internal_catch ()
#20 0x0000000000563a3f in command_loop ()
#21 0x0000000000563b47 in recursive_edit_1 ()
#22 0x0000000000563cca in Frecursive_edit ()
#23 0x000000000046ae05 in main ()
Really hope I can figure out some workaround soon! Real tired of clicking around on Jupyter, and the server I'm using doesn't even have working vim keybindings...
@weavermarquez (and others) I had the same problem on Fedora, while I remembered that I had used this library successfully before. Anyway, via #37 and #36 I arrived at https://github.com/akermu/emacs-libvterm/issues/559 and https://github.com/akermu/emacs-libvterm/pull/562. In both those issues it is mentioned that somehow building Emacs with xwidgets support, leads to Emacs ZMQ crashing (and in Fedora, it looks like Emacs has been built with xwidgets support (see M-: system-configuration-options
)).
So, after building emacs without xwidgets support, I was able to use Emacs ZMQ successfully.
I'm hunting down an error from another package
emacs-jupyter
. Currently i'm having issues with building and testingemacs-zmq
.M-x emacs-version
givesGNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-06-08
.I'm cloning the current master version of
emacs-zmq
and in the top directory i'm running make emacs_zmq_compile.txtand then
make test
Not sure where to go from here, but I'm suspecting that this issue is what is preventing
emacs-jupyter
from being installed correctly. Any help on what to do here?