Dear Federico,

    I just got a similar email from someone using mingw/msys.  He built a dll (I always used a
static library). He had the same problem; but he solved it copying gsl.dll into the
python directory.

In my opinion gsl.dll should be installed in the %Systemroot%\system32\ directory (this
is typically c:\windows\system32\.

I do not know if then the library has to use __stdcall instead of _cdecl ...
Could you give it a try?

Sincerely yours

Dear Pierre,

I confused names - the guide was not written by Brad Chapan, but by Brian Gladman, and it is available over here:

however, I realized that trying to use libraries compiled with Visual Studio 2010 against minGW might not work as well as I'd like, so I just downloaded msys for minGW, and compiled the GSL with minGW using msys, and that went smoothly.

After doing that, I obtained a 'normal' directory structure, and I was able to build pyGSL fine, so the installation went well.

After the installation, I tried following the readme file directions and changed to the /tests directory, and ran:

python - and got the following message:


Did you try to import pygsl in the build directory?

Well, that does not work out of the box. If you want to do that, please
      python build_ext -i
to add the necessary extension module in the local pygsl/ directory!

Please read the README first! Any further questions or missing information
please post to!

Traceback (most recent call last):
  File "", line 69, in <module>
  File "", line 47, in run
    import pygsl
  File "C:\Python27\lib\site-packages\pygsl\", line 57, in <module>
    import pygsl.init
ImportError: DLL load failed: The specified module could not be found.


I wasn't in the directory, but I tried to fix it by doing:

python build_ext -i

as reccomanded, then repeating the command.  This runs fine with no errors/bugs, but doesn't fix the problem, I get the same error about missing DLL.

Is there a PATH file that is not set or what exactly is the DLL that the program is failing to run?


On Wed, Mar 2, 2011 at 9:56 AM, Pierre SCHNIZER <> wrote:
Dear Federico,

> After extensive googling, I managed to compile the GSL libraries on windows using Visual Studio 2010 with Brad Chapman's excellent guide.
Congratulation... Compiling on windows is a story of itself ...
Please can you post a link to the guide you mention above?

Unfortunately I have not access to the compiler (and currently not even to a
windows machine) so I can only give you hints to success.

A first point: blanks separate arguments to commands in command line tools,
parantheses, brackets, braces have special meanings. So these can create
extra headache if you have them in the name of the pathes; for a first run
I would try to avoid them.
Further try to type the command that fails in the shell (using copy; if
you use the dos shell, set it to quick edit mode; it is still painfull, but
the pain is a little less)

The library resides in:

C:\Program Files (x86)\gsl-1.14

and the directory structure looks like this: (apologies about the spam)

Better too much than too little info ... ;-)

¦   +---gslhdrs
¦   ¦   +---Win32
¦   ¦       +---Debug
Can you have a look,in these directories and look for the *.h files?
Are they there

The actual compiled directory files are here:
C:\Program Files (x86)\gsl-1.14\build.vc10\lib\Win32\Debug>dir
 Volume in drive C is OS
 Volume Serial Number is CA49-670D

 Directory of C:\Program Files (x86)\gsl-1.14\build.vc10\lib\Win32\Debug

06/02/2011  17:10 <DIR>          .
06/02/2011  17:10 <DIR>          ..
06/02/2011  17:10         1,113,268 cblas.lib
06/02/2011  17:10            61,440 cblas.pdb
06/02/2011  17:10        17,849,866 gsl.lib
06/02/2011  17:10           266,240 gsl.pdb
              4 File(s)     19,290,814 bytes
              2 Dir(s)  172,105,408,512 bytes free
Fine, but where did it put the include files? Is there a standard
directory? The unix makes files of GSL include a link command to the
include directory, executed at the beginning of the build. What has
happend to them in your build?

Now - how do I set up the file?

My best guess, was something like this:

# Some systems do not provide gsl-config. So here the locations can be entered
# by hand.
import os

# The path to the directory where gsl is installed. Currently assumes
# that the include files are located in "prefix/include".
prefix = os.path.join("C:\\", "Program Files (x86)", "gsl-1.14")

So this is the way to write it for gcc:
The flag -I is the way to specify a include directory (just to make sure) -g is the debug flag

cflags = "-g -I" + os.path.join(prefix, "include")
So I guess in your case it should be
   cflags = "/I" + os.path.join(prefix, "gslhdrs", "Win32", "Debug")
Use some find tool and search for the .h files in the source directory...

building 'errno' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
rogram Files (x86)\gsl-1.14\include" -IInclude -I. -IC:\Python27\lib\site-packag
es\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tcsrc/init/errorno
.c /Fobuild\temp.win32-2.7\Release\src/init/errorno.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex
cl : Command line warning D9025 : overriding '/DNDEBUG' with '/UNDEBUG'
src/init/errorno.c(6) : fatal error C1083: Cannot open include file: 'gsl/gsl_er
rno.h': No such file or directory
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe
-UNDEBUG -I"C:\Program Files (x86)\gsl-1.14\include" -IInclude -I. -IC:\Python27
\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tc
src/init/errorno.c /Fobuild\temp.win32-2.7\Release\src/init/errorno.obj" failed
with exit status 2

which obviously means the compilation fails to find gsl_erno.h
Right.  As stated above, try to find the directory of the header files.
Then it should work. Please come back if it does not.

Sincerely yours

GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1
D-64291 Darmstadt

Gesellschaft mit beschränkter Haftung
Sitz der Gesellschaft: Darmstadt
Handelsregister: Amtsgericht Darmstadt, HRB 1528

Geschäftsführung: Professor Dr. Dr. h.c. Horst Stöcker, Dr. Hartmut Eickhoff
Vorsitzende des Aufsichtsrates: Dr. Beatrix Vierkorn-Rudolph
Stellvertreter: Ministerialdirigent Dr. Rolf Bernhardt