This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Building GSL on Microsoft Visual C++


I recently decided to compile GSL for Microsoft Visual C++.  There seems to
be some frustration floating around on the newsgroup regarding how to build
it, so I thought I'd contribute some directions I wrote while building it.
I hope this helps the general effort without opening the floodgates of
incompetent 1-click install Windows users (see
http://sources.redhat.com/ml/gsl-discuss/2004-q1/msg00093.html).  I'd
appreciate feedback and corrections to the errors I know I've made.  Thanks
of course to the GSL team for providing such a great library free of charge.
Enjoy!

Directions for compiling GSL for Microsoft Visual C++,
by Bryan Jones, bryanj at clemson dot edu.
Last updated 24-Aug-2004.

Note: these were tested under gsl version 1.5.


1. Go to www.cygwin.com.  Click on the "Install or update now!" icon.
   Get all the necessary cygwin utils: install cygwin, plus gcc, automake,
autoconf, libtool.,
   cvs, texinfo, cvs, and zip.  Get tex if you want to make documentation in
ps form.  Quoting from
   the HACKING file (which you'll download in step 3) for more info:

The GSL hacker needs some stuff that the end users don't:

* you must have a recent automake from
ftp://sources.redhat.com/pub/automake/

* you must have a recent autoconf from
ftp://sources.redhat.com/pub/automake/

* you must have a recent libtool from
ftp://ftp.gnu.org/gnu/libtool/

A known working combination is automake 1.7.5 autoconf 2.57 libtool 1.4.3

* you must have a recent CVS (at least 1.9)

* you must have texinfo (4.0 or later) from
ftp://ftp.gnu.org/gnu/texinfo/


2. Change Windows path so that c:\cygwin\bin is before
%SYSTEMROOT%\system32.  That way,
   the command "find" invokes the UNIX find function, which the compilation
process relies
   on, not the Windows find function, which causes it to croak.  Type:
which find

   at the command prompt.  It should reply:
/usr/bin/find

3. Check out the latest gsl distribution from the GSL repository.  Quoting
again from
   parts of HACKING,

Once you have this stuff, you can get the repository and start
working from your own machine.  To do the initial checkout of the
repository try (bash syntax):

# ANONYMOUS CVS USERS

cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/gsl login
     (password is ``anoncvs'')
cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/gsl checkout gsl


4. Prepare for the make.  Fire up the cygwin bash shell (the Windows command
prompt
   doesn't cut it) and do (quoted from HACKING)

cd gsl ; ./autogen.sh   (to create auto-generated files)
./configure --enable-maintainer-mode

[from now on you can just do "cvs update" in the gsl directory]


5. Make the HTML documentation.  From HACKING:

* Make html docs using texi2html in cvs, 

    cd doc ; mkdir html ; cd html
    ../texi2html -verbose -split_chapter -expandinfo ~/gsl/doc/gsl-ref.texi

6. Optionally, make the PostScript documentation.  You need tex and related
   utilities installed.  From HACKING:

   make dvi; dvips gsl-ref.dvi ; gzip -v -9 gsl-ref.ps


7. Make a tarball for distribution.  At the bash prompt, type:
make dist

   This is taken from the first step in HACKING under the "Preparing a
windows 
   version (Microsoft Visual C)" title.

8. Second step for preparing a Windows version from HACKING:
   - Make sure there is a copy of texi2html in doc/


9. Make the cygwin version of the library.  From the INSTALL file:

You can then build the library by typing,

  make

Both static and shared versions of the libraries will be compiled by
default.

   Optionally, check to make sure everything works.  This will also
   be done later, on the results from building GSL for MSVC++.
   From INSTALL:

An extensive test suite is available.  It can be invoked with "make
check" in each directory.  All tests can be run together with "make
check" at the top level.  The test output should be directed to a file
rather than a terminal, with the command,

   make check > log 2>&1

since it is several megabytes in size.

If you run "make check" and get some failures, please see the notes on
platform specific problems below.  If you find failures that are not
mentioned, please report them.


  Under the msvc/ directory, create usr/lib (create two directories, usr
then
  lib under usr).  Now, copy .libs/libgsl.a and 
  cblas/.libs/libcblas.a to msvc/usr/lib.  This follows the third step
  for preparing a windows version from HACKING:
   - Compile the library and put the lib{gsl,gslcblas}.a  into msvc/usr/lib


10. Change to the msvc directory and type:
make update

    per the HACKING windows directions:
   - Run "make update" in msvc/ to update the exports file

11. Create an .zip file for the Window version, which gets placed in
    gsl-VERSION.zip.  From the main gsl directory, run:
./script/windists.sh gsl-VERSION.tar.gz

    where VERSION is replaced by the version of gsl you're building.  I'm
not
	sure where the right place is to find the version.  The output from
	make dist shows the version number lots of times.  Also, the third
line
	of configure.ac has it in brackets: AC_INIT([gsl],[1.5]) is version
1.5
	of gsl.  From HACKING:

   - Use the script,
   ./script/windists.sh gsl-VERSION.tar.gz
   to create a corresponding zip file

12. Create another directory and unzip the resuling gsl-VERSION.zip file
into
    it.  From HACKING:

   - Unpack the file on Windows.  


13. Make the Microsoft help files.  You'll need the newer verion of the
    Microsoft Help Compiler is you have MSVC++ 6.0.  You can download it
	from the Microsoft web site; Google on "Microsoft Help Compiler"
then
	look for the download.  After installation, go to start -> programs
->
    HTML Help Workshop -> HTML Help Workshop.  Then, File | Open and move
	to the directory in which you unzipped the .zip file in step 12.
From
	here, go to doc/html and open gsl-ref.hhp.  Do File | Compile and
click
	Compile; the project file should be the gsl-ref.hhp file you just
	delected.  From HACKING:

   - In the directory doc/html run the Microsoft HTML Help Compiler 
   on the file gsl-ref.hhp to create gsl-ref.chm

14. The DLL .def files need to be manually hacked: the leading underscore
must
    be removed from the names of all the exports.  To do this, open the file

	GSLDLL/gslcblas.def in the unzipped directory.  Do a find and
replace, 
	changing "_cblas_" to "cblas_".  Save the file after making these
	changes.  Likewise, open GSLDLL/gdl.def then find and replace
"_gsl_"
	with "gsl_", being sure to turn on "Match case" in the MSVC++
replace
	dialog box.  Do again search, replacing "_GSL_" with "GSL_".  Next,
look
	for the following lines in this file:

	_bspline_centered_type DATA
	_bspline_type DATA
	<some more stuff>
	_daubechies_centered_type DATA
	_daubechies_type DATA
	<some more stuff>
	_haar_centered_type DATA
	_haar_type DATA

	Remove the leading underscore.  The lines should now look like this:

	bspline_centered_type DATA
	bspline_type DATA
	<some more stuff>
	daubechies_centered_type DATA
	daubechies_type DATA
	<some more stuff>
	haar_centered_type DATA
	haar_type DATA


15. In the directory created in step 12, open up MSVC++ and open one of
    the MSVC++ projects: GSLDLL.dsw to build the DLL, GSLLIBML to build
	the static library compiled with the /ML option (single-threaded),
	GSLLIBMT to build the static library compiled with the /MT option
	(multi-threaded).  Go to Build | Batch Build, make sure everything
	is checked (Release and Debug configurations for both gsl and
gslcblas).
	Click Build.  From HACKING:

   - Build workspace GSL.dsw for libgsl and libgslcblas (Release & Debug 
   configurations)

16. From the unzipped directory, load the project GSLDLLTEST.dsw into
    Visual C++ if you build the DLL, GSLLIBMLTESTS.dsw for the single-
	threaded version, or GSLLIBMTTESTS.dsw for the multi-threaded
	version.  Choose Build | Batch Build from MSVC++ then check all
	the projects.  To do this quickly, click on the first project, then
	shift-click on the last, then press the space bar.  Next, choose
	Build.  (The Clean option only cleans one project, so I'll later
	skip that step, instead building both the Release and Debug
	configurations here.)

	I couldn't get the wavelet stuff to link correctly, so I skipped
that.
	The line from HACKING (I ignored the Clean part):

   - Build the tests GSLTESTS.dsw for Debug
   - Clean and Build the tests GSLTESTS.dsw for Release


17. Change your windows path so that %SYSTEMROOT%\system32 is before
    c:\cygwin\bin.  That way, the command "find" invokes the Windows NT find
	function, which the MAKE_CHECK_{Debug,Release}.bat files rely on.
To
	check that you've got the correct path, type:
which find

    at the command prompt.  You should get something like
/cygdrive/c/WINDOWS/system32/find

    depending on where you installed windows.  Next, change to the GSLDLL,
	GSLLIBML, or GSLLIBMT direcotry as appropriate then run
    MAKE_CHECK_Debug.bat.  It should give 0 errors.  (Except for wavelets
	for the DLL -- that didn't work for me).  Then run
	MAKE_CHECK_Release.bat, which should also produce 0 errors
(exception
	for wavelets in DLL).  From HACKING:

   - Run MAKE_CHECK.bat (should give 0 errors)
   - Run MAKE_CHECK.bat (should give 0 errors)

18. To create a nice installable version, you must compile all three
versions
    of the library: the dll, single-threaded, and multi-threaded.  After
this,
    download the INNO Setup version 2.0.19 program (it's old -- the setup
    file doesn't work with newer versions of the program) from 
	http://www.jrsoftware.org/isdlold.php#2.0.
    Install it.  Run the program, then do File | Open.  Browse to the
	directory in which you unzipped gsl, then go to msvc/setup.iss.
Open it.
	Do a File | Compile.  From HACKING:

   - Compile the file setup.iss with INNO Setup 2 (free software)
     to create a self-extracting installer.


Congratulations.  You should be done now.  The resulting setup program is in
msvc/Output.  I hope these instructions helped!

------------------
bryanj at Clemson dot edu, http://ece.clemson.edu/crb/students/bryanj 
Clemson University
313?Fluor Daniel EIB
(864) 656-7956 office 
Let the words of my mouth and the meditation of my heart
? Be acceptable in Your sight,
? O LORD, my rock and my Redeemer.
-- King David, in Psalm 19:14



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]