Hi Bram, Sorry for the late reply.
2018/5/24 Thu 4:52:51 UTC+9 Bram Moolenaar wrote: > Ken Takata wrote: > > > 2018/5/21 Mon 1:30:53 UTC+9 Bram Moolenaar wrote: > > > I want to try debugging on MS-Windows with gdb. I normally build with > > > MSVC, but I don't see a way to use that executable with gdb (perhaps > > > it's possible with some compiler flag?). > > > > > > So I'll use MinGW for compiling. MinGW provides gcc and make, so I > > > expect this to work: > > > make -f Make_ming.mak GUI=no DEBUG=yes > > > > > > This gives an error in diff.c: > > > storage size of 'st' isn't known. > > > > > > Hmm. I can work around it by changing the condition in vim.h: > > > > > > /* Use 64-bit stat structure if available. */ > > > #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) > > > # define HAVE_STAT64 > > > typedef struct _stat64 stat_T; > > > #else > > > typedef struct stat stat_T; > > > #endif > > > > > > So use "struct stat". I wonder why this change is needed. perhaps the > > > #ifdef is wrong? > > > > > > Then it compiles many files but fails when building iscygpty.c . > > > It complains that _WIN32_WINNT and WINVER differ. That's because the > > > build file has: > > > > > > $(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL) > > > $(CC) -c $(CFLAGS) iscygpty.c -o $(OUTDIR)/iscygpty.o -U_WIN32_WINNT > > > -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL > > > > > > Overruling _WIN32_WINNT for one file seems like a bad idea, why was this > > > added? But building iscygpty.c with WINVER set to 0x0501 apparently > > > doesn't work. > > > > > > So instead I specify WINVER to be 0x0600. I wonder how it can ever work > > > without that. Perhaps we should make it the default? > > > > For iscygpty.c, how about adding `-UWINVER -DWINVER=0x0600`? (Not tested.) > > iscygpty requires new Win32 APIs which were added in Windows Vista. > > Does it make sense to require WINVER 0x0600 here while 0x501 is the > default above? Doesn't it mean the binary won't work properly on > Windows XP anyway? Then we might as well make 0x0600 the default. And > add a comment to use 0x0501 for XP, and the need to disable using > iscygpty. I set up iscygpty to use dynamic loading so that it can be executed on XP. Even though, it uses some definitions for Vista APIs, therefore it requires WINVER=0x0600. This doesn't affect other parts of Vim, so we can use other value for the default of WINVER (if needed). > > For the other problem, I think your MinGW is too old. (The above problem > > should be caused by the same reason, though.) > > I highly recommend you to use MinGW-w64 instead of the original MinGW (which > > looks dead). > > I ran the installer to update, but it appears nothing happened. > > > There are some distributions which provide binary packages of MinGW-w64, > > and I think MSYS2 is the best. (https://www.msys2.org/) > > > > If we still need to support the original MinGW, we might need some > > modifications to the codes and makefiles. However, I can't help it, > > because I have already uninstalled the original MinGW. > > I think the main use of MinGW is to build without MSVC. And since it's > freely available there shouldn't be much problem getting the latest > version. > > So how about updating the instructions to add a step-by-step > explanation how to build Vim with MinGW? Including hints how to get the > latest version (and possibly deleting the old one, if that is needed). Okay, we might need a step-by-step instruction how to setup MSYS2 for building Vim. The msys2 installer just installs a basic environment. Each user need to install GCC and other development packages by using the `pacman` command. # Setup msys2 environment for building Vim 1. Setup the basic msys2 environment Go to the official page of MSYS2: https://www.msys2.org Download an installer: * msys2-x86_64-YYYYMMDD.exe for 64-bit Windows (Even if you want to build 32-bit Vim) * msys2-i686-YYYYMMDD.exe for 32-bit Windows Follow the official instructions to update basic packages. Execute `pacman -Syu` and restart MSYS2 window (select "MSYS2 MSYS" icon from the Start Menu), then execute `pacman -Su`. If pacman complains that `catgets` and `libcatgets` conflict with another package, select `y` to remove them. 2. Install additional packages for building Vim The following package groups are required for building Vim: * base-devel * mingw-w64-i686-toolchain (for building 32-bit Vim) * mingw-w64-x86_64-toolchain (for building 64-bit Vim) Open the "MSYS2 MSYS" icon from the Start Menu, then you can use the following command to install them: pacman -S base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain Or you can use the `pacboy` command to avoid long package names: pacboy -S base-devel: toolchain:m (See `pacboy help` for the help.) 3. Keep the build environment up-to-date After you have installed the build environment, you may want to keep it up-to-date (E.g. always use the latest GCC). In that case, you just need to execute the command `pacman -Syu` once or twice. # Build Vim Select one of the following icon from the Start Menu: * MSYS2 MinGW 32-bit (To build 32-bit versions of Vim) * MSYS2 MinGW 64-bit (To build 64-bit versions of Vim) Go to the source directory of Vim, then execute the make command. E.g.: make -f Make_mingw.mak GUI=yes Regards, Ken Takata -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
