Subject: Problem building python extensions
From: "Darrell R. Hougen" <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 25 Sep 2001 15:42:05 -0600

Hi,

I'm new to using cygwin to build python extension modules and am having
a fair bit of trouble.  I can build the extension module under Solaris,
but when I try to build under cygwin, I get the following errors:

gcc -s -Wl,--base-file,Term.base -o Term.dll Term.o -Wl,-e,_Term_init@12
/cygdrive/c/ENT/APPL/PROD/Python21/libs/*.lib
Term.o: In function `TermObject_Evaluate':
/...path.../Term.c:195: undefined reference to `PyExc_RuntimeError'
Term.o: In function `TermObject_Gradient':
/...path.../Term.c:266: undefined reference to `PyExc_RuntimeError'
Term.o: In function `Term_init':
/...path.../Term.c:505: undefined reference to `PyCObject_Type'
Term.o: In function `TermSetParameters':
/...path.../Term.c:29: undefined reference to `PyType_Type'
/usr/lib/libcygwin.a(libcmain.o): In function `main':
/cygnus/netrel/src/cygwin-1.3.3-2/winsup/cygwin/lib/libcmain.c:31:
undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
make: *** [Term.dll] Error 1

The funny looking gcc line at the top is copied straight out of the
cygwin documentation for building dlls.

When I look for PyExc_RuntimeError, PyCObject_Type and PyType_Type, I
can't find a definition of them anywhere.  They are declared but not
defined.  Yet, the code compiles unders Solaris.

Actually, I'm wondering why linker is attempting to link the code at
all.  It appears to me that a .dll file or a .a file under windows ought
be be similar to a .so under Solaris, i.e., it should be a library that
does indeed have some undefined symbols.  But cygwin's gcc isn't
allowing me to have undefined symbols.  I'm guessing that python somehow
takes care of the undefined symbols at the moment it dynamically links
the library.  But I'm not getting that far.  BTW, what does the -s
option to gcc do?  It doesn't seem to be documented.

I am using active state python 2.1 and gcc 2.95.3-5 on an NT 4.0 box.  I
downloaded the version of cygwin that I'm using only yesterday, so it
should be up to date.

Thanks.

Darrell

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/