"Neither readline nor libedit was found" 在 Raspbian 11(靶心)

"Neither readline nor libedit was found" on Raspbian 11 (bullseye)

我正在尝试编译 Ruby,我得到以下信息:

root@raspberrypi:~/ruby-3.1.2# make -j4
...
linking ruby
make[2]: Leaving directory '/root/ruby-3.1.2'
make[1]: Leaving directory '/root/ruby-3.1.2'
make[1]: Entering directory '/root/ruby-3.1.2'
*** Following extensions are not compiled:
readline:
    Could not be configured. It will not be installed.
    /root/ruby-3.1.2/ext/readline/extconf.rb:62: Neither readline nor libedit was found
    Check ext/readline/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
make[1]: Leaving directory '/root/ruby-3.1.2'
root@raspberrypi:~/ruby-3.1.2#

但是我确实安装了两个:

root@raspberrypi:~/ruby-3.1.2# apt-get install libreadline-dev libedit-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libedit-dev is already the newest version (3.1-20191231-2).
libreadline-dev is already the newest version (8.1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

这在 Raspbian 10 上按预期工作,但不确定为什么在 Raspbian 11 上不工作?

root@raspberrypi:~/ruby-3.1.2# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye

ext/readline/mkmf.log 的相关部分(朝底部)显示如下:

...
have_header: checking for readline/readline.h... -------------------- no

LD_LIBRARY_PATH=.:../.. "gcc -I../../.ext/include/armv7l-linux-eabihf -I../.././include -I../.././ext/readline  -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef   -c conftest.c"
conftest.c:3:10: fatal error: readline/readline.h: No such file or directory
    3 | #include <readline/readline.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <readline/readline.h>
/* end */

--------------------

have_header: checking for editline/readline.h... -------------------- no

LD_LIBRARY_PATH=.:../.. "gcc -I../../.ext/include/armv7l-linux-eabihf -I../.././include -I../.././ext/readline  -D_FILE_OFFSET_BITS=64  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef   -c conftest.c"
conftest.c:3:10: fatal error: editline/readline.h: No such file or directory
    3 | #include <editline/readline.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <editline/readline.h>
/* end */

--------------------

/root/ruby-3.1.2/ext/readline/extconf.rb:62: Neither readline nor libedit was found
    /root/ruby-3.1.2/ext/readline/extconf.rb:62:in `<top (required)>'
    ./ext/extmk.rb:214:in `load'
    ./ext/extmk.rb:214:in `block in extmake'
    /root/ruby-3.1.2/lib/mkmf.rb:332:in `open'
    ./ext/extmk.rb:210:in `extmake'
    ./ext/extmk.rb:572:in `block in <main>'
    ./ext/extmk.rb:568:in `each'
    ./ext/extmk.rb:568:in `<main>'

文件确实存在(与Raspbian 10 在同一路径):

root@raspberrypi:~/ruby-3.1.2# find / | grep readline.h$
/usr/include/readline/readline.h
/usr/include/editline/readline.h

有什么想法吗?

我删除并 re-downloaded 源代码并按预期编译! - 我不确定源代码是如何损坏的,但这就是解决方案!