iveney / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Patch to fix MinGW compilation #197

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
GTest 1.3.0 does not compile on MinGW, so I've patched it.

I have tested my patch on Windows and Linux, with the following configurations:

On Windows:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

Target: mingw32
Configured with: ../../gcc-4.4.1/configure --prefix=/mingw --build=mingw32
--enable-languages=c,ada,c++,fortran,objc,obj-c++ --disable-nls --dis
able-win32-registry --enable-libgomp --disable-werror --enable-threads
--disable-symvers --enable-cxx-flags='-fno-function-sections -fno-data-se
ctions' --enable-fully-dynamic-string
--enable-version-specific-runtime-libs --with-pkgversion='TDM-1 mingw32'
--program-suffix=-dw2 --disable-s
jlj-exceptions --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php
Thread model: win32
gcc version 4.4.1-dw2 (TDM-1 mingw32)

On Linux:

Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared
--enable-languages=c,c++,fortran,objc,obj-c++ --enable-threads=posix
--mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit
--disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib
--enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.4.1 (GCC) 

I ran all unit tests, and they passed on each platform.

The patch is attached.

Original issue reported on code.google.com by bmatthew...@gtempaccount.com on 17 Sep 2009 at 7:59

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Before we can accept a patch from you we have to ask you to sign a CLA as 
described
in http://code.google.com/p/googletest/wiki/GoogleTestDevGuide.

A note on the patch: as MinGW provides the Win32 API, it makes sense to tag 
MinGW
platform with GTEST_OS_WINDOWS compiler symbol in gtest-port.h:
...
#elif defined(_WIN32) || defined(__MINGW32__)
#define GTEST_OS_WINDOWS 1
...

This will lead to a simpler patch, I believe.

Regards,
Vlad

Original comment by vladlosev on 19 Sep 2009 at 8:40

GoogleCodeExporter commented 9 years ago
I'd rather not sign anything.  You can take it or leave it.  At the very least
perhaps you can see what needs to be done to make it work properly.

Original comment by bmatthew...@gtempaccount.com on 21 Sep 2009 at 4:11

GoogleCodeExporter commented 9 years ago
Kenton Varda contributed a patch to fix gtest on minGW.  It is in the trunk.  I 
just 
verified that the trunk head works on minGW.

Original comment by zhanyong...@gmail.com on 22 Sep 2009 at 8:41