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

I am trying to compile Ruby and I am getting the following:

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#

However I do have both installed:

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.

This works as expected on Raspbian 10, but not sure why it isn't working on 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

Also relevant parts of ext/readline/mkmf.log (towards the bottom) shows the following:

...
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>'

The files definitely exist (in the same path as Raspbian 10):

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

Any ideas?



Solution 1:[1]

I deleted and re-downloaded the source code and it compiled as expected! - I am not sure how the source code managed to get corrupt, but that was the solution!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hackeron