mit-scheme-kernel icon indicating copy to clipboard operation
mit-scheme-kernel copied to clipboard

kernel won't start / undefined symbol: zmq_msg_init

Open tttaaannnggg opened this issue 4 years ago • 2 comments

(my environment is Ubuntu via WSL 2 )

So far, I haven't been able to locally install the mit-scheme kernel. I've successfully installed MIT Scheme from source, ZeroMQ, and this repo, but when I run the last step of

jupyter console --kernel mit-scheme

I get the following:

;The primitive dld-load-file, while executing the dlopen system call, received the error: /usr/local/lib/mit-scheme-x86-64/zmq-shim.so: undefined symbol: zmq_msg_init.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.

2 error>
End of input stream reached.

tttaaannnggg avatar Jul 09 '20 20:07 tttaaannnggg

I also get this problem, Did u fix it?

ivanberry avatar May 30 '22 10:05 ivanberry

I got the same problem and I fixed in this way. (my env: WSL2 - Ubuntu 18.04)

  1. Run sudo apt install pkg-config
  2. Do this again
$ git clone https://github.com/joeltg/mit-scheme-kernel
$ cd mit-scheme-kernel
$ make
$ sudo make install

Why and what happened?

I examine the step make carefully, and found /bin/sh: 1: pkg-config: not found

echo '(generate-shim "zmq" "#include <zmq.h>")' | /usr/local/bin/mit-scheme --batch-mode
;Including zmq.cdecl... done
;Generating "zmq-shim.c"...
;Warning: Unknown type: zmq_timer_fn
;... done
;Generating "zmq-const.c"... done
;Dumping "zmq-types.bin"... done
cc -I/usr/local/lib/mit-scheme-x86-64 -Wall -fPIC `pkg-config --cflags libzmq` -o zmq-shim.o -c zmq-shim.c
/bin/sh: 1: pkg-config: not found
cc -shared -fPIC -o zmq-shim.so zmq-shim.o `pkg-config --libs libzmq`
/bin/sh: 1: pkg-config: not found
cc `pkg-config --cflags libzmq`  -o zmq-const.o -c zmq-const.c
/bin/sh: 1: pkg-config: not found
cc  -o zmq-const zmq-const.o  `pkg-config --libs libzmq`
/bin/sh: 1: pkg-config: not found
./zmq-const
echo '(sf "zmq-const")' | /usr/local/bin/mit-scheme --batch-mode
;Generating SCode for file: "zmq-const.scm" => "zmq-const.bin"... done

zmq_msg_init is a function in Zeromq. The error "undefined symbol: zmq_msg_init" implies that zeromq may not link to the binary file successfully when compiling. Ref: https://stackoverflow.com/questions/21381993/makefile-issue-linking-zeromq-libs-on-linux. The makefile use the flag pkg-config to help link the libzmq, see http://wiki.zeromq.org/bindings:c. How to fix the pkg-config: not found issue, just install pkg-config : https://stackoverflow.com/questions/21381993/makefile-issue-linking-zeromq-libs-on-linux.

After fix the mit-scheme kernel launched. So please check your log carefully, here is a no error log for your reference:

echo '(generate-shim "zmq" "#include <zmq.h>")' | /usr/local/bin/mit-scheme --batch-mode
;Including zmq.cdecl... done
;Generating "zmq-shim.c"...
;Warning: Unknown type: zmq_timer_fn
;... done
;Generating "zmq-const.c"... done
;Dumping "zmq-types.bin"... done
cc -I/usr/local/lib/mit-scheme-x86-64 -Wall -fPIC `pkg-config --cflags libzmq` -o zmq-shim.o -c zmq-shim.c
cc -shared -fPIC -o zmq-shim.so zmq-shim.o `pkg-config --libs libzmq`
cc `pkg-config --cflags libzmq`  -o zmq-const.o -c zmq-const.c
cc  -o zmq-const zmq-const.o  `pkg-config --libs libzmq`
./zmq-const
echo '(sf "zmq-const")' | /usr/local/bin/mit-scheme --batch-mode
;Generating SCode for file: "zmq-const.scm" => "zmq-const.bin"... done

githubdudu avatar Jul 15 '23 17:07 githubdudu