Python Cygwin ld return 1 exit status Error

View: New views
2 Messages — Rating Filter:   Alert me  

Python Cygwin ld return 1 exit status Error

by govind@mangotechno.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am creating glue between Python and C using swig..
After preparing interface file, I  executed following three steps on cygwin-

step 1. swig -python example.i
step 2. gcc -fpic -c example.c example_wrap.c
-I/usr/local/include/python2.4/
step 3. gcc -shared example.o example_wrap.o -o _example.so

It successfully run first two steps.. But while executing third and
final steps..
It is displaying list of errors for undefined reference for Python
Objects.. errors listed below
-----------------------------------------------------------------------------------------
example_wrap.o:example_wrap.c:(.text+0x3326): undefined reference to
`__imp__PyE
xc_NameError'
example_wrap.o:example_wrap.c:(.text+0x3330): undefined reference to
`_PyErr_Set
String'
example_wrap.o:example_wrap.c:(.text+0x33f0): undefined reference to
`__imp__PyT
ype_Type'
example_wrap.o:example_wrap.c:(.text+0x3424): undefined reference to
`_PyObject_
Malloc'
example_wrap.o:example_wrap.c:(.text+0x3430): undefined reference to
`_PyObject_
Init'
example_wrap.o:example_wrap.c:(.text+0x35f4): undefined reference to
`_PyDict_Se
tItemString'
example_wrap.o:example_wrap.c:(.text+0x38bd): undefined reference to
`_Py_InitMo
dule4'
example_wrap.o:example_wrap.c:(.text+0x38cb): undefined reference to
`_PyModule_
GetDict'
example_wrap.o:example_wrap.c:(.data+0x1a0): undefined reference to
`_PyObject_G
enericGetAttr'
collect2: ld returned 1 exit status

Mango_5@mango-5 /usr/local/govind/temp
$
----------------------------------------------------------------------------------------------
Swig Version : 1.3.29    (as shown at cygwin prompt)
Python Version :  Python2.6.4


Please anyone help me or guide me to get somewhere..

Thanks and regards
Govind.




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Python Cygwin ld return 1 exit status Error

by Josh Cherry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, 10 Nov 2009, Govind wrote:

> I am creating glue between Python and C using swig..
> After preparing interface file, I  executed following three steps on cygwin-
>
> step 1. swig -python example.i
> step 2. gcc -fpic -c example.c example_wrap.c
> -I/usr/local/include/python2.4/
> step 3. gcc -shared example.o example_wrap.o -o _example.so
>
> It successfully run first two steps.. But while executing third and
> final steps..
> It is displaying list of errors for undefined reference for Python
> Objects.. errors listed below

This suggests that under cygwin you need to link against the Python
library, or perhaps just give gcc some option to make it not complain
about missing symbols (preferable, if it works).

Josh


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user