开发者

Trouble building sqlite 3.7.4 on CentOS 5.5 to include readline support

开发者 https://www.devze.com 2023-02-03 20:39 出处:网络
The readline library allows the CLI for sqlite to accept arrow keys to recall previously typed commands. I can build without this and sqlite works, it\'s just a hassle not having this nice capability.

The readline library allows the CLI for sqlite to accept arrow keys to recall previously typed commands. I can build without this and sqlite works, it's just a hassle not having this nice capability. I've installed readline-devel from yum and /usr/lib64/libreadline.so.5 is present as well as it's header files. When I run ./configure to build sqlite, I see these lines:

checking for library containing readline... no
checking for readline... no

The library path is set to the correct path:

LD_LIBRARY_PATH="/usr/lib64:/usr/local/lib:/lib:/usr/lib"

By default, ./configure does try to include readline support so there are no special "--with-XXXX" options needed.

Anyone every seen this problem? I need to use this newer version to get latest foreign key support. It's hassle running on CentOS as is bundles pretty old versions of apps but we don't have a choice right now and I cannot find an updated RPM with newer version of sqlite.

=== UPDATE ===

Ok, I found a solution but I don't completely like it...

First, I tried with this option:

./configure CPPFLAGS="-I/usr/include/ -DHAVE_READLINE"

That causes the readline functionality to get compiled into shell.c which is what is needed for starters. But, the linking fails because it cannot find libreadline. The only 'kludgy' way I could figure out to get it to link was to manually edit the Makefile after running the above ./configure command. I changed this line:

LIBS = -ldl -lpthread

to this:

LIBS = -ldl -lpthread -lreadline -ltermcap

Then I ran "make clean all" and "make install" and the readline functionality works in the CLI.

I tried every way I could think of to pass in the extra libraries including exporting using LIBS, exporting using READLINE_LIBS, exporting using LDFLAGS, nothing would work. If you set LIBS to anything, like "export LIBS="-lreadline", it causes configure to fail. The --help on configure about using LIBS seems to contradict what happens when you actually set it to any value.

Anyway, this works so I can live with it - but I don't particularly like it! :(

==== THE RIGHT SOLUTION ====

Well, wouldn't you know it. Spend hours trying to figure it out, then stumble onto the right tip on Google. Just needed to install ncurses-devel first. So, to summarize all that is needed to built it 'unkludgily':

yum install ncurses ncurses-devel 
yum install readline readline-devel 
yum install 开发者_如何学编程libtermcap libtermcap-devel
./configure
make
make install

No special command line options or exports or Makefile edits needed! Readline support is automatically built in by default now.

0

精彩评论

暂无评论...
验证码 换一张
取 消