in reply to Math::GSL installation on Windows XP

What am I missing?

Well ... it's not finding the gsl headers.
The only way I can get it to build on Windows is to set CPATH to the directory that contains gsl/gsl_nan.h (*not* the directory that contains gsl_nan.h), and set LIBRARY_PATH to the directory that contains the gsl libraries.

That CPATH setting will do the trick for you, too, but for the LIBRARY_PATH setting to work, you might (not sure) also need to modify perl/lib/ExtUtils/Liblist/Kid.pm. If you look in that file, you'll find the following code:
if ($VC and exists $ENV{LIB} and $ENV{LIB}) { push @libpath, split /;/, $ENV{LIB}; }
Immediately below that insert:
if ($GC and exists $ENV{LIBRARY_PATH} and $ENV{LIBRARY_PATH}) { push @libpath, split /;/, $ENV{LIBRARY_PATH}; }
Alternatively, you could probably just alter the libpth setting in lib/Config_heavy.pl to include the directory that contains the gsl library files.

It should then build for you - though I'm a little concerned about the structure of your gsl library. You say that gsl_nan.h and friends is in GSL_DIR/gsl, but that GSL_DIR points to %SHORTPATH%\PKGCON~1\bin\PkgConfig. I can't follow that, and even if I could it wouldn't sound right to me.

Be prepared for a number of test failures when running the Math-GSL-0.22 test suite. Despite the failures, you can of course install it anyway - you may find it works quite well for you.

Cheers,
Rob

UPDATEs: Btw, if you want to build a Math::GSL that passes all of its tests, I'm pretty sure version 0.14 fits that bill - there may, of course, also be later versions that pass all tests. I think those earlier versions are missing some of the functionality of the later versions, and it's this added "functionality" (along with a few test suite bugs perhaps) that's currently breaking Math::GSL on Windows.

0.22 actually builds better than I remembered - so long as you're building against a dynamic (dll) build of the gsl library. You'll get segfaults if you build against a static library, owing to the way in which the Math::GSL error handling is structured. Here's my 'perl build test' report for 0.22:
Test Summary Report ------------------- t\CDF.t (Wstat: 512 Tests: 794 Failed: 2) Failed tests: 481, 523 Non-zero exit status: 2 t\Matrix.t (Wstat: 0 Tests: 238 Failed: 0) TODO passed: 209-212 t\Vector.t (Wstat: 0 Tests: 142 Failed: 0) TODO passed: 141-142 Files=52, Tests=3636, 39 wallclock secs ( 2.03 usr + 0.31 sys = 2.34 + CPU) Result: FAIL Failed 1/52 test programs. 2/3636 subtests failed.
As you can see, nothing to worry about except for tests 481 and 523 in t/CDF.t

I've only just now worked out that the reason I had to use CPATH and LIBRARY_PATH was that my lib/pkgconfig/gsl.pc was written to specify pathnames in msys-style. If paths are specified in that file using normal windows-style pathnames then there's no need to make use of CPATH and LIBRARY_PATH.
(My gsl library was built in the msys shell - hence the use of msys-style paths in gsl.pc.)

Replies are listed 'Best First'.
Re^2: Math::GSL installation on Windows XP
by Barnabas (Initiate) on Nov 10, 2010 at 18:43 UTC

    Thanks syphilis for the tips. The %SHORTPATH%\PKGCON~1\bin\PkgConfig is the directory where the "gsl" directory is located, which contains *.h gsl library files. On another message board, it was recommended that I write the path using short directory names.

    How do I get the dll build of the gsl library? It appears that I have the static library instead, and after following your instructions for CPATH and LIBRARY_PATH, the 0.22 build still appears to have the errors you were describing.

      Hey, I could still use some help on acquiring the dll's for GSL. Anyone who can help me with this?

        Sorry - missed the earlier post.
        For a short time only you can grab the 32-bit gsl-0.14 library (libs, headers, dll's and docs) for Win32 here. (Built using MinGW.)

        If you unpack it to anywhere other than C:/_32/gsl_dyn you'll have to edit the paths accordingly in lib/pkgconfig/gsl.pc (which is a trivial task).
        MD5: ea5f96e769f17e66527aee293579c8de SHA1: cabef95aef3098d8197d0c0e84e5183092e55ebe SHA256: 163faf867119f7678e7554e70c689336ddd4cb23753aed67b8063467533b40 +31
        (Can also provide a 64-bit MinGW64 build, but that hasn't been uploaded yet - and won't be unless someone requests it.)

        Cheers,
        Rob

        UPDATE: You might need to create copies of lib/libgsl.dll.a and lib/libgslcblas.dll.a (in the same folder) named libgsl.a and libgslcblas.a ... I think that should be unnecessary as Math::GSL uses ExtUtils::PkgConfig, but worth bearing in mind just in case you have trouble with the linking during the Math::GSL build.