Menu

#1740 Building CVS using Mingw-w64 via MSYS2:

None
closed-fixed
nobody
None
2016-03-09
2016-02-10
GregJung
No

Hi guys, my platform looks like its ready to build CVS but some snags appear in the final link.
I'm doing this with gcc (Target: x86_64-w64-mingw32) from msys2, it looks like all of the support libs are ready. The host machine is a windows 7 box, gcc version is 5.2

First, I needed a small patch to find constants from help.h used in command.c:

--- a/f/tarball/gnuplot-160209/gnuplot/src/command.c
+++ b/./command.c
@@ -96,6 +96,7 @@ static char *RCSid() { return RCSid("$Id: command.c,v 1.312 2016/02/08 21:46:21
 #include "util.h"
 #include "variable.h"
 #include "external.h"
+#include "help.h"

 #ifdef USE_MOUSE
 # include "mouse.h"

But the configure needs work in that the src/win/wtext objects are not included in the link:

xis.o: In function `axis_checked_extend_empty_range':
F:\gnuplot\src/axis.c:397: undefined reference to `MyFPrintF'
axis.o: In function `clone_linked_axes':
F:\gnuplot\src/axis.c:2234: undefined reference to `MyFPrintF'
axis.o: In function `axis_checked_extend_empty_range':
F:\gnuplot\src/axis.c:406: undefined reference to `MyFPrintF'
axis.o: In function `clone_linked_axes':
F:\gnuplot\src/axis.c:2235: undefined reference to `MyFPrintF'
breaders.o: In function `edf_filetype_function':
F:\gnuplot\src/breaders.c:165: undefined reference to `MyFRead'
color.o: In function `make_palette':
F:\gnuplot\src/color.c:136: undefined reference to `MyFPrintF'
color.o: In function `draw_inside_color_smooth_box_postscript':
F:\gnuplot\src/color.c:324: undefined reference to `MyFPutS'

 ...

 F:\gnuplot\src/qtterminal/qt_term.cpp:1087: undefined reference to `MyFPrintF'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main':
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Makefile:788: recipe for target 'gnuplot.exe' failed

If I had better configure skills I'd patch this but I don't.

Discussion

  • Tatsuro MATSUOKA

    Do you use config/mingw/Makefile ?
    For MinGW build, gnuplot cannot be built by unixy way (via configure).

    Modifiy
    config/mingw/Makefile
    according to your environments and execute
    make all
    at config/mingw directory.

    BTW, windows binaries from cvs source can be found at

    http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/
    or
    http://ctan.ijs.si/mirror/w32tex/w32/

     

    Last edit: Tatsuro MATSUOKA 2016-02-10
  • Bastian Märkisch

    Indeed gnuplot's configure script does not support building with MinGW. This could certainly by fixed, but so far no one submitted patches for it. So for now please use config/mingw/Makefile instead. You can find some instructions on how to build in this tracker:
    https://sourceforge.net/p/gnuplot/support-requests/163/

     
  • Bastian Märkisch

    I had never tried MSYS2 before, but was rather stuck with the old MSYS/MinGW combination. What an improvement! It is way faster, parallel builds work and almost all required packages are readily available (expect for libgd, libcerf. htmlhelp (64bit)).

    As for htmlhelp.lib, I more or less followed the recipe outlined by Allin Cottrell:
    http://gnuplot.10905.n7.nabble.com/gnuplot-on-64-bit-Windows-again-td17580.html

     pexports.exe /c/Windows/System32/hhctrl.ocx > htmlhelp.def
     dlltool -d htmlhelp.def -l htmlhelp.lib
    

    Looks like the Makefile and the source require a few more minor tweaks. Compiling without qt/cairo/wxt worked like a charm (once I realized that I should not use the MSYS but Mingw64 compiler), but gave a fair number of warnings.

     
  • Tatsuro MATSUOKA

    This is just information.
    I am using MSYS2 for MinGW build. Msys2 sytem is built using newer version gcc comiler than that used in Msys. It is a little bit faster than Msys. The 64 bit version Msys2 supports both 32 bit ansd 64 bit MinGW build. Also It supports a lot of tool chains.
    I do not use MinGW compliers which are provides Msys2 project but use MinGW-w64 project(gcc 4.9.2).
    expeption handling : dwarf2(32bit), seh (64bit)
    thread model : win32
    In my case, almost all external libraries are built from source.

     
  • Bastian Märkisch

    • status: open --> closed-fixed
    • Group: -->
    • Priority: -->
     
  • Bastian Märkisch

    Compilation using MSYS2/Mingw-w64 is now supported out-of-the-box in CVS head.

     
  • GregJung

    GregJung - 2016-03-09

    My configuration doesn't build this yet.
    Since the original post I have upgraded gcc from 5.2 to 5.3,

    I still need the "help.h" line added to command.c. Then it compiles more modules.

    In internal.c, it is having problems with the GP_MATHERR macro and re-definition

    In file included from ../../src/stdfn.h:291:0,
                     from ../../src/internal.c:40:
    ../../src/syscfg.h:342:21: warning: '_matherr' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
     # define GP_MATHERR matherr
                         ^
    ../../src/internal.c:67:1: note: in expansion of macro 'GP_MATHERR'
     GP_MATHERR( STRUCT_EXCEPTION_P_X )
     ^
    ../../src/internal.c: In function '_matherr':
    ../../src/internal.c:68:1: error: number of arguments doesn't match prototype
     {
     ^
    In file included from ../../src/stdfn.h:291:0,
                     from ../../src/internal.c:40:
    C:/msys64/mingw32/i686-w64-mingw32/include/math.h:286:23: error: prototype declaration
       _CRTIMP int __cdecl _matherr (struct _exception *);
                           ^
    Makefile:909: recipe for target 'internal.o' failed
    make[4]: *** [internal.o] Error 1
    

    Since the original post I have upgraded (on one platform) gcc from 5.2 to 5.3,
    (this same error occurs in 5.2)

    After the above error the link still does not have compiled objects from src/win available.

    Using msys2 operating the mingworg compiler: (gcc 4.8.1, mingw 3.21)
    1. htmlhelp.h not available

    ../../src/command.c:137:23: fatal error: htmlhelp.h: No such file or directory
     # include <htmlhelp.h>
                           ^
    compilation terminated.
    

    It seems to want to build without <htmlhelp.h> but again the winmain.o is missing.

     
  • Bastian Märkisch

    Building gnuplot requires the 'Microsoft HTML Workshop', as stated in config/mingw/Makefile and the build instructions for MSYS/MinGW [support-requests:#163]. configure is still not supported using Mingw.

    Including help.h in command.c is certainly wrong. It is not needed on Windows. So the error should be somewhere else, most likely the missing HTML Workshop.

    I do not understand why you get an error in internal.c, but you can safely disable the offending code GP_MATHERR( STRUCT_EXCEPTION_P_X ) by replacing the #indef _WIN64 above the comment by an #if 0. On my system (gcc 5.3) I do not get this error.

    I just uploaded detailed build instructions for MSYS2/Mingw-w64 to [support-requests:#199].

     

    Related

    Support Requests: #199


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.