1

I was running make and encountered the following error:

gawk: error while loading shared libraries: libreadline.so.4: cannot open shared object file: No such file or directory
config.status: error: could not create mjson.pc
Reaping losing child 0x564b30cbed70 PID 48255
make[1]: *** [Makefile:44: libmjson] Error 1
Removing child 0x564b30cbed70 PID 48255 from chain.
make[1]: Leaving directory '/home/minipc/econet/apps/public/libjson-1.5'

The libreadline.so.4 is too old to install in my current Linux machine (Ubuntu 20.04). So instead I installed libreadline.so.8, and created a symbolic link to libreadline.so.4. And I checked, it works:

lrwxrwxrwx 1 root root     25 Aug 12 21:17 /lib32/libreadline.so.4 -> /lib32/libreadline.so.8.0
lrwxrwxrwx 1 root root     18 Feb 25  2020 /lib32/libreadline.so.8 -> libreadline.so.8.0
-rw-r--r-- 1 root root 311884 Feb 25  2020 /lib32/libreadline.so.8.0

And the relevant part in Makefile is the following:

./configure  --prefix=/home/minipc/econet/apps/public/libjson-1.5 --libdir=/lib32 --includedir=/lib32 --disable-static --enable-shared \ 

And I checked it in the console output when running the make.

So why it still can't find libreadline.so.4? Is it because libreadline.so.8.0 too new to be linked by libreadline.so.4 so the program doesn't recognize it?

Also, when I run

$ ldconfig -p|grep libreadline
        libreadline.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libreadline.so.8
        libreadline.so.8 (libc6) => /lib32/libreadline.so.8
        libreadline.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libreadline.so.5

Only libreadline.so.5 and libreadline.so.4 appears. So the softlink would not be recognized by the system?

li_jessen
  • 49
  • 6
  • 1
    Why do you have a relatively modern system but such an old implementation of `gawk` that it was built with a very old readline? The standard `gawk` that comes with Ubuntu 20.04 is built with `libreadline.so.8`. So I think you are trying to solve the wrong problem: rather than trying to install a very old version of libreadline you should be trying to figure out where this ancient and broken version of `gawk` came from, and getting rid of that or at least removing it from your `PATH` so it's not found. What does `type -a gawk` show? – MadScientist Aug 14 '22 at 17:02
  • Thanks for your tips. I have updated the gawk and solved the issue. – li_jessen Aug 15 '22 at 02:10

1 Answers1

1

The libreadline.so.8 maybe too new to be used as the source of symbolic link of libreadline.so.4. Or it may need to be in another directory such as /lib to be linked by gawk.

I try $gawk return command not found . Then I run $sudo apt install gawk and check the gawk is of version GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0). I run $make again and found the same error.

Then I try $export $AWKPATH and find out that there is another path to store the gawk bin. Then I enter the directory and run $gawk, the same error pop out. I copy the /usr/bin/gawk ( the newly installed gawk) to update the gawk in the directory, and then run $gawk, it is the newest one.

Then I run $make again and the issue got solved.

li_jessen
  • 49
  • 6