[Rd] How to compile R with command completion?

Peng Yu pengyu.ut at gmail.com
Wed Sep 30 23:35:36 CEST 2009


I didn't change anything except --prefix when I compile readline. Here
is my $LD_LIBRARY_PATH which has the directory where libreadline.so is
in. I also copied 'conftest.c' to a temp dir and compiled it with
-lreadline and -lcurses (this is manual testing, not using configure).
The problem of "conftest.c:(.text+0x8): undefined reference to
`rl_completion_matches'" is resolved.

Why '-lreadline' and '-lcurses' are not in the command called by
'configure'? Is this a bug in configure? How should I fix it?

$ echo $LD_LIBRARY_PATH
/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib:/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib:/home/pengy/utility/linux/opt/gcc-4.3.4/lib64:/home/pengy/utility/linux/opt/gcc-4.3.4/lib:/home/pengy/download/linux/qtsdk-2009.03/lib:/home/pengy/utility/linux/lib64:/home/pengy/utility/linux/lib


$ cat conftest.c
/* confdefs.h.  */
#define PACKAGE_NAME "R"
#define PACKAGE_TARNAME "R"
#define PACKAGE_VERSION "2.9.2"
#define PACKAGE_STRING "R 2.9.2"
#define PACKAGE_BUGREPORT "r-bugs at R-project.org"
#define PACKAGE "R"
#define VERSION "2.9.2"
#define R_PLATFORM "x86_64-unknown-linux-gnu"
#define R_CPU "x86_64"
#define R_VENDOR "unknown"
#define R_OS "linux-gnu"
#define Unix 1
#define R_ARCH ""
#define HAVE_VISIBILITY_ATTRIBUTE 1
#define _GNU_SOURCE 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define HAVE_LIBM 1
#define HAVE_LIBDL 1
#define HAVE_READLINE_HISTORY_H 1
#define HAVE_READLINE_READLINE_H 1
#define HAVE_LIBNCURSES 1
#define HAVE_LIBREADLINE 1
#define HAVE_HISTORY_TRUNCATE_FILE 1
/* end confdefs.h.  */
#include <stdio.h>
#include <readline/readline.h>


int
main ()
{
#ifndef rl_completion_matches
  char *p = (char *) rl_completion_matches;
#endif

  ;
  return 0;
}

$ gcc -o conftest -I/home/pengy/utility/linux/opt/gcc-4.3.4/include
-I/home/pengy/utility/linux/include
-I/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/include
-I/home/pengy/utility/linux/opt/Python-2.6.2/include/python2.6
-I/home/pengy/utility/linux/opt/gcc-4.3.4/include
-I/home/pengy/utility/linux/include
-L/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib
-L/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib
-L/home/pengy/utility/linux/opt/Python-2.6.2/lib
-L/home/pengy/utility/linux/opt/gcc-4.3.4/lib64
-L/home/pengy/download/linux/qtsdk-2009.03/lib
-L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib64
-L/home/pengy/utility/linux/lib conftest.c -lreadline -ldl -lm
-lcurses

On Wed, Sep 30, 2009 at 3:47 PM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
> Peng,
>
> as you can see there is no -lreadline so I'd look further up in config.log
> to see why it's failing -- do you have LD_LIBRARY_PATH setup to match your
> custom location of libs? (Also I notice you are building x86_64 yet the
> readline you are showing is in /lib and not in /lib64 -- did you build it
> just in 32-bit?)
>
> Cheers,
> Simon
>
>
> On Sep 30, 2009, at 16:30 , Peng Yu wrote:
>
>> On Wed, Sep 30, 2009 at 9:58 AM, Simon Urbanek
>> <simon.urbanek at r-project.org> wrote:
>>>
>>> On Sep 30, 2009, at 10:13 , Peng Yu wrote:
>>>
>>>> I compiled R-2.9.2 from source on Cent OS. But the compile R program
>>>> does not support command completion.
>>>>
>>>> I get the following configure output that is related to readline. Why
>>>> 'rl_completion_matches' doesn't exist?
>>>
>>> Maybe your readline is too old? Maybe you have a readline-replacement
>>> library (e.g. libedit) that poses as readline? Try installing some recent
>>> readline (incl. -dev part) - the current version is 6.0. If that doesn't
>>> help, look at config.log around the rl_completion_matches.
>>
>> I have installed readline 6.0.
>>
>> $ ls /home/pengy/utility/linux/lib/libreadline.*
>> /home/pengy/utility/linux/lib/libreadline.a
>> /home/pengy/utility/linux/lib/libreadline.so
>> /home/pengy/utility/linux/lib/libreadline.so.6
>> /home/pengy/utility/linux/lib/libreadline.so.6.0
>> $ ls /home/pengy/utility/linux/lib/libhistory.*
>> /home/pengy/utility/linux/lib/libhistory.a
>> /home/pengy/utility/linux/lib/libhistory.so
>> /home/pengy/utility/linux/lib/libhistory.so.6
>> /home/pengy/utility/linux/lib/libhistory.so.6.0
>>
>> But R still doesn't configure it correctly. Would you please what
>> might be the problem?
>>
>> Regards,
>> Peng
>>
>> configure:22192: checking whether rl_completion_matches exists and is
>> declared
>> configure:22224: gcc -o conftest
>> -I/home/pengy/utility/linux/opt/gcc-4.3.4/include
>> -I/home/pengy/utility/linux/include
>> -I/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/include
>> -I/home/pengy/utility/linux/opt/Python-2.6.2/include/python2.6
>> -I/home/pengy/utility/linux/opt/gcc-4.3.4/include
>> -I/home/pengy/utility/linux/include
>> -L/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib
>> -L/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib
>> -L/home/pengy/utility/linux/opt/Python-2.6.2/lib
>> -L/home/pengy/utility/linux/opt/gcc-4.3.4/lib64
>> -L/home/pengy/download/linux/qtsdk-2009.03/lib
>> -L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib64
>> -L/home/pengy/utility/linux/lib conftest.c -ldl -lm  >&5
>> /home/pengy/.tmp/ccpZyEGH.o: In function `main':
>> conftest.c:(.text+0x8): undefined reference to `rl_completion_matches'
>> collect2: ld returned 1 exit status
>> configure:22230: $? = 1
>> configure: failed program was:
>> | /* confdefs.h.  */
>> | #define PACKAGE_NAME "R"
>> | #define PACKAGE_TARNAME "R"
>> | #define PACKAGE_VERSION "2.9.2"
>> | #define PACKAGE_STRING "R 2.9.2"
>> | #define PACKAGE_BUGREPORT "r-bugs at R-project.org"
>> | #define PACKAGE "R"
>> | #define VERSION "2.9.2"
>> | #define R_PLATFORM "x86_64-unknown-linux-gnu"
>> | #define R_CPU "x86_64"
>> | #define R_VENDOR "unknown"
>> | #define R_OS "linux-gnu"
>> | #define Unix 1
>> | #define R_ARCH ""
>> | #define HAVE_VISIBILITY_ATTRIBUTE 1
>> | #define _GNU_SOURCE 1
>> | #define STDC_HEADERS 1
>> | #define HAVE_SYS_TYPES_H 1
>> | #define HAVE_SYS_STAT_H 1
>> | #define HAVE_STDLIB_H 1
>> | #define HAVE_STRING_H 1
>> | #define HAVE_MEMORY_H 1
>> | #define HAVE_STRINGS_H 1
>> | #define HAVE_INTTYPES_H 1
>> | #define HAVE_STDINT_H 1
>> | #define HAVE_UNISTD_H 1
>> | #define HAVE_DLFCN_H 1
>> | #define LT_OBJDIR ".libs/"
>> | #define HAVE_LIBM 1
>> | #define HAVE_LIBDL 1
>> | #define HAVE_READLINE_HISTORY_H 1
>> | #define HAVE_READLINE_READLINE_H 1
>> | #define HAVE_LIBNCURSES 1
>> | #define HAVE_LIBREADLINE 1
>> | #define HAVE_HISTORY_TRUNCATE_FILE 1
>> | /* end confdefs.h.  */
>> | #include <stdio.h>
>> | #include <readline/readline.h>
>> |
>> |
>> | int
>> | main ()
>> | {
>> | #ifndef rl_completion_matches
>> |   char *p = (char *) rl_completion_matches;
>> | #endif
>> |
>> |   ;
>> |   return 0;
>> | }
>> configure:22248: result: no
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
>



More information about the R-devel mailing list