lua.c:82:31: fatal error: readline/readline.h: No such file or directory

安装lua报错

gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX    -c -o linit.o linit.c
ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
ranlib liblua.a
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX    -c -o lua.o lua.c
lua.c:82:31: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
                               ^
compilation terminated.
make[2]: *** [lua.o] Error 1
make[2]: Leaving directory `/opt/lua-5.3.4/src'
make[1]: *** [linux] Error 2
make[1]: Leaving directory `/opt/lua-5.3.4/src'
make: *** [linux] Error 2

解决方法:

[root@iZ1la3d1xbmukrZ lua-5.3.4]# yum install readline-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                                               | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                   | 3.5 kB  00:00:00
epel                                                                                                                               | 5.4 kB  00:00:00
extras                                                                                                                             | 2.9 kB  00:00:00
nginx-stable                                                                                                                       | 2.9 kB  00:00:00
updates                                                                                                                            | 2.9 kB  00:00:00
(1/3): epel/x86_64/updateinfo                                                                                                      | 1.0 MB  00:00:00
(2/3): epel/x86_64/primary_db                                                                                                      | 6.7 MB  00:00:00
(3/3): updates/7/x86_64/primary_db                                                                                                 | 6.7 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package readline-devel.x86_64 0:6.2-11.el7 will be installed
--> Processing Dependency: ncurses-devel for package: readline-devel-6.2-11.el7.x86_64
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================
 Package                                Arch                           Version                                         Repository                    Size
==========================================================================================================================================================
Installing:
 readline-devel                         x86_64                         6.2-11.el7                                      base                         139 k
Installing for dependencies:
 ncurses-devel                          x86_64                         5.9-14.20130511.el7_4                           base                         712 k

Transaction Summary
==========================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 851 k
Installed size: 2.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): readline-devel-6.2-11.el7.x86_64.rpm                                                                                        | 139 kB  00:00:00
(2/2): ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm                                                                              | 712 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                     5.6 MB/s | 851 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                                                                             1/2
  Installing : readline-devel-6.2-11.el7.x86_64                                                                                                       2/2
  Verifying  : readline-devel-6.2-11.el7.x86_64                                                                                                       1/2
  Verifying  : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                                                                             2/2

Installed:
  readline-devel.x86_64 0:6.2-11.el7

Dependency Installed:
  ncurses-devel.x86_64 0:5.9-14.20130511.el7_4

Complete!
[root@iZ1la3d1xbmukrZ lua-5.3.4]# make linux test
cd src && make linux
make[1]: Entering directory `/opt/lua-5.3.4/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
make[2]: Entering directory `/opt/lua-5.3.4/src'
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX    -c -o lua.o lua.c
gcc -std=gnu99 -o lua   lua.o liblua.a -lm -Wl,-E -ldl -lreadline
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX    -c -o luac.o luac.c
gcc -std=gnu99 -o luac   luac.o liblua.a -lm -Wl,-E -ldl -lreadline
make[2]: Leaving directory `/opt/lua-5.3.4/src'
make[1]: Leaving directory `/opt/lua-5.3.4/src'
src/lua -v
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
[root@iZ1la3d1xbmukrZ lua-5.3.4]# make install
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.3 /usr/local/lib/lua/5.3
cd src && install -p -m 0755 lua luac /usr/local/bin
cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp /usr/local/include
cd src && install -p -m 0644 liblua.a /usr/local/lib
cd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1
[root@iZ1la3d1xbmukrZ lua-5.3.4]# lu
lua       luac      luseradd  luserdel  lusermod
[root@iZ1la3d1xbmukrZ lua-5.3.4]# lua -v
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
[root@iZ1la3d1xbmukrZ lua-5.3.4]#

猜你喜欢

转载自www.cnblogs.com/dalianpai/p/12370098.html