help - compiling under cygwin

  • Paris Micky

    Paris Micky - 2005-06-10

    I've download gnuplot development version via Sourceforge CVS and GD library ( from
    I am using cygwin (I tried on other version too) on Windows XP pro, sp2.

    1. extract GD library,
    "./configure", than
    "make -f makefile" which creates "libgd.a"

    2. copy "libgd.a" to /cygwin/lib/
    copy "gd.h" to /gnuplot/term/
    copy "gd_io.h" and "gdfx.h" to /gnuplot/src/

    3. from /gnuplot/config/ to /gnuplot/src/ :
    copy "makefile.cyg" as "makefile"
    copy "config.cyg" as "config.h"

    4. in /gnuplot/src/ type "make -f makefile"

    Everything goes well until:

    gcc -s  -mwindows -mno-cygwin -o wgnuplot.exe \         alloc.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 hel
    p.o hidden3d.o history.o internal.o interpol.o matrix.o misc.o mouse.o parse.o p
    lot.o plot2d.o plot3d.o pm3d.o readline.o save.o scanner.o set.o show.o specfun.
    o standard.o stdfn.o tables.o term.o time.o unset.o util.o util3d.o variable.o v
    ersion.o gpexecute.o winmain.o wgnuplib.o wgraph.o wprinter.o wtext.o wpause.o w
    menu.o \         wgplt_res.o -L/usr/local/lib -lkernel32 -lgdi32  -lgd
    term.o(.text+0x1eeea):term.c: undefined reference to `_imp__gdImageColorExact@16
    term.o(.text+0x1eefe):term.c: undefined reference to `_imp__gdImageColorAllocate
    term.o(.text+0x1ef12):term.c: undefined reference to `_imp__gdImageColorClosest@
    term.o(.text+0x218ab):term.c: undefined reference to `_imp__gdImageDestroy@4'
    term.o(.text+0x218d2):term.c: undefined reference to `_imp__gdImageGif@8'
    term.o(.text+0x218e2):term.c: undefined reference to `_imp__gdImageDestroy@4'
    collect2: ld returned 1 exit status
    make: *** [wgnuplot.exe] Error 1

    Please help!!

    • Hans-Bernhard Broeker

      Step 2 and 3. of your procedure are mutually contradictive.  The headers of gd.h have to go more-or-less in the same hierarchy (as in /cygwin/lib and /cygwin/include, or /usr/local/lib and /usr/local/include).  The GD headers don't belong into gnuplot/term or  gnuplot/src, and they definitely should not distributed randomly across both those places.

      That may well be the cause of your problems, too.  The gd.h header it actually picked up seems to have been one meant for linking to a libgd DLL, not to a static libgd.a.

    • Paris Micky

      Paris Micky - 2005-06-16

      I've downloaded & installed cygwin 2.457.2.2 (with gd library 2.0.33-1 - "libgd.a", "libgd.dll.a" and ""). Then I extracted Gnuplot to "C:\cygwin\home\gnuplot".

      1. From "C:\cygwin\home\gnuplot\config" to "C:\cygwin\home\gnuplot\src":
      copy "makefile.cyg" as "makefile"
      copy "config.cyg" as "config.h"

      2. Under Cygwin in "C:\cygwin\home\gnuplot\src" type "make -f makefile"

      gcc -c  -O2 -I. -D_Windows -DCYGWIN -mno-cygwin -DHAVE_CONFIG_H  -DUSE_MOUSE=1 -
      AVE_GD_GIF -I../term term.c
      In file included from term.h:349,
                       from term.c:1211:
      ../term/gd.trm:145:16: gd.h: No such file or directory
      In file included from term.h:349,
                       from term.c:1211:
      ../term/gd.trm:150: error: parse error before "int"
      ../term/gd.trm:152: error: parse error before "int"
      ../term/gd.trm:154: error: parse error before "gdFontSmall"
      ../term/gd.trm:154: warning: data definition has no type or storage class
      ../term/gd.trm:2180: error: request for member `image' in something not a struct
      ure or union
      ../term/gd.trm:2181: error: request for member `image' in something not a struct
      ure or union
      term.c: At top level:
      ../term/gd.trm:933: error: storage size of `png_smooth_color' isn't known
      make: *** [term.o] Error 1

      What should I do?

      • Hans-Bernhard Broeker

        I'm not sure makefile.cyg will be able to use the Cygwin package of the GD library.  Obviously, it doesn't find the gd.h header that should have come with the library, which hints that it wouldn't find the library either.

        The problem here would be that makefile.cyg actually doesn't use the cygwin libraries --- that's what the -mno-cygwin int he GCC command lines means.  It uses the built-in copy of MinGW instead.  So you'ld need a MinGW32 version of libgd, and install that in the place where Cygwin's MinGW32 looks for it.

        Or use the Unix-ish build (configure/make), which should pick up the Cygwin version library package successfully.

    • Paris Micky

      Paris Micky - 2005-06-20

      It doesn't work :-(. I'll have to wait for a official version 4.1


Log in to post a comment.