[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] Compile Problems

From: Feuerbacher, Alan
Subject: [Bug-readline] Compile Problems
Date: Tue, 23 Aug 2011 18:02:24 +0000



This is the first time I’ve posted to this list, so please bear with me. If this is not the appropriate forum for the questions below, please let me know where to find the answers.


I’ve compiled readline-6.2 with gcc-4.6.1 . Also ncurses-5.9. For some reason, when I compile a short test program (or any other program) that uses readline, the shared library libreadline.so.6 is not found. I’ve tried everything I know (but my experience compiling GNU stuff is limited) to no avail.


The test program rtst.c is:


#include <stdio.h>




#include "<directory-where-programs-are-installed>/include/readline/readline.h"

#include "<directory-where-programs-are-installed>/include/readline/history.h"




  char *line = readline ("Enter a line: ");




I compiled it with:


gcc -o rtst rtst.c -I<directory-where-programs-are-installed>/include  -L<directory-where-programs-are-installed>/lib -lreadline -lncurses



ldd rtst produces this:


        libreadline.so.6 => not found

        libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x00000037d0000000)

        libc.so.6 => /lib64/libc.so.6 (0x00000037bce00000)

        libdl.so.2 => /lib64/libdl.so.2 (0x00000037bd600000)

        /lib64/ld-linux-x86-64.so.2 (0x00000037bca00000)



This tells me that, for whatever reason, gcc is not using the directories where I've installed readline and ncurses.


What am I doing wrong?


Note that it took some experimentation to find that I had to put "#define READLINE_LIBRARY" in the test program. If I remove it, the #include's in readline/readline.h point to the system library to find the other include files, rather than to my own library, but my company's system does not have readline libraries and the compile fails.


Is there a better way to handle this?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]