python 2.0, cygwin & readline - undefined symbols

Jason Tishler Jason.Tishler@dothill.com
Wed Feb 21 18:53:00 GMT 2001


Dave,

On Wed, Feb 21, 2001 at 05:45:06PM -0800, David Peterson wrote:
> I'm trying to get python 2.0 to compile under the latest cygwin/readline
> combo, but am getting unexplainable (to me at least) linker errors.

My suggestion is to use 2.1a2 as it supports Cygwin *much* better than
previous versions.  See the following for details:

    http://www.cygwin.com/ml/cygwin-apps/2001-02/msg00004.html

Note that a patch has been accepted into Python CVS that solves the
problem below.  However, if you really need to use 2.0, then read on...

> I uncommented the line in python's Modules/Setup file to add the readline
> module and get the following when trying to build:
> 
> gcc   python.o \
>           ../libpython2.0.a -lreadline -ltermcap
> -lm  -o python.exe 
> ../libpython2.0.a(readline.o)(.text+0x949): undefined reference to
> `rl_event_hook'
> Any idea what's up?

The above is due to the "incorrect" declaration of rl_event_hook in
Modules/readline.c:

    extern Function *rl_event_hook;

I used quotes above, because the declaration is fine if you use a
static version of the readline library.  The readline provided with
Cygwin defaults to using the DLL version unless you supply a special
"-D" option during your build.

You can solve your problem with the following change:

    extern DL_IMPORT(Function) *rl_event_hook;

Although, the better way to fix this and the way that it is in the current
Python CVS, is to use include readline/history.h as in the following:

#ifdef __CYGWIN__
#include <readline/history.h>
#else /* !__CYGWIN__ */
extern int rl_parse_and_bind(char *);
extern int rl_read_init_file(char *);
extern int rl_insert_text(char *);
extern int rl_bind_key(int, Function *);
extern int rl_bind_key_in_map(int, Function *, Keymap);
extern int rl_initialize(void);
extern int add_history(char *);
extern int read_history(char *);
extern int write_history(char *);
extern int history_truncate_file(char *, int);
extern Function *rl_event_hook;
#endif /* !__CYGWIN__ */
#endif

Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list