[MMTK] Loading minimizer crashes python

Robin Maytum R.M.Maytum at kent.ac.uk
Mon Aug 11 20:29:04 EDT 2003

Michiel wrote:

> On Mac OS X, netlib installed by fink is not found by ScientificPython's
> setup.py file. This causes Python to crash due to a bus error when
> importing some MMTK modules. I ran into the same problem earlier today;
> the solution was to edit the setup.py file and add the location where to
> find netlib. I wouldn't be surprised if it has problems finding netlib
> on Windows machines also. 

This seems to be the problem - netcdf was not found and complied along with
Scientific Python. 

> So I would suggest to check ScientificPython's
> setup.py and make sure it can find the right location for netlib. If it
> does, you will notice that some C files get compiled when building
> ScientificPython, in addition to the Python files.

So I tried moving netcdf to a subdirectory of scientificpython and then editing
setup.py to include 

netcdf_prefix = "netcdf"

The problem I then find is that it falls over as it calls cl.exe (MS VC++
compiler) to compile the netcdf files when I have been using mingw32 (gcc) to
try and compile the rest of the installation.

C:\ScientificPython-2.4.3>python setup.py install

running build_ext
building 'Scientific_netcdf' extension
cl.exe /c /nologo /Ox /MD /W3 /GX -IInclude -Inetcdf\include -Ic:\python22\inclu
de /TcSrc/Scientific_netcdf.c /Fobuild\temp.win32-2.2\Release\Scientific_netcdf.
error: command 'cl.exe' failed: No such file or directory

So I then tried building seting the compiler to mingw32

c:\scientificpython>python setup.py build --compiler=mingw32

But this then produces an error with dllwrap :-

running build_ext
building 'Scientific_netcdf' extension
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IInclude -Inetcdf\include -Ic:\
python22\include -c Src/Scientific_netcdf.c -o build\temp.win32-2.2\Release\scie
Src/Scientific_netcdf.c:571: warning: static declaration for `netcdf_file_init'
follows non-static
Src/Scientific_netcdf.c:1076: warning: static declaration for `netcdf_variable_n
ew' follows non-static
Src/Scientific_netcdf.c: In function `PyNetCDFVariable_WriteArray':
Src/Scientific_netcdf.c:1536: warning: `lastloop' might be used uninitialized in
 this function
writing build\temp.win32-2.2\Release\Scientific_netcdf.def
c:\mingw\bin\dllwrap.exe -mno-cygwin -mdll -static --entry _DllMain at 12 --output-
lib build\temp.win32-2.2\Release\libScientific_netcdf.a --def build\temp.win32-2
.2\Release\Scientific_netcdf.def -s build\temp.win32-2.2\Release\scientific_netc
df.o -Lnetcdf\lib -Lc:\python22\libs -lnetcdf -lpython22 -o build\lib.win32-2.2\
c: undefined reference to `_imp__ncerr'
.c: undefined reference to `_imp__ncopts'
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1

I presume somebody must have come across this before and got ScientificPython to
compile the netcdf extensions correctly under W2k ?

Thanks for your help !


Dr. Robin Maytum, Dept. Biosciences, University of Kent, Canterbury, UK

More information about the mmtk mailing list