Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Math::GSL installation on Windows XP

by Barnabas (Initiate)
on Nov 04, 2010 at 16:00 UTC ( [id://869495]=perlquestion: print w/replies, xml ) Need Help??

Barnabas has asked for the wisdom of the Perl Monks concerning the following question:

PERL MONKS DISCUSSION Hi, I'm new at installing Perl programming libraries, a little
familiar with Linux and Unix, and a little more familiar with setting up Windows XP for programming. I want to use
CPAN’s complex math libraries (constants, complex numbers,vectors, and matricies) in Math::GSL for a Perl
program that I've written. Can you help me figure out I'm missing to complete the installation of this library?

I've downloaded and extracted pre-compiled versions of pkg- config_0.23-3_win32.zip, and I set the system environment variable
PKG_CONFIG_PATH to its root directory on the C: drive. I've
downloaded and extracted a pre-compiled version of gsl-1.8-win.zip as
C code in the pkg-config folder, and I renamed the file gsl.pc.in as
gsl.pc and placed it in the pkg-config root directory. I assigned the
user environment variable GSL_DIR to the directory where gsl.pc is located, and I modified gsl.pc to direct to the proper folders. I also downloaded
and extracted pre-compiled mingw32 files and installed them in the
same pkg-config directory.

From CPAN, using Strawberry Perl, I've already downloaded ExtUtils::PkgConfig, Module::Build, and Math::GSL. It seems to be
installing Math-GSL v0.2. Here's what I get when I try to build Math::GSL. Building Math-GSL
In file included from C:/Perl/lib/CORE/sys/socket.h:32, from C:/Perl/lib/CORE/win32.h:388, from C:/Perl/lib/CORE/win32thread.h:4, from C:/Perl/lib/CORE/perl.h:2817, from xs\BLAS_wrap.c:731: C:/Perl/lib/CORE/win32.h:393:26: warning: "/*" within comment C:/Perl/lib/CORE/win32.h:394:33: warning: "/*" within comment In file included from C:/Perl/lib/CORE/win32thread.h:4, from C:/Perl/lib/CORE/perl.h:2817, from xs\BLAS_wrap.c:731: C:/Perl/lib/CORE/win32.h:393:26: warning: "/*" within comment C:/Perl/lib/CORE/win32.h:394:33: warning: "/*" within comment xs\BLAS_wrap.c:1560:29: gsl/gsl_nan.h: No such file or directory xs\BLAS_wrap.c:1561:30: gsl/gsl_math.h: No such file or directory xs\BLAS_wrap.c:1562:31: gsl/gsl_monte.h: No such file or directory


GSL_DIR points to %PATH%\PkgConfig\ . Path points to %SHORTPATH%\PKGCON~1\bin . The files needed (gsl_nan.h, gsl_math.h, and gsl_monte.h) are in the GSL_DIR\gsl\ , and the GSL_DIR
contains gsl.pc.

What am I missing?

Replies are listed 'Best First'.
Re: Math::GSL installation on Windows XP
by syphilis (Archbishop) on Nov 05, 2010 at 00:27 UTC
    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.)

      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?

Re: Math::GSL installation on Windows XP
by kcott (Archbishop) on Nov 04, 2010 at 16:45 UTC

    Math::GSL documents compilation issues and states that the module is under active development.

    The CPAN Testers Matrix indicates it mostly fails to install.

    For what it's worth, my unsuccessful attempt to install the module is detailed below.

    -- Ken

      'pkg-config' is not recognized as an internal or external command, operable program or batch file. *** *** ExtUtils::PkgConfig requires the pkg-config utility, but it doesn' +t *** seem to be in your PATH. Is it correctly installed?
      The problem with your attempt is that (as the message says) you don't have a working installation of the pkg-config utility.

      As it looks to me, the OP already is beyond that stage, but he doesn't seem to have a proper .pc file for the gsl library.

Re: Math::GSL installation on Windows XP
by Anonymous Monk on Nov 04, 2010 at 16:24 UTC
    I renamed the file gsl.pc.in as gsl.pc and placed it in the pkg-config root directory
    That procedure sounds a little suspicious ;-)

    Normally, those .in files are templates that are filled in with the appropriate metainfo (like compile/link options, version, install paths, etc.) at the time the library is configured and built. In other words, the template itself is unlikely to contain any useful info for a pkg-config query...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://869495]
Approved by ELISHEVA
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found