nnicandro / emacs-zmq

Emacs bindings to ØMQ
GNU General Public License v2.0
49 stars 18 forks source link

Compiling Emacs 26.1.92 with optimizations causes failures on Ubuntu 16.04 #9

Closed serycjon closed 5 years ago

serycjon commented 5 years ago

OS: Ubuntu 16.04 emacs: 26.1.92 (--with-modules)

Running make results in no errors, but running make test fails 10 out of 11 test cases: void function zmq-context void function zmq-version ...

Running: emacs -nw -Q -batch -L . -l ert -l zmq-tests.el --module-assertions --eval "(ert-run-tests-batch-and-exit)"

results in: Emacs module assertion: Emacs value not found in 0 values of 2 environments Fatal error 6: Aborted

What could I be doing wrong?

nnicandro commented 5 years ago

Does emacs -nw -Q -batch -L . -l zmq --eval "(zmq-context)" fail? zmq-context and zmq-version are functions that are defined in the C module and it looks like they are not getting defined? Can you show all the output that you get from make test or is all you get void function ...?

For reference I am also on Emacs 26.1.92

GNU Emacs 26.1.92 (build 1, x86_64-apple-darwin18.2.0, Carbon Version 158 AppKit 1671.2) of 2019-03-25
serycjon commented 5 years ago

It does fail - symbol's function definition is void: zmq-context

Error in post-gc-hook (zmq--cleanup-globrefs): (void-function zmq--cleanup-globrefs)
Running 11 tests (2019-03-29 19:01:34+0100)
Test zmq-close-socket-once backtrace:
  (zmq-socket (zmq-current-context) zmq-PUB)
  (let ((sock (zmq-socket (zmq-current-context) zmq-PUB))) (zmq-close 
  (closure (t) nil (let ((sock (zmq-socket (zmq-current-context) zmq-P
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-close-socket-once :documentation 
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-close-socket-once condition:
    (void-function zmq-socket)
   FAILED   1/11  zmq-close-socket-once
Test zmq-contexts backtrace:
  (zmq-context)
  (setq ctx (zmq-context))
  (let ((ert--infos (cons (cons "Info: " "Creating contexts") ert--inf
  (let (ctx) (let ((ert--infos (cons (cons "Info: " "Creating contexts
  (closure (t) nil (let (ctx) (let ((ert--infos (cons (cons "Info: " "
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-contexts :documentation nil :body
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-contexts condition:
    Info: Creating contexts
    (void-function zmq-context)
   FAILED   2/11  zmq-contexts
Test zmq-encryption backtrace:
  (zmq-has "curve")
  (if (zmq-has "curve") nil (ert-skip "ZMQ built without CURVE"))
  (closure (t) nil (if (zmq-has "curve") nil (ert-skip "ZMQ built with
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-encryption :documentation nil :bo
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-encryption condition:
    (void-function zmq-has)
   FAILED   3/11  zmq-encryption
Test zmq-globrefs backtrace:
  (zmq-poller)
  (let ((poller (zmq-poller))) (let ((sock (zmq-socket (zmq-current-co
  (let ((ert--infos (cons (cons "Info: " "`zmq-poller' socket referenc
  (let ((table (make-hash-table :size 1 :weakness (quote value) :test 
  (closure (t) nil (let ((table (make-hash-table :size 1 :weakness (qu
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-globrefs :documentation nil :body
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-globrefs condition:
    Info: `zmq-poller' socket references don't outlive poller
    (void-function zmq-poller)
   FAILED   4/11  zmq-globrefs
Test zmq-messages backtrace:
  (zmq-message)
  (let ((msg (zmq-message))) (let ((ert--infos (cons (cons "Info: " "E
  (let ((ert--infos (cons (cons "Info: " "Message initialization") ert
  (closure (t) nil (let ((ert--infos (cons (cons "Info: " "Message ini
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-messages :documentation nil :body
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-messages condition:
    Info: Message initialization
    (void-function zmq-message)
   FAILED   5/11  zmq-messages
Test zmq-polling backtrace:
  zmq-context()
  zmq-current-context()
  (let ((ctx (zmq-current-context))) (let ((ert--infos (cons (cons "In
  (closure (t) nil (let ((ctx (zmq-current-context))) (let ((ert--info
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-polling :documentation nil :body 
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-polling condition:
    (void-function zmq-context)
   FAILED   6/11  zmq-polling
Test zmq-send-unicode backtrace:
  (zmq-message contents)
  (let* ((contents "[â, â†] = 1") (msg (zmq-message contents))) (let
  (let ((ert--infos (cons (cons "Info: " "Unicode messages") ert--info
  (closure (t) nil (let ((ert--infos (cons (cons "Info: " "Unicode mes
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-send-unicode :documentation nil :
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-send-unicode condition:
    Info: Unicode messages
    (void-function zmq-message)
   FAILED   7/11  zmq-send-unicode
Test zmq-sockets backtrace:
  (zmq-context)
  (let* ((ctx (zmq-context)) (endpoint "tcp://127.0.0.1:5345") (s (zmq
  (closure (t) nil (let* ((ctx (zmq-context)) (endpoint "tcp://127.0.0
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-sockets :documentation nil :body 
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-sockets condition:
    (void-function zmq-context)
   FAILED   8/11  zmq-sockets
Test zmq-subprocess backtrace:
  signal(zmq-subprocess-error (void-function (zmq-context)))
  zmq--subprocess-filter(#<process zmq> "(error void-function (zmq-con
  sleep-for(0.01)
  (while (not filter-called) (sleep-for 0.01))
  (progn (while (not filter-called) (sleep-for 0.01)))
  (unwind-protect (progn (while (not filter-called) (sleep-for 0.01)))
  (let* ((-with-timeout-timer- (run-with-timer 0.4 nil (function (lamb
  (catch (quote timeout) (let* ((-with-timeout-timer- (run-with-timer 
  (let ((-with-timeout-value- (catch (quote timeout) (let* ((-with-tim
  (let* ((body (quote ((if zmq-current-context (prin1 (cons ... "conte
  (let ((ert--infos (cons (cons "Info: " "Subprocess wraps function wi
  (closure (t) nil (let ((ert--infos (cons (cons "Info: " "Validating 
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-subprocess :documentation nil :bo
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-subprocess condition:
    Info: Subprocess wraps function with context
    (zmq-subprocess-error void-function
              (zmq-context))
   FAILED   9/11  zmq-subprocess
Test zmq-utility backtrace:
  (zmq-version)
  (let ((version (zmq-version))) (let* ((fn-28 (function version<=)) (
  (let ((ert--infos (cons (cons "Info: " "`zmq-version'") ert--infos))
  (closure (t) nil (let ((ert--infos (cons (cons "Info: " "`zmq-versio
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq-utility :documentation nil :body 
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq-utility condition:
    Info: `zmq-version'
    (void-function zmq-version)
   FAILED  10/11  zmq-utility
   passed  11/11  zmq-wrong-object-type

Ran 11 tests, 1 results as expected, 10 unexpected (2019-03-29 19:01:34+0100)

10 unexpected results:
   FAILED  zmq-close-socket-once
   FAILED  zmq-contexts
   FAILED  zmq-encryption
   FAILED  zmq-globrefs
   FAILED  zmq-messages
   FAILED  zmq-polling
   FAILED  zmq-send-unicode
   FAILED  zmq-sockets
   FAILED  zmq-subprocess
   FAILED  zmq-utility

make: *** [test] Error 1
nnicandro commented 5 years ago

From the zmq directory, do you get any errors when you run

emacs -nw -Q -batch --eval '(progn (module-load "emacs-zmq.so") (zmq-context))'

From the make test output it looks like none of the function definitions are being loaded. If that's the case then there may be something going wrong before those functions get defined in the module, but then you should be seeing an error when loading the module...

serycjon commented 5 years ago

This outputs just: `Symbol's function definition is void: zmq-context'

Maybe this could be helpful? Output of nm -v emacs-zmq.so:

                 U __assert_fail@@GLIBC_2.2.5
                 w __cxa_finalize@@GLIBC_2.2.5
                 U free@@GLIBC_2.2.5
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
                 U malloc@@GLIBC_2.2.5
                 U __memcpy_chk@@GLIBC_2.3.4
                 U signal@@GLIBC_2.2.5
                 U __sprintf_chk@@GLIBC_2.3.4
                 U __stack_chk_fail@@GLIBC_2.4
                 U strlen@@GLIBC_2.2.5
                 U zmq_bind
                 U zmq_close
                 U zmq_connect
                 U zmq_ctx_get
                 U zmq_ctx_new
                 U zmq_ctx_set
                 U zmq_ctx_shutdown
                 U zmq_ctx_term
                 U zmq_curve_keypair
                 U zmq_curve_public
                 U zmq_disconnect
                 U zmq_errno
                 U zmq_getsockopt
                 U zmq_has
                 U zmq_join
                 U zmq_leave
                 U zmq_msg_close
                 U zmq_msg_copy
                 U zmq_msg_data
                 U zmq_msg_get
                 U zmq_msg_gets
                 U zmq_msg_group
                 U zmq_msg_init
                 U zmq_msg_init_data
                 U zmq_msg_more
                 U zmq_msg_move
                 U zmq_msg_recv
                 U zmq_msg_routing_id
                 U zmq_msg_send
                 U zmq_msg_set
                 U zmq_msg_set_group
                 U zmq_msg_set_routing_id
                 U zmq_msg_size
                 U zmq_poll
                 U zmq_poller_add
                 U zmq_poller_add_fd
                 U zmq_poller_destroy
                 U zmq_poller_modify
                 U zmq_poller_modify_fd
                 U zmq_poller_new
                 U zmq_poller_remove
                 U zmq_poller_remove_fd
                 U zmq_poller_wait
                 U zmq_poller_wait_all
                 U zmq_proxy
                 U zmq_proxy_steerable
                 U zmq_send
                 U zmq_setsockopt
                 U zmq_socket
                 U zmq_socket_monitor
                 U zmq_strerror
                 U zmq_unbind
                 U zmq_version
                 U zmq_z85_decode
                 U zmq_z85_encode
0000000000004310 T _init
0000000000004850 t deregister_tm_clones
0000000000004890 t register_tm_clones
00000000000048e0 t __do_global_dtors_aux
0000000000004920 t frame_dummy
0000000000004950 T ezmq_socket
0000000000004a10 T ezmq_send
0000000000004bc0 T ezmq_recv
0000000000004da0 T ezmq_bind
0000000000004e70 T ezmq_connect
0000000000004f40 T ezmq_unbind
0000000000005010 T ezmq_disconnect
00000000000050e0 T ezmq_join
00000000000051b0 T ezmq_leave
0000000000005280 T ezmq_close
0000000000005310 T ezmq_proxy
00000000000053f0 T ezmq_proxy_steerable
0000000000005500 T ezmq_socket_monitor
00000000000056c0 T ezmq_setsockopt
00000000000059d0 T ezmq_assert_eint
0000000000005a00 T ezmq_getsockopt
0000000000005e40 T ezmq_context
0000000000005e90 T ezmq_ctx_set
0000000000005fa0 T ezmq_ctx_get
0000000000006080 T ezmq_ctx_shutdown
00000000000060f0 T ezmq_ctx_term
0000000000006160 t ezmq_free_message
0000000000006170 T ezmq_message
0000000000006460 T ezmq_message_size
00000000000064c0 T ezmq_message_data
0000000000006550 T ezmq_message_more
00000000000065e0 T ezmq_message_copy
0000000000006670 T ezmq_message_move
0000000000006700 T ezmq_message_close
0000000000006770 T ezmq_message_set
0000000000006880 T ezmq_message_get
0000000000006940 T ezmq_message_recv
0000000000006a40 T ezmq_message_send
0000000000006b40 T ezmq_message_gets
0000000000006c20 T ezmq_message_routing_id
0000000000006c80 T ezmq_message_set_routing_id
0000000000006d10 T ezmq_message_group
0000000000006dc0 T ezmq_message_set_group
0000000000006e80 T ezmq_expose_constants
000000000000aea0 T ezmq_has
000000000000af40 T ezmq_version
000000000000b010 T ezmq_z85_decode
000000000000b190 T ezmq_z85_encode
000000000000b2e0 T ezmq_curve_keypair
000000000000b460 T ezmq_curve_public
000000000000b5d0 T ezmq_equal
000000000000b700 T ezmq_message_p
000000000000b740 T ezmq_socket_p
000000000000b780 T ezmq_context_p
000000000000b7c0 T ezmq_poller_p
000000000000b800 t ezmq_type_symbol
000000000000b880 T ezmq_signal
000000000000b990 T ezmq_signal_error
000000000000bf70 T ezmq_malloc
000000000000bfc0 T ezmq_wrong_type_argument
000000000000c200 T ezmq_args_out_of_range
000000000000c280 T ezmq_obj_of_type
000000000000c300 T ezmq_extract_obj
000000000000c420 T ezmq_new_obj
000000000000c4b0 T ezmq_new_obj_ptr
000000000000c4d0 T ezmq_obj_get_val
000000000000c4f0 T ezmq_push_globref
000000000000c540 T ezmq_free_obj
000000000000c580 T ezmq_obj_finalizer
000000000000c680 T ezmq_obj_set_val
000000000000c6d0 T ezmq_pop_globref
000000000000c700 T ezmq_copy_string
000000000000c7b0 t ezmq_invalid_poll_event
000000000000c880 t ezmq_merge_poll_events
000000000000c9d0 t ezmq_split_poll_events
000000000000caa0 t ezmq_get_poll_trigger.isra.0
000000000000cc50 T ezmq_poll
000000000000d1e0 T ezmq_poller_new
000000000000d230 T ezmq_poller_add
000000000000d4a0 T ezmq_poller_modify
000000000000d6a0 T ezmq_poller_remove
000000000000d840 T ezmq_poller_destroy
000000000000d8c0 T ezmq_poller_wait
000000000000d9d0 T ezmq_poller_wait_all
000000000000dbc0 t ezmq_bind_function
000000000000dc70 t ezmq_cleanup_globrefs
000000000000dcb0 t ezmq_dispatch
000000000000de70 T emacs_module_init
000000000000fe68 T _fini
0000000000010dc0 r __PRETTY_FUNCTION__.4365
0000000000012560 r __PRETTY_FUNCTION__.4223
0000000000012f60 r __PRETTY_FUNCTION__.4742
00000000000130b8 r __GNU_EH_FRAME_HDR
0000000000014730 r __FRAME_END__
00000000002149a0 t __frame_dummy_init_array_entry
00000000002149a8 t __do_global_dtors_aux_fini_array_entry
00000000002149b0 d __JCR_END__
00000000002149b0 d __JCR_LIST__
00000000002149b8 d _DYNAMIC
0000000000215000 d _GLOBAL_OFFSET_TABLE_
0000000000215298 d __dso_handle
00000000002152a0 D __zmq_doc_ezmq_getsockopt
00000000002152a8 D __zmq_doc_ezmq_setsockopt
00000000002152b0 D __zmq_doc_ezmq_socket_monitor
00000000002152b8 D __zmq_doc_ezmq_proxy_steerable
00000000002152c0 D __zmq_doc_ezmq_proxy
00000000002152c8 D __zmq_doc_ezmq_close
00000000002152d0 D __zmq_doc_ezmq_leave
00000000002152d8 D __zmq_doc_ezmq_join
00000000002152e0 D __zmq_doc_ezmq_disconnect
00000000002152e8 D __zmq_doc_ezmq_unbind
00000000002152f0 D __zmq_doc_ezmq_connect
00000000002152f8 D __zmq_doc_ezmq_bind
0000000000215300 D __zmq_doc_ezmq_recv
0000000000215308 D __zmq_doc_ezmq_send
0000000000215310 D __zmq_doc_ezmq_socket
0000000000215318 D __zmq_doc_ezmq_ctx_term
0000000000215320 D __zmq_doc_ezmq_ctx_shutdown
0000000000215328 D __zmq_doc_ezmq_ctx_get
0000000000215330 D __zmq_doc_ezmq_ctx_set
0000000000215338 D __zmq_doc_ezmq_context
0000000000215340 D __zmq_doc_ezmq_message_set_group
0000000000215348 D __zmq_doc_ezmq_message_group
0000000000215350 D __zmq_doc_ezmq_message_set_routing_id
0000000000215358 D __zmq_doc_ezmq_message_routing_id
0000000000215360 D __zmq_doc_ezmq_message_gets
0000000000215368 D __zmq_doc_ezmq_message_send
0000000000215370 D __zmq_doc_ezmq_message_recv
0000000000215378 D __zmq_doc_ezmq_message_get
0000000000215380 D __zmq_doc_ezmq_message_set
0000000000215388 D __zmq_doc_ezmq_message_close
0000000000215390 D __zmq_doc_ezmq_message_move
0000000000215398 D __zmq_doc_ezmq_message_copy
00000000002153a0 D __zmq_doc_ezmq_message_more
00000000002153a8 D __zmq_doc_ezmq_message_data
00000000002153b0 D __zmq_doc_ezmq_message_size
00000000002153b8 D __zmq_doc_ezmq_message
00000000002153c0 D __zmq_doc_ezmq_poller_p
00000000002153c8 D __zmq_doc_ezmq_context_p
00000000002153d0 D __zmq_doc_ezmq_socket_p
00000000002153d8 D __zmq_doc_ezmq_message_p
00000000002153e0 D __zmq_doc_ezmq_equal
00000000002153e8 D __zmq_doc_ezmq_curve_public
00000000002153f0 D __zmq_doc_ezmq_curve_keypair
00000000002153f8 D __zmq_doc_ezmq_z85_encode
0000000000215400 D __zmq_doc_ezmq_z85_decode
0000000000215408 D __zmq_doc_ezmq_version
0000000000215410 D __zmq_doc_ezmq_has
0000000000215418 D __zmq_doc_ezmq_poller_wait_all
0000000000215420 D __zmq_doc_ezmq_poller_wait
0000000000215428 D __zmq_doc_ezmq_poller_destroy
0000000000215430 D __zmq_doc_ezmq_poller_remove
0000000000215438 D __zmq_doc_ezmq_poller_modify
0000000000215440 D __zmq_doc_ezmq_poller_add
0000000000215448 D __zmq_doc_ezmq_poller_new
0000000000215450 D __zmq_doc_ezmq_poll
0000000000215458 D __zmq_doc_ezmq_cleanup_globrefs
0000000000215460 B __bss_start
0000000000215460 b completed.7594
0000000000215460 D _edata
0000000000215460 d __TMC_END__
0000000000215468 b globrefs
0000000000215480 B env
0000000000215488 b initialized
00000000002154a0 b _fargs
00000000002154c8 B Qargs_out_of_range
00000000002154d0 B Izmq_POLLERR
00000000002154d8 B Qcons
00000000002154e0 B Qinteger
00000000002154e8 B Qzmq_POLLIN
00000000002154f0 B Qstring
00000000002154f8 B Qcdr
0000000000215500 B Qvector
0000000000215508 B Qzmq_error
0000000000215510 B Qlist
0000000000215518 B Qcar
0000000000215520 B Qlength
0000000000215528 B Qzmq_POLLERR
0000000000215530 B Qequal
0000000000215538 B Qzmq_POLLOUT
0000000000215540 B Qnil
0000000000215548 B Qnth
0000000000215550 B plugin_is_GPL_compatible
0000000000215558 B Izmq_POLLIN
0000000000215560 B Qt
0000000000215568 B Izmq_POLLOUT
0000000000215570 B Qwrong_type_argument
0000000000215578 B _end
serycjon commented 5 years ago

Also here is what I think is the relevant part of backtrace of emacs -nw -Q -batch --eval '(module-load "emacs-zmq.so")' (can post the whole thing if you want)

#0  0x00007ffff1e20269 in raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/pt-raise.c:35
        resultvar = 0
        pid = <optimized out>
#1  0x00000000004f36d4 in terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:394
No locals.
#2  0x000000000050d243 in emacs_abort () at sysdep.c:2426
No locals.
#3  0x0000000000592074 in module_abort (format=format@entry=0x617fe0 "Emacs value not found in %ld values of %ld environments") at emacs-module.c:1190
        args = <error reading variable args (Attempt to dereference a generic pointer.)>
#4  0x000000000059253e in value_to_lisp (v=v@entry=0x0) at emacs-module.c:980
        vptr = 0x0
        optr = 0x0
        num_environments = <optimized out>
        num_values = <optimized out>
#5  0x0000000000592f8a in value_to_lisp (v=0x0) at emacs-module.c:311
No locals.
#6  module_make_global_ref (env=0x16b6980, ref=0x0) at emacs-module.c:293
        internal_handler_CONDITION_CASE = 0x1634920
        internal_cleanup_CONDITION_CASE = 0x1634920
        internal_handler_CATCHER_ALL = 0x16b6a80
        internal_cleanup_CATCHER_ALL = 0x16b6a80
        h = 0xc940f0
        new_obj = <optimized out>
        hashcode = 23816576
        i = <optimized out>
#7  0x00007fffe5899f2c in emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286
        __PRETTY_FUNCTION__ = "emacs_module_init"
        Qsval = <optimized out>
#8  0x00000000005930ff in Fmodule_load (file=...) at emacs-module.c:737
        handle = <optimized out>
        module_init = 0x7fffe5899e70 <emacs_module_init>
        gpl_sym = <optimized out>
        rt_pub = {size = 140737488334544, private_members = 0xc0f650 <main_thread+144>, get_environment = 0x11bdfb5}
        rt_priv = {env = 0x16b6980}
        env_pub = {size = 230584300921369384, private_members = 0x0, make_global_ref = 0x28, free_global_ref = 0x58da4a <read1+1098>, non_local_exit_check = 0x1, non_local_exit_clear = 0x0, non_local_exit_get = 0x16a45de, non_local_exit_signal = 0x3300, non_local_exit_throw = 0x0, make_function = 0x100000000000000, funcall = 0x16a4500, intern = 0x16a45d8, type_of = 0x1fffffffffffffff, is_not_nil = 0x100000001, eq = 0x1634e83, extract_integer = 0xd635c7cdd67dc700, make_integer = 0x0, extract_float = 0x0, make_float = 0x16a45d8, copy_string_contents = 0x11bdfb5, make_string = 0x0, make_user_ptr = 0xbd7758 <searchbufs+5368>, get_user_ptr = 0x2d, set_user_ptr = 0x545236 <re_search_2+982>, get_user_finalizer = 0xc0f650 <main_thread+144>, set_user_finalizer = 0x576b6b <internal_equal+747>, vec_get = 0x100000001, vec_set = 0x97ca7c <pure+1105916>, vec_size = 0xbd7720 <searchbufs+5312>, should_quit = 0xd635c7cdd67dc700}
        env_priv = {pending_non_local_exit = emacs_funcall_exit_return, non_local_exit_symbol = {i = 0}, non_local_exit_data = {i = 0}, values = {i = 0}}
        rt = 0x15f3df0
        r = <optimized out>
nnicandro commented 5 years ago
#7  0x00007fffe5899f2c in emacs_module_init (ert=<optimized out>) at emacs-zmq.c:286

corresponds to

https://github.com/dzop/emacs-zmq/blob/3965bec1ac232f0f7f35e7e91626e192688407b4/src/emacs-zmq.c#L286

which gets expanded into

Qt = env->make_global_ref(env, env->intern(env, "t"));

and

#6  module_make_global_ref (env=0x16b6980, ref=0x0) at emacs-module.c:293

shows that env->intern(env, "t") appears to be returning NULL for some reason.

Do you build Emacs with any special configure flags (other than --with-modules) or CFLAGS? Can you try building Emacs with CFLAGS=-O0 to see if you still get the error?

serycjon commented 5 years ago

I have used ./configure --with-mailutils --with-xml2 --with-imagemagick --with-modules will try to recompile again and build it with -O0

serycjon commented 5 years ago

All test pass when I compile with CFLAGS="-O0" ./configure --with-mailutils --with-xml2 --with-imagemagick --with-modules do you have some idea what could be going on?

nnicandro commented 5 years ago

Not really. Thats beyond my level of C compiler proficiency. It looks like something in the env->intern(env, "t") call is getting optimized away and causing it to return NULL? Maybe updating gcc will fix the problem? You can also try compiling an Emacs newer than https://github.com/emacs-mirror/emacs/commit/09d746dad36e4780d379f975a84b1b076da78c50 which appears to have changed relevant code.

serycjon commented 5 years ago

Thanks for all your help, I have tried building from master (emacs-mirror/emacs@9c0fa11) and it works without CFLAGS="-O0"