I am filing this as its own issue in the hope that a Rust programmer with access to OSX notices this and helps.
I have installed libreadline from source and also via Macports, and it works correctly with many other projects. However, when I do cargo install scryer-prolog on OSX, the compilation raises the following error:
= note: ld: warning: directory not found for option '-L/lib'
ld: warning: directory not found for option '-L/lib/x86_64-linux-gnu'
Undefined symbols for architecture x86_64:
"rl_line_buffer", referenced from:
readline_rs_compat::readline::rl_line_buffer_as_str::he3f0346cdfb950fa in libreadline_rs_compat-b37912a0520320ef.rlib(readline_rs_compat-b37912a0520320ef.readline_rs_compat.t3ge80bl-cgu.1.rcgu.o)
(maybe you meant: __ZN18readline_rs_compat8readline21rl_line_buffer_as_str17he3f0346cdfb950faE)
"rl_done", referenced from:
scryer_prolog::prolog::read::readline::bind_end_chord::h3317dd7765acc043 (.llvm.747659138871610075) in scryer_prolog-80a67b78a59cfac4.scryer_prolog.epb2n13l-cgu.14.rcgu.o
scryer_prolog::prolog::read::readline::bind_cr::h52aec85184bdff7b (.llvm.747659138871610075) in scryer_prolog-80a67b78a59cfac4.scryer_prolog.epb2n13l-cgu.14.rcgu.o
scryer_prolog::prolog_repl::h1afbc875d5e83930 in scryer_prolog-80a67b78a59cfac4.scryer_prolog.epb2n13l-cgu.15.rcgu.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please also see the discussion in #60; the issue was also raised in #64.
Is it still reproducible? There were a couple Rust releases since, and clang/llvm update. Maybe it was fixed on their side?
Unfortunately, it still does not compile using the latest cargo (0.37) and rust (1.36) from macports:
error: aborting due to previous error error: failed to compile `scryer-prolog v0.8.86`, intermediate artifacts can be found at ...
I'm convinced the macports distribution of readline is actually the editline library, a non-GPL alternative to GNU readline. I tried to port editline to Rust before I ported GNU readline, and I found that it was missing most of the readline API.. among others, the constants and functions listed in the compilation error.
That's not correct:
$ port info readline
readline @8.0.000 (devel)
Variants: universal
Description: The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they
are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain
a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history
expansion on previous commands.
Homepage: https://tiswww.case.edu/php/chet/readline/rltop.html
Library Dependencies: ncurses
Platforms: darwin, freebsd
License: GPL-3+
Maintainers: Email: [email protected], GitHub: MarcusCalhoun-Lopez
Policy: openmaintainer
But the version distributed by Apple in macOS under the readline name is libedit from BSD IIRC.
Huh, okay. I'm perplexed.
This can be completely solved by migrating to rustyline
@mthom: Could you please have a look into this suggestion? I hope that using rustyline makes Scryer work on OSX, and also maybe helps to implement #152, which is needed for fast development.
I looked at rustyline when Markus first suggested I use readline, and found it lacking for a reason I can't remember. I'm willing to give it another shot, though.
Scryer now uses rustyline.
That's awesome, many thanks!
I have successfully compiled the latest version of Scryer Prolog with recent Macports (cargo 1.36.0), and so I am closing this issue.
Most helpful comment
Scryer now uses rustyline.