Note that this document has not been completed yet. However, for experienced users, this might be helpful with the information at http://gnuplot.info/development/index.html.
Purpose of this page is to show an example for building gnuplot for windows using MinGW complier. This is a mere example so that please arrange it with your favour.
Please use this page at your own risk
In my building, using tools are MinGW, GCC (gcc and g++), Msys, GTK+ - Download for Windows (which includes other third party dependencies), gd library, and wxWidgets.
MinGW, GCC(gcc and g++) and Msys can be downloaded from
MinGW Top page
Please click 'Download' tag to goto Download page.
If you do not have any tools around MinGW, GCC, and Msys, Msys is the first package to be installed. From the download page of MinGW, you will find 'Msys Base System' -> 'Current Release_ MSYS-1.0.11'. You can see list of download files. If you want to know Msys-1.0.11, please read MSYS-1.0.11.RELEASE_NOTES.txt.
Please download first 'MSYS-1.0.11.exe' and install it. Default install folder 'MSYS-1.0.11.exe' is C:\msys\1.0.11. You can change the install folder. However, installing components to the folder full path name of which includes 'space' character, e.g. 'C:Program Files\msys\1.0.11' is not recommended. In my case, the install folder is 'C:\Programs\\msys\1.0.11'
After install is finished, the post install command prompt windows appear.
*****************
This is a post install process that will try to normalize between
your MinGW install if any as well as your previous MSYS installs
if any. I don't have any traps as aborts will not hurt anything.
Do you wish to continue with the post install? [yn ] y
Do you have MinGW installed? [yn ] n
When you install MinGW I suggest you install it to C:/mingw
(replace C: with the drive of your choice). Then create an
/etc/fstab file with a line that has a value similar to:
C:/mingw /mingw
Press ENTER to continue
Normalizing your MSYS environment.
You have script /bin/awk
You have script /bin/cmd
You have script /bin/echo
You have script /bin/egrep
You have script /bin/fgrep
You have script /bin/printf
You have script /bin/pwd
MinGW-1.1 has a version of make.exe within it's bin/ directory.
Please be sure to rename this file to mingw32-make.exe once youve
echo installed MinGW-1.1 because it\s very deficient in function.
Press ENTER to continue.
**************
Msys cvs is required to download source trees. It is now provided in lama compression style. Please take care that some browsers change the extension from 'lama' to 'tar'. In the case, please rename the extension to 'lama'
Please save '.tar.lama' files to the Msys install folder
(C:\Msys\1.0.11 (default), C:\Programs\Msys\1.0.11 (my case) )
To extract, '.lama' file, please use
tar -x --lzma -vf cvs-1.12.13-1-msys-1.0.11-bin.tar.lzma
For details, please read c's-(version number)-msys.RELEASE_NOTES. In some situation, you have to install additional tools.
Please read the first (Msys install folder)/DC/msys/READ ME.rtf. Please ignore the following description:
I find it advantageous to now put MinGW and MSYS binaries in the same /bin directory. It provides one less confusion with where to install your products.
in the README.rtf. Because there are some commands and tools, which have the same name in Msys and MinGW.
In the (Msys install folder)/etc, 'fstab' can be set. For the 'fstab' file, please copy 'fstab.sample' to 'fstab' and comment out Active perl description as by a suitable text editor* unless you want to use Active Perl.
#c:/ActiveState/perl /perlc:/Programs/MinGW /MinGW c:/Programs/GnuWin32 /GnuWin32 c:/usr/Tatsu/mingwhome /home c:/Programs/WinDevTools /WinDevTools c:/Programs/Cygwin /Cygwin
* text editor: The windows default 'notepad' is not recommended because it cannot treat unixy line ending code 'LF'. I am using the SciTE for an text editor.
You can find the description of /WinDevTools. Here I place the dependencies for the gnuplot building. It is stated in the following, GTK
Please make in /home (its windows path by fstab, otherwise it is set by Msys) folder,
'.bash_profile', '.bashrc' and '.inputrc' by a suitable text editor.
Note that files names of which begin with '.' (dot) cannot be made by the windows explorer.
In .bash_profile, please describe just source .bashrc.
In .bashrc, intitialization setting for your bash prompt is to be described.
In .inputrc, setting for input method is to be described. The below is examples
for .bashrc and .inputrc.
****.bashrc****
# Japanese Time zone export TZ=JST-9 # set Japanese SJiS code export LANG=ja_JP.SJIS # OUTPUT_CHARSET=sjis(libiconv) export OUTPUT_CHARSET=sjis # for less export LESSCHARSET=dos # add PATH to /WinDevTools/bin:/GnuWin32/bin export PATH=$PATH:/WinDevTools/bin:/GnuWin32/bin # set PKG_CONFIG_PATH # Note that pkg-config is not a Msys Program but a windows native program # so that PATH names should be written in Windows style export PKG_CONFIG_PATH='C:/Programs/WinDevTools/lib/pkgconfig;C:/programs/GnuWin32/lib/pkgconfig' alias ls='ls --show-control-chars --color -F' alias langjp='export LANG=ja_JP.SJIS' alias langus='export LANG=us'
****.inputrc****
#Setting for Japane versio of windows set kanji-code sjis set convert-meta off set meta-flag on set output-meta on
Description of GnuWin32 can be omitted because GnuWin32 is not related to building gnuplot binaries.
I have not used the automated MinGW installer because it will install GCC-3.4.5 but not GCC-4.4.0.
You'll need the following packages for basic Windows development:('x' indicates the version number)
You might also want to install:
Default install folder by MinGW installer is 'C:\MinGW'. You can change the install folder. However, installing components to the folder full path name of which includes 'space' character, e.g. 'C:Program Files\MinGW' is not recommended. In my case, the install folder is 'C:\Programs\MinGW'
To extract '.tar.gz' files, you can use msys tools. Please doubly click "msys" or "msys.bat" at ...\msys\1.0.11 to execute msys sh sell. Please save '.tar.gz' files to the MinGW install folder (C:\MinGW (default), C:\Programs\MinGW (my case) ) (Here we assusm that mingwrt-3.16-mingw32-dev.tar.gz is extracted).
At msys prompt, type
cd /mingw
You can goto '/mingw'. And then type
tar xvfkz mingwrt-3.16-mingw32-dev.tar.gz
Other '.tar.gz' files are to be extracted in the same way.
I am now using GCC-4.4.0 as c and c++ complier. Please see first 'gcc-4.4.0-mingw32-notes.txt' at GCC Version 4, Current Release_ gcc-4.4.0.
Please download from GCC Version 4, Current Release_ gcc-4.4.0
tar -x --lzma -vf libiconv-1.13.1-1-mingw32-dll-2.tar.lzmaIf you do not support any bit map based terminals (gif, png, jpeg and so on), you can skip here.
GTK+ - Download for Windows (which includes other third party dependencies)
can be downloaded from
http://www.gtk.org/download-windows.html
First you decide where these libraries are installed. There are some choices to decide to which folder the dependencies are installed. In my case, 'C:\Programs\WinDevTools' is made and installed here with other dependencies: the gd and the wxWidgets development toolkits.
In the section of Msys, the setting of 'C:\Programs\WinDevTools' can be found. There are two different origin bitmap terminals. One is based on the gd library and the other is base on the cairo, which is included in the GTK+ libraries.
For default compliping, only gd based terminals are supported. In this case, required dependencies are
Note that pkg-config is not used for dependency but used for a tool get configuration for building.
Some of the above components are not available though some web browser. In the case, please use the Internet Explorer.
After the above files are installed, you have to modify all ../lib/pkgconfig/*.pc files. In the first line each *.pc file has a description of 'prefix'. Please modify it according to your install folder. In my case, the install folder name is 'c:\Programs\WinDevTools'. I modify the first line, for example,
prefix=C:/Programs/WinDevTools
Please use '/' but not '\' for path separator.
On MinGW, the gd library should be build from source. You can download the latest archived file from http://www.libgd.org/releases/
Preparation
C:\tmp
tar xvfkj gd-2.0.36RC1.tar.bz2
'#define NONDLL 1' to at very top level of gd.h in
..../gd-2.0.36RC1
even if you will build shared libraries. Please note that attribute of
extracted files are read only. Change it by the windows explorer or
'chmod +w (filename)' on the Msys shell
C:\tmp\gd-2.0.36RC1-build
Now you can build gd library. The below is an example of build command.
#******Begining of build commands.
# Please modify them to your environment.
# Please use a text editor and paste them to the Msys promt
#
#**** goto build directory
cd "C:\tmp\gd\gd-2.0.36RC1-build"
#**** set environmental variables
export CC='gcc -shared-libgcc'
export CPPFLAGS='-I/WinDevTools/include'
export LDFLAGS='-L/WinDevTools/lib'
export CFLAGS='-O3 -fomit-frame-pointer'
#*** configure
# prefix is a install directory
# It (/WinDevTools) is to be modified to your environment
../gd-2.0.36RC1/configure --prefix=/WinDevTools
#*** make
make
#*** creat shared libraries from static libraries (libgd.dll, libgd.dll.a)
##change directory to '.libs'
cd .libs
## make a list of object files from libgd.a (used in linking script)
ar t libgd.a | awk '{printf("%s ", substr($1,1,length($1)-1))}END{print "\\"}' > olist.txt
## Create dll linking script (tmp.sh)
echo gcc -shared-libgcc -shared -Wl,--export-all-symbols \\ >tmp.sh
echo -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc \\ >>tmp.sh
echo -Wl,--allow-multiple-definition -Wl,--out-implib=libgd.dll.a -o libgd.dll \\ >>tmp.sh
cat olist.txt >>tmp.sh
echo -L/WinDevTools/lib -ljpeg -lfontconfig -lfreetype -lpng -lz -liconv >>tmp.sh
## Create libgd.dll and libgd.dll.a
./tmp.sh
## delete temporary files
rm tmp.sh
rm olist.txt
#*** add 'libgd.dll.a' to library_names in libgd.la
sed -e "s/library_names=''/library_names='libgd.dll.a'/g" libgd.la > libgd.la.tmp
mv libgd.la.tmp libgd.la
cp libgd.la ..
#*** re-make *.exe using shared librararies
cd ..
rm *.exe
make
#*** install (ignore error)
make install-strip -i
## copy (and strip) dll related files to install directories
# '/WinDevTools' is to be modified for your environments
cp ./.libs/libgd.dll /WinDevTools/bin
strip /WinDevTools/bin/libgd.dll
cp ./.libs/libgd.dll.a /WinDevTools/lib
rm /WinDevTools/lib/libgd.a
#*** end of the commands
The above commands build a library which depends on the shared libgcc library of gcc-4.4.0:
libgcc_s_dw2-1.dll.
If you do not want make a library that depends on libgcc_s_dw2-1.dll,
please delete '-shared-libgcc' option from the above commands
The wxWidgets toolkits are required only for people who would like to use wxt terminal.
It should be build from source. It can be downloaded from
http://www.wxwidgets.org/downloads/
At present, I am using, Current Stable Release: 2.8.10. I have used zip compressed archives.
Preparation
C:\tmp
C:\tmp\wxMSW-2.8.10-build
Now you can build wxWidgets toolkits. The below is an example of build commands.
#******Begining of build commands. # Please modify them to your environment. # Please use a text editor and paste them to the Msys promt # #**** goto build directory cd "C:\tmp\wxMSW-2.8.10-build" export CC='gcc -shared-libgcc' export CXX='g++ -shared-libgcc' export F77='gfortran -shared-libgcc' export FFLAGS='-O3 -fomit-frame-pointer' export CFLAGS='-O3 -fomit-frame-pointer' export CXXFLAGS='-D_GLIBCXX_DLL -O3 -fomit-frame-pointer' export LDFLAGS='-Wl,--allow-multiple-definition -Lc:/Programs/WinDevTools/lib -lstdc++_s' export CPPFLAGS='-Ic:/Programs/WinDevTools/include' ../wxMSW-2.8.10/configure --prefix=/WinDevTools make make install-strip -i mv /WinDevTools/lib/*.dll /WinDevTools/bin ls -l /WinDevTools/bin/wx* #*** end of the commands
The above commands build a library which depends on the shared libgcc and libstcc++ libraries
of gcc-4.4.0:
libgcc_s_dw2-1.dll and libstdc++-6.dll.
If you do not want make toolkits that depend on libgcc_s_dw2-1.dll
and libstdc++-6.dll,
please delete '-shared-libgcc' option and -D_GLIBCXX_DLL
in CXXFLAGS, -Wl,--allow-multiple-definition
and -lstdc++_s in LDFLAGS from the above commands.
(Sorry, it will be written in the future)
(Sorry, it will be written in the future)
Dr. Tatsuro MATSUOKA at Nagoya University
Associate Professor
Department of Molecular Design and Engineering, sGraduate School of Engineering.
(Undergraduate : Department of Chemical Engineering.)
gnuplot related Email : tmacchant3_atmark_yahoo.co.jp