{"id":85,"date":"2008-12-12T11:05:37","date_gmt":"2008-12-12T10:05:37","guid":{"rendered":"http:\/\/www.miscdebris.net\/blog\/?p=85"},"modified":"2009-04-20T15:16:31","modified_gmt":"2009-04-20T14:16:31","slug":"mingw-345-binaries-of-gnu-scientific-library-111","status":"publish","type":"post","link":"http:\/\/www.miscdebris.net\/blog\/2008\/12\/12\/mingw-345-binaries-of-gnu-scientific-library-111\/","title":{"rendered":"MinGW (3.4.5) binaries of GNU Scientific Library 1.11 for use with MinGW and Visual C"},"content":{"rendered":"<p><strong>The binaries for GSL 1.12 are provided in this post: <\/strong><a href=\"http:\/\/www.miscdebris.net\/blog\/2009\/04\/20\/mingw-345-binaries-of-gnu-scientific-library-112-for-use-with-mingw-and-visual-c\/\"><strong>MinGW (3.4.5) binaries of GNU Scientific Library 1.12 for use with MinGW and Visual C++<\/strong><\/a><\/p>\n<p>&#8220;The <a href=\"http:\/\/www.gnu.org\/software\/gsl\/\" target=\"_blank\">GNU Scientific Library (GSL)<\/a> is a numerical library for C and C++ programmers. The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite&#8221;.<\/p>\n<p>GSL is quite Unix centric but one might want to use the library at least with <a href=\"http:\/\/www.mingw.org\/\" target=\"_blank\">MinGW<\/a> on Windows. I didn&#8217;t find any MinGW binaries of GSL apart from the <a href=\"http:\/\/ascendwiki.cheme.cmu.edu\/Binary_installer_for_GSL-1.11_on_MinGW\" target=\"_blank\">one provided by the Ascend package<\/a> or the <a href=\"http:\/\/gnuwin32.sourceforge.net\/packages\/gsl.htm\" target=\"_blank\">binaries from GNUWin32<\/a> (which is only at version 1.8), but I don&#8217;t like graphical installers for libraries and I needed the static library. Therefore I compiled my own library with <a href=\"http:\/\/www.mingw.org\/wiki\/msys\" target=\"_blank\">MSYS<\/a> (I updated MSYS according to this link) and provide here the tarred binary package, which can also be used with the MinGW compiler without MSYS and with Visual C (import libraries for the shared library are provided).<\/p>\n<p><!--more-->There are no makefiles for the MinGW compiler but it is possible to compile the GSL in the MSYS development environment. I wrote a little bash script which downloads the GSL source package (with the help of <a title=\"curl for windows package\" href=\"http:\/\/curl.haxx.se\/download\/curl-7.18.0-win32-nossl-sspi.zip\">curl<\/a>), untars the package, compiles the source and assembles the binaries and necessary files for development in a tar.gz package using <a href=\"http:\/\/downloads.sourceforge.net\/sevenzip\/7za457.zip\" target=\"_blank\">7zip<\/a>. Curl and 7zip need to be in the path or in the same directory as the script. The script will create a gsl_mingw directory where the source package is downloaded to and all compilation steps will take place. The tar.gz package will be created in gsl_mingw\/package and copied to the directory where the script was run. Below you can download the binary package of GSL 1.11 for the MinGW 3.4.5 compiler toolset (to be used in MSYS and in native Windows CLI) and the script I wrote to compile GSL in MSYS yourself if you want. I also added the import libraries for Visual C (only for the shared GSL) according <a href=\"http:\/\/gnuwin32.sourceforge.net\/msimport.html\" target=\"_blank\">GNUWin32 descriptions<\/a>.<\/p>\n<p>Download: <a href=\"http:\/\/www.miscdebris.net\/upload\/gsl-1.11_mingw-3.4.5.tar.gz\" target=\"_self\">GSL 1.11 Binary for MinGW 3.4.5<\/a> (with Visual C import libraries)<\/p>\n<p>The script will create a directory &#8220;gsl_mingw&#8221; in the same directory where the script is run. Before the scripts starts downloading the GSL package, it shows some informations and waits for user input.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n#######################################################################\r\n# This MSYS\/bash batch file will download, compile and make a package\r\n# of the GNU scientific library for the MinGW compiler. You need to\r\n# have Msys and MinGW already installed.\r\n#\r\n# You need curl.exe and 7za.exe for this script to work\r\n# correctly:\r\n#   - curl 7.18.0 no SSL download location:\r\n# http:\/\/curl.haxx.se\/download\/curl-7.18.0-win32-nossl-sspi.zip\r\n#   - 7-zip 4.57 command line version:\r\n# http:\/\/downloads.sourceforge.net\/sevenzip\/7za457.zip\r\n#######################################################################\r\n\r\n#######################################################################\r\n# determine directories and set variables\r\n# source package will be downloaded to $MAINDIR\r\n# source will be compiled in $BUILDDIR\r\n# binary package will be created in $ROOTDIR\r\n#######################################################################\r\nexport GSL_VERSION=1.11\r\nexport GSL_URL=ftp:\/\/ftp.gnu.org\/gnu\/gsl\/gsl-${GSL_VERSION}.tar.gz\r\nexport MINGW_VERSION=`gcc -dumpversion`\r\n\r\nexport ROOTDIR=`pwd`\r\nexport MAINDIR=$ROOTDIR\/gsl_mingw\r\nexport BUILDDIR=$MAINDIR\/gsl-${GSL_VERSION}\r\nexport PACKAGEDIR=$MAINDIR\/package\r\n\r\n#######################################################################\r\n# show user the settings and ask if he wants to continue\r\n#######################################################################\r\necho\r\necho ==============================================================\r\necho == Please check the settings\r\necho ==============================================================\r\necho\r\necho Directories\r\necho ===========\r\necho ROOTDIR=$ROOTDIR\r\necho MAINDIR=$MAINDIR\r\necho BUILDDIR=$BUILDDIR\r\necho PACKAGEDIR=$PACKAGEDIR\r\necho\r\necho Other\r\necho =====\r\necho GSL_URL=$GSL_URL\r\necho GSL_VERSION=$GSL_VERSION\r\necho MINGW_VERSION=$MINGW_VERSION\r\necho\r\n\r\necho &quot;Should the build process be continued? Type y to continue!&quot;\r\nread -n 1 -s\r\nif &#x5B; &quot;$REPLY&quot; != &quot;y&quot; ]; then\r\necho &quot;Shell script stopped ...&quot;\r\nexit -1;\r\nfi\r\n\r\n#######################################################################\r\n# create directories\r\n#######################################################################\r\nmkdir $MAINDIR\r\nmkdir $PACKAGEDIR\r\n\r\n#######################################################################\r\n# download and unpack gsl source code\r\n#######################################################################\r\necho +++ Downloading gsl from $GSL_URL +++\r\ncurl $GSL_URL -o $MAINDIR\/gsl-${GSL_VERSION}.tar.gz\r\npushd $MAINDIR\r\ntar xzf gsl-${GSL_VERSION}.tar.gz\r\npopd\r\n\r\n#######################################################################\r\n# configure and build library\r\n#######################################################################\r\nmkdir $BUILDDIR\/buildstatic\r\npushd $BUILDDIR\/buildstatic\r\n..\/configure --enable-static=yes --enable-shared=no --prefix=$PACKAGEDIR\/gsl-${GSL_VERSION}-static\r\nmake\r\nmake install\r\npopd\r\n\r\nmkdir $BUILDDIR\/buildshared\r\npushd $BUILDDIR\/buildshared\r\n# CFLAGS=-DGSL_DLL ..\/configure --enable-static=no --enable-shared=yes  --prefix=$PACKAGEDIR\/gsl-${GSL_VERSION}\r\n..\/configure --enable-static=no --enable-shared=yes --prefix=$PACKAGEDIR\/gsl-${GSL_VERSION}-shared\r\nmake\r\nmake install\r\npopd\r\n\r\n#######################################################################\r\n# make package for website\r\n#######################################################################\r\nif &#x5B; 1 == 1 ]\r\nthen\r\npushd $PACKAGEDIR\r\nmkdir -p gsl-${GSL_VERSION}\/lib-static\r\nmkdir -p gsl-${GSL_VERSION}\/lib-shared\r\nmkdir -p gsl-${GSL_VERSION}\/bin\r\nmkdir -p gsl-${GSL_VERSION}\/include\r\n\r\ncp -r gsl-${GSL_VERSION}-static\/include\/* gsl-${GSL_VERSION}\/include\r\ncp -r gsl-${GSL_VERSION}-static\/lib\/* gsl-${GSL_VERSION}\/lib-static\r\ncp -r gsl-${GSL_VERSION}-shared\/lib\/* gsl-${GSL_VERSION}\/lib-shared\r\ncp -r gsl-${GSL_VERSION}-shared\/bin\/* gsl-${GSL_VERSION}\/bin\r\n\r\necho 'This GNU Scientific Library DLL was generated using MingW\/Msys.' &gt; gsl-${GSL_VERSION}\/README.txt\r\necho 'configure settings:' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho '..\/configure --enable-static=yes --enable-shared=no' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho '..\/configure --enable-static=no --enable-shared=yes' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho '' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho 'To create Visual C import libraries open a VC command line' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho 'and in lib-shared run:' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho 'lib \/machine:i386 \/def:libgsl-0.def' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\necho 'lib \/machine:i386 \/def:libgslcblas-0.def' &gt;&gt; gsl-${GSL_VERSION}\/README.txt\r\npushd gsl-${GSL_VERSION}\/bin\r\nstrip gsl-histogram.exe gsl-randist.exe libgsl-0.dll libgslcblas-0.dll\r\npexports.exe libgsl-0.dll &gt; ..\/lib-shared\/libgsl-0.def\r\npexports.exe libgslcblas-0.dll &gt; ..\/lib-shared\/libgslcblas-0.def\r\npopd\r\ntar -cf gsl-${GSL_VERSION}_mingw-${MINGW_VERSION}.tar gsl-${GSL_VERSION}\r\ngzip gsl-${GSL_VERSION}_mingw-${MINGW_VERSION}.tar\r\nmv gsl-${GSL_VERSION}_mingw-${MINGW_VERSION}.tar.gz $ROOTDIR\r\npopd\r\nfi\r\n\r\nexit 1\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The binaries for GSL 1.12 are provided in this post: MinGW (3.4.5) binaries of GNU Scientific Library 1.12 for use with MinGW and Visual C++ &#8220;The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. The library provides a wide range of mathematical routines such as random number generators, special functions &hellip; <a href=\"http:\/\/www.miscdebris.net\/blog\/2008\/12\/12\/mingw-345-binaries-of-gnu-scientific-library-111\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MinGW (3.4.5) binaries of GNU Scientific Library 1.11 for use with MinGW and Visual C<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[4,24],"tags":[21,22,25,20],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-research","category-windows","tag-bash","tag-curl","tag-gsl","tag-mingw"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6pnj-1n","_links":{"self":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts\/85"}],"collection":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":15,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":124,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions\/124"}],"wp:attachment":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}