[SRILM User List] Difficulty Building SRILM with mingw-w64

Andreas Stolcke stolcke at icsi.berkeley.edu
Mon Jan 16 19:17:58 PST 2012

On 1/16/2012 11:59 AM, Ryan Zeigler wrote:
> Hello SRILM mailing list,
> I am having difficulty building SRILM 1.6 using the mingw32-w64 
> toolchain on a Windows 7 x64 machine.
> In order to try and do this, I modified the win32 machine type 
> makefile to replace the bare g++/gcc invocations with the target 
> prefixed names that are installed by mingw32 and removed the 
> -mno-cygwin line. These being the relevant lines.
> CC_FLAGS = -DNEED_RAND48 -Wall -Wno-unused-variable -Wno-uninitialized
> CC = x86_64-w64-mingw32-gcc $(GCC_FLAGS) -Wimplicit-int
> CXX = x86_64-w64-mingw32-g++ $(GCC_FLAGS) -DINSTANTIATE_TEMPLATES
> When I subsequently attempt to compile, I receive the following errors 
> from matherr.c

This particular error is due to a glitch in the ifdefs.  Replace

  #if defined(__MINGW32_VERSION) || defined(_MSC_VER)


  #if defined(WIN32) || defined(_MSC_VER)

I took at stab at a mingw32-w64 build recently, and there are link-time 
errors even after everything compiles fine.
Let me know how far you get with this!


> x86_64-w64-mingw32-gcc -DNEED_RAND48 -Wall -Wno-unused-variable 
> -Wno-uninitialized -Wimplicit-int -I. -I../../include -c -g -O2 
> ../obj/x86_64-w64-mingw32_c/matherr.o matherr.c
> matherr.c:19:16: warning: ‘struct exception’ declared inside parameter 
> list
> matherr.c:19:16: warning: its scope is only this definition or 
> declaration, which is probably not what you want
> matherr.c:19:1: error: conflicting types for ‘_matherr’
> /usr/x86_64-w64-mingw32/sys-root/mingw/include/math.h:179:23: note: 
> previous declaration of ‘_matherr’ was here
> matherr.c: In function ‘_matherr’:
> matherr.c:22:10: error: dereferencing pointer to incomplete type
> matherr.c:22:36: error: dereferencing pointer to incomplete type
> matherr.c:30:1: warning: control reaches end of non-void function
> /cygdrive/c/srilm/common/Makefile.common.targets:85: recipe for target 
> `../obj/x86_64-w64-mingw32_c/matherr.o' failed
> For refrence, the definition of _matherr given is
> _CRTIMP int __cdecl _matherr (struct _exception *);
> I would appreciate any help in resolving this issue.
> Regards,
> Ryan Zeigler
> _______________________________________________
> SRILM-User site list
> SRILM-User at speech.sri.com
> http://www.speech.sri.com/mailman/listinfo/srilm-user

More information about the SRILM-User mailing list