Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#133 Painful windows compiling

None
closed
nobody
None
5
2013-04-23
2011-10-29
Surrel Yves
No

Hello

I love Gnuplot but I had always been reluctant to compile it, as I am neither a C nor a Unix programmer, and all my experiences with MAKEs and INSTALLs were bad.

Nevertheless, due to a bug that I reported and was corrected on-the-fly, I would want to compile the latest version.

I downloaded bcc32 but got so many difficulties and errors that it was hopeless.

I downloaded Mingw because it seemed to me that it may be better supported. Here is what I get, what is going wrong?

C:\Program Files\gnuplot\Source\gnuplot>C:\MinGW\bin\mingw32-make.exe -C src -f
../config/makefile.mgw
mingw32-make: Entering directory `C:/Program Files/gnuplot/Source/gnuplot/src'
gcc -c -O2 -I.. -I. -D_Windows -DHAVE_CONFIG_H -DUSE_MOUSE=1 -DWIN_IPC -DWITH_
HTML_HELP -I/c/Programme/HTML\ Help\ Workshop/include -DHAVE_LIBGD -DHAVE_LIBPNG
-DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG -DHAVE_GD_JPEG -DHAVE_GD_TTF alloc.
c
In file included from stdfn.h:47:0,
from alloc.h:44,
from alloc.c:44:
syscfg.h:348:23: error: two or more data types in declaration specifiers
syscfg.h:348:1: warning: useless type name in empty declaration
mingw32-make: *** [alloc.o] Error 1
mingw32-make: Leaving directory `C:/Program Files/gnuplot/Source/gnuplot/src'

C:\Program Files\gnuplot\Source\gnuplot>C:\MinGW\bin\mingw32-make.exe install -C
src -f ../config/makefile.mgw
mingw32-make: Entering directory `C:/Program Files/gnuplot/Source/gnuplot/src'
gcc -c -O2 -I.. -I. -D_Windows -DHAVE_CONFIG_H -DUSE_MOUSE=1 -DWIN_IPC -DWITH_
HTML_HELP -I/c/Programme/HTML\ Help\ Workshop/include -DHAVE_LIBGD -DHAVE_LIBPNG
-DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG -DHAVE_GD_JPEG -DHAVE_GD_TTF alloc.
c
In file included from stdfn.h:47:0,
from alloc.h:44,
from alloc.c:44:
syscfg.h:348:23: error: two or more data types in declaration specifiers
syscfg.h:348:1: warning: useless type name in empty declaration
mingw32-make: *** [alloc.o] Error 1
mingw32-make: Leaving directory `C:/Program Files/gnuplot/Source/gnuplot/src'

Discussion

  • Surrel Yves
    Surrel Yves
    2011-10-30

    I have progressed on this topic

    1) I run the Mingw shell instead of the DOS shell (this may be evident, but is not for newcommers; it could be stated in the instructions in INSTALL)
    2)I had to hard code
    #undef HAVE_ERF
    #undef HAVE_ERFC
    in config.mgw to avoid error "gnuplot static declaration of 'erfc' follows non-static"
    3) I had to update
    HHWPATH = /C/Program\ Files/HTML\ Help\ Workshop/
    (evident, too...)
    4) I had to comment out line 348 of syscfg.h
    typedef unsigned char _Bool;
    to avoid error " error: two or more data types in declaration specifiers"

    Most of the *.c compiling seems to go ok, but finally I get the error "undefined reference to `strnlen'"

    g++ -s -mwindows -L"C:\Program Files/HTML Help Workshop/"lib -o wgnuplot.exe all
    oc.o axis.o binary.o bitmap.o breaders.o color.o command.o contour.o datafile.o
    dynarray.o eval.o fit.o gadgets.o getcolor.o graph3d.o graphics.o help.o hidden3
    d.o history.o internal.o interpol.o matrix.o misc.o mouse.o parse.o plot.o plot2
    d.o plot3d.o pm3d.o readline.o save.o scanner.o set.o show.o specfun.o standard.
    o stats.o stdfn.o tables.o tabulate.o term.o time.o unset.o util.o util3d.o vari
    able.o version.o gpexecute.o winmain.o wgnuplib.o wgraph.o wprinter.o wtext.o
    wpause.o wmenu.o screenbuf.o wgdiplus.o wgplt_res.o -lkernel32 -lgdi32 -lwinspoo
    l -lcomdlg32 -lcomctl32 -ladvapi32 -lshell32 -lmsimg32 -lgdiplus -lhtmlhelp\ -liconv
    Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
    Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
    stdfn.o:stdfn.c:(.text+0x17): undefined reference to `strnlen'
    collect2: ld returned 1 exit status
    make: *** [wgnuplot.exe] Error 1

     
  • If you just want a current (CVS 4.5) build for Windows, you can find that on Tatsuro Matsuoka's web page:
    www.tatsuromatsuoka.com/gnuplot/Eng/winbin/

    In case you like to build gnuplot yourself you should stick with MSYS/MinGW, MSVC or OpenWatcom. Those platforms should be fully suported. MingGW is used for the "official" builds. We have removed support for BCC in CVS.

    In order to analyze the problems you are having, it is necessary to know which version of gnuplot you are trying to compile: CVS 4.4.x or CVS 4.5? How old is your installation of MinGW or which version of gcc are you using?

    Current CVS version of gnuplot can be compiled without further modification by a recent version of MinGW and the Makfile in gnuplot/config/mingw/.

     
  • Thanks or the additional info. Here some comments:
    1) I aggree that the documentation in INSTALL is outdated and should be revised. It is mentioned in the instructions in config/mingw/Makefile, though.
    2) That one is weird. HAVE_ERF/ERFC is used in specfun.c only and both are there to actually avoid the problem of redefinition of erf() and erfc() since it is already in C library provided by MinGW.
    3) You have to adjust the configuration section of your Makefile according to your setup. That is also true for various switches which tell the compiler which libraries you have installed.
    4) That error message is even more misterious, No idea what happens here.

    The version of MinGW I had been using was a bit older (gcc 4.5.2). I just upgraded my installation of mingw32-base, mingw32-gcc-g++ and other packages using mingw-get. That way I hoped to be able to reproduce your errors. Still, gnuplot compiles without problems using config/mingw/Makefile, which replaces config/makefile.mgw.

     
  • Surrel Yves
    Surrel Yves
    2011-10-30

    I am compiling better and better.

    Now, I am facing the problem of gd

    I download an installer from https://sourceforge.net/projects/gnuwin32/files/gd/2.0.33-1/gd-2.0.33-1.exe/download

    and installed

    I copied manually gd.h, gd_io.h to src (which is probably not the right way)
    but I get the following message at the very end:

    -L/C/Program\ Files/HTML\ Help\ Workshop/lib -lhtmlhelp -lgd
    c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot fi
    nd -lgd

    Obviously, I have to tell somewhere where to find the gd files. Can you tell me how to do that?

    Thank you

     
  • Add $(PROGRAMFILES)\GnuWin32\bin to PATH and activate
    GDAUTOCONFIGLIBS=1
    in Makefile.

    Instead of copying the include files you could also point the compiler to the correct directory
    CFLAGS+= -I"$(PROGRAMFILES)/GnuWin32/include"
    or, since you have gdlib-config :
    CFLAGS += $(shell gdlib-config --cflags)

     
  • Surrel Yves
    Surrel Yves
    2011-10-30

    Still advancing...

    I activated GDAUTOCONFIGLIBS=1

    OK for CFLAGS += $(shell gdlib-config --cflags), that I put there:

    ifdef NEWGD
    CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG $(shell gdlib-config --cflags)

    and it works (gd*.h files are found)

    To avoid the error "cannot find -lgd" issued apparently by C:\MinGW\mingw32\bin\ld.exe
    I added a -L option there

    ifdef GD
    CFLAGS += -DHAVE_LIBGD
    TERMLIBS += -L/C/Program\ Files/GnuWin32/lib -lgd
    endif

    and it works.

    Now, I am wondering how to avoid the other errors "cannot find ljpeg", "cannot find lfreetype" etc

    C:\Program Files\GnuWin32\lib contains only four files, none concerning jpeg

     
  • Ethan Merritt
    Ethan Merritt
    2013-04-23

    • status: open --> closed
    • Group: -->