GNU Guile segfaults when loading guile-readline

117 Views Asked by At

I'm embedding guile in a small program I'm writing, I'm opting to use guile-readline as an extension. This extension works perfectly fine the default REPL, (use-modules (ice-9 readline)) (activate-readline).

However, when I try to invoke the same in a REPL instantiated by calling scm_shell();, the program segfaults at scm_init_readline.

I've found that (ice-9 readline) probably, under the hood, invokes (load-extension "guile-readline" "scm_init_readline"). Doing this works from the default guile REPL, guile, as doing (provided? 'readline) will yield #t after this invocation.

Still, from a custom REPL invoked via scm_shell(0, NULL);, this expression segfaults at scm_init_readline (from /usr/lib/guile/2.2/extensions/guile-readline.so). The particular instruction in question:

repz cmpsb %es:(%rdi),%ds:(%rsi) 

Having dumped the registers at this point, it's clear that rsi is 0 (so what looks to be a memory addressing operand segfaults).

I'm not sure if scm_shell() avoids crucial bootstrapping operations that the guile REPL itself does.

Any assistance with this issue would be appreciated, I've googled around and found people with similar issues but no resolution.

0

There are 0 best solutions below