Linked vs. libpython.a (Linux)

Thomas Wouters thomas at
Fri Nov 3 09:59:09 CET 2000

On Fri, Nov 03, 2000 at 02:22:32AM -0500, Jp Calderone wrote:

>  I'm trying to embed the python interpreter into 
> an app but I'm having problems getting the linker
> to go... Here's what I get in final stages of 
> compile:

> /usr/local/lib/libpython.a(posixmodule.o): In function `posix_openpty':
> /usr/src/Python-2.0/Modules/./posixmodule.c:1698: undefined reference to
> `openpty'
> /usr/local/lib/libpython.a(posixmodule.o): In function `posix_forkpty':
> /usr/src/Python-2.0/Modules/./posixmodule.c:1729: undefined reference to
> `forkpty'
> collect2: ld returned 1 exit status

> Linker flags I'm using now are  `-lcrypt -lpthread 
> -lxml -lz -lpython -lreadline -ldb -ldl' (Not all 
> in connection to python).  All sources I've been able
> to find suggest that openpty() and forkpty() are in
> libc... but even with the redundant -lc flag it won't
> link correctly.  Am I missing something, or is my system
> screwed up?

forkpty() and openpty() might live in the libutil library. Python's
configure will have said so, if this is the case, and indeed on my Debian
(woody) and on my RedHat (7.0) installations, it is.

Also keep in mind that for GNU software, 'info' is preferred over 'man', and
as such, there is no man page for openpty or forkpty :P You can find the
information you need with 'info libc', and then 's' (for search) 'openpty':

Opening a Pseudo-Terminal Pair

   These functions, derived from BSD, are available in the separate
`libutil' library, and declared in `pty.h'.

 - Function: int openpty (int *AMASTER, int *ASLAVE, char *NAME, struct
          termios *TERMP, struct winsize *WINP)
     This function allocates and opens a pseudo-terminal pair,

Thomas Wouters <thomas at>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

More information about the Python-list mailing list