[SciPy-user] Compile ALGENCAN on windows

fdu.xiaojf@gmai... fdu.xiaojf@gmai...
Tue Sep 18 06:19:33 CDT 2007


Hi all,

I tried to add parameter "-mno-cygwin" to gcc and g77, and it worked
except the last step.

According to the "Quick Start" part in
http://www.ime.usp.br/%7Eegbirgin/tango/py.php,
"""
Quick start

1)	Copy the 7 files above.

2)	Compile typing make or, manually, typing

g77 -O4 -c -fPIC -xf77-cpp-input algencan.f

gcc -O4 -c -fPIC -Df2cFortran -I$PYTHONDIR 
-I$PYTHONLIB/site-packages/numpy/core/include pywrapper.c

g77 -O4 -shared pywrapper.o algencan.o -o pywrapper.so

3)	Run typing python algencanma.py.

4)	If everything was ok, the output in the screen should be very similar to 
the content of the file algencan.out that comes with ALGENCAN.

5)	Modify the toyprob.py file to solve your own problem.

Obs1:	To use this interface you need to have downloaded ALGENCAN.

Obs2:	It is assumed that (i) packages python, python-dev, python-numpy and 
python-numpy-dev are installed; that (ii) the environment variable PYTHONDIR 
points to the directory containing the include files needed for developing 
Python extensions and embedding the interpreter (for example, 
/usr/include/python2.5); and that (iii) the environment variable PYTHONLIB 
points to the directory containing the standard Python modules (for example, 
/usr/lib/python2.5).
"""

Here is the commonds I have run and the output:

$ export PYTHONDIR=d:/programs/python25/include

$ export PYTHONLIB=d:/programs/python25/Lib

$ g77 -mno-cygwin -O4 -c -fPIC -xf77-cpp-input algencan.f
algencan.f:0: warning: -fPIC ignored for target (all code is position independent)
/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/cc6oThyQ.f:0: warning: -fPIC
ignored for target (all code is position independent)

$ gcc -mno-cygwin -O4 -c -fPIC -Df2cFortran -Id:/programs/python25/include
-ID:/programs/python25/Lib/site-packages/numpy/core/include pywrapper.c
pywrapper.c:1: warning: -fPIC ignored for target (all code is position
independent)

$ g77 -mno-cygwin -O4 -shared pywrapper.o algencan.o -o pywrapper.so
pywrapper.o:pywrapper.c:(.text+0x2f): undefined reference to
`__imp__Py_InitModule4'
pywrapper.o:pywrapper.c:(.text+0x3c): undefined reference to
`__imp__PyImport_ImportModule'
pywrapper.o:pywrapper.c:(.text+0x54): undefined reference to
`__imp__PyObject_GetAttrString'
pywrapper.o:pywrapper.c:(.text+0x64): undefined reference to
`__imp__PyCObject_Type'
pywrapper.o:pywrapper.c:(.text+0x92): undefined reference to `__imp__PyErr_Print'
pywrapper.o:pywrapper.c:(.text+0x97): undefined reference to
`__imp__PyExc_ImportError'
pywrapper.o:pywrapper.c:(.text+0xab): undefined reference to
`__imp__PyErr_SetString'
pywrapper.o:pywrapper.c:(.text+0xbb): undefined reference to
`__imp__PyCObject_AsVoidPtr'
pywrapper.o:pywrapper.c:(.text+0xee): undefined reference to
`__imp__PyExc_RuntimeError'
pywrapper.o:pywrapper.c:(.text+0xf9): undefined reference to `__imp__PyErr_Format'
pywrapper.o:pywrapper.c:(.text+0x497): undefined reference to
`__imp__PyExc_ValueError'
pywrapper.o:pywrapper.c:(.text+0x4ab): undefined reference to
`__imp__PyErr_SetString'
pywrapper.o:pywrapper.c:(.text+0x59a): undefined reference to
`__imp__PyExc_ValueError'
pywrapper.o:pywrapper.c:(.text+0x5ae): undefined reference to
`__imp__PyErr_SetString'
pywrapper.o:pywrapper.c:(.text+0x5e2): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0x630): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0x9ea): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0xa18): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0xb93): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0xbcf): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0xdb3): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0xde8): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0xf8c): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0xfb3): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0x10fc): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0x1138): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0x1306): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0x132d): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0x14a5): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0x14cc): undefined reference to
`__imp__PyArg_ParseTuple'
pywrapper.o:pywrapper.c:(.text+0x1743): undefined reference to
`__imp__PyEval_CallFunction'
pywrapper.o:pywrapper.c:(.text+0x18ee): undefined reference to
`__imp__PyDict_Type'
pywrapper.o:pywrapper.c:(.text+0x1903): undefined reference to
`__imp__PyType_IsSubtype'
pywrapper.o:pywrapper.c:(.text+0x1922): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x192e): undefined reference to
`__imp__PyBool_Type'
pywrapper.o:pywrapper.c:(.text+0x193c): undefined reference to
`__imp__PyExc_ValueError'
pywrapper.o:pywrapper.c:(.text+0x1947): undefined reference to
`__imp__PyErr_SetString'
pywrapper.o:pywrapper.c:(.text+0x1962): undefined reference to
`__imp___Py_TrueStruct'
pywrapper.o:pywrapper.c:(.text+0x1984): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x198d): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1998): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x19b4): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x19bd): undefined reference to
`__imp__PyFloat_AsDouble'
pywrapper.o:pywrapper.c:(.text+0x19c8): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x19ea): undefined reference to
`__imp__PyExc_TypeError'
pywrapper.o:pywrapper.c:(.text+0x1a3d): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1a46): undefined reference to
`__imp__PyFloat_AsDouble'
pywrapper.o:pywrapper.c:(.text+0x1a51): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1a6d): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1aa0): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1aa9): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1ab4): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1af5): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1afe): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1b09): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1b33): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1b3c): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1b47): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1b70): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1b79): undefined reference to
`__imp__PyString_AsString'
pywrapper.o:pywrapper.c:(.text+0x1bc1): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1bc7): undefined reference to
`__imp__PyBool_Type'
pywrapper.o:pywrapper.c:(.text+0x1be0): undefined reference to
`__imp___Py_TrueStruct'
pywrapper.o:pywrapper.c:(.text+0x1c03): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1c0c): undefined reference to
`__imp__PyFloat_AsDouble'
pywrapper.o:pywrapper.c:(.text+0x1c17): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1c3c): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1c45): undefined reference to
`__imp__PyFloat_AsDouble'
pywrapper.o:pywrapper.c:(.text+0x1c50): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1c7a): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1c83): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1c8e): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1cb7): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1cc0): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1ccb): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1cfa): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1d03): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1d0e): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1d2d): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1d36): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1d41): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1d66): undefined reference to
`__imp__PyDict_GetItemString'
pywrapper.o:pywrapper.c:(.text+0x1d6f): undefined reference to
`__imp__PyInt_AsLong'
pywrapper.o:pywrapper.c:(.text+0x1d7a): undefined reference to
`__imp__PyErr_Occurred'
pywrapper.o:pywrapper.c:(.text+0x1db0): undefined reference to
`__imp___Py_NoneStruct'
pywrapper.o:pywrapper.c:(.text+0x1df6): undefined reference to
`__imp__PyDict_Type'
pywrapper.o:pywrapper.c:(.text+0x1dff): undefined reference to
`__imp__PyFunction_Type'
pywrapper.o:pywrapper.c:(.text+0x1e7f): undefined reference to
`__imp__PyArg_ParseTuple'
collect2: ld returned 1 exit status

Those undefined references __imp__* do reside in
D:/programs/python25/libs/libpython25.a
and D:/programs/python25/libs/python25.lib, so I tried to add the path to ld.

$ g77 -mno-cygwin -LD:/programs/Python25/libs -lpython25 -O4 -shared
pywrapper.o algencan.o -o pywrapper.so
pywrapper.o:pywrapper.c:(.text+0x2f): undefined reference to
`__imp__Py_InitModule4'
<snip....>
pywrapper.o:pywrapper.c:(.text+0x1dff): undefined reference to
`__imp__PyFunction_Type'
pywrapper.o:pywrapper.c:(.text+0x1e7f): undefined reference to
`__imp__PyArg_ParseTuple'
collect2: ld returned 1 exit status

But it didn't work.

I'm quite sure ALGENCAN can be built with MinGW now.
Could somebody give me some hints on how to build it ?

Thanks.

Xiao Jianfeng







More information about the SciPy-user mailing list