unable to build gprc with msys and mingw32

597 views
Skip to first unread message

dev.pet...@gmail.com

unread,
May 10, 2015, 7:16:10 AM5/10/15
to grp...@googlegroups.com

Hello,
i followed the instructions in grpc/grpc/INSTALL. I tried to build the source on windows (64 bit) with mingw32. After a while i get these error:

Any ideas what i am missing?

Regards

Nicolas Noble

unread,
May 10, 2015, 3:09:42 PM5/10/15
to dev.pet...@gmail.com, grp...@googlegroups.com
This would indicate you're using the cygwin compiler instead of the mingw compiler. The proper mingw compiler should define _WIN32.

Could you paste the results of the following commands ?

gcc --version
gcc -dM -E - < /dev/null

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/57182ca3-ad2c-46f0-869b-49abd49502a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dev.pet...@gmail.com

unread,
May 11, 2015, 3:30:32 AM5/11/15
to grp...@googlegroups.com, dev.pet...@gmail.com
Here you can see the result of the comands. As you can see there is no _WIN32 defined...

$ gcc --version
gcc (GCC) 3.4.4 (msys special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -dM -E -< /dev/null
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 65535U
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 2
#define __DBL_MIN_10_EXP__ (-307)
#define __FINITE_MATH_ONLY__ 0
#define __GNUC_PATCHLEVEL__ 4
#define _stdcall __attribute__((__stdcall__))
#define __SHRT_MAX__ 32767
#define __LDBL_MAX__ 1.18973149535723176502e+4932L
#define __unix 1
#define __LDBL_MAX_EXP__ 16384
#define __SCHAR_MAX__ 127
#define __USER_LABEL_PREFIX__ _
#define __STDC_HOSTED__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __DBL_DIG__ 15
#define __FLT_EPSILON__ 1.19209290e-7F
#define __tune_i686__ 1
#define __LDBL_MIN__ 3.36210314311209350626e-4932L
#define __unix__ 1
#define __DECIMAL_DIG__ 21
#define __LDBL_HAS_QUIET_NAN__ 1
#define __GNUC__ 3
#define _cdecl __attribute__((__cdecl__))
#define __MSYS__ 1
#define __DBL_MAX__ 1.7976931348623157e+308
#define __DBL_HAS_INFINITY__ 1
#define _fastcall __attribute__((__fastcall__))
#define __USING_SJLJ_EXCEPTIONS__ 1
#define __DBL_MAX_EXP__ 1024
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __GXX_ABI_VERSION 1002
#define __FLT_MIN_EXP__ (-125)
#define __DBL_MIN__ 2.2250738585072014e-308
#define __DBL_HAS_QUIET_NAN__ 1
#define __REGISTER_PREFIX__
#define __cdecl __attribute__((__cdecl__))
#define __NO_INLINE__ 1
#define __i386 1
#define __FLT_MANT_DIG__ 24
#define __VERSION__ "3.4.4 (msys special)"
#define _X86_ 1
#define i386 1
#define unix 1
#define __i386__ 1
#define __SIZE_TYPE__ unsigned int
#define __FLT_RADIX__ 2
#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
#define __CYGWIN__ 1
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define __LONG_MAX__ 2147483647L
#define __FLT_HAS_INFINITY__ 1
#define __stdcall __attribute__((__stdcall__))
#define __LDBL_MANT_DIG__ 64
#define __WCHAR_TYPE__ short unsigned int
#define __FLT_DIG__ 6
#define __INT_MAX__ 2147483647
#define __FLT_MAX_EXP__ 128
#define __DBL_MANT_DIG__ 53
#define __WINT_TYPE__ unsigned int
#define __LDBL_MIN_EXP__ (-16381)
#define __LDBL_MAX_10_EXP__ 4932
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define __tune_pentiumpro__ 1
#define __fastcall __attribute__((__fastcall__))
#define __CYGWIN32__ 1
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __FLT_MAX__ 3.40282347e+38F
#define __FLT_MIN_10_EXP__ (-37)
#define __GNUC_MINOR__ 4
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
#define __PTRDIFF_TYPE__ int
#define __LDBL_MIN_10_EXP__ (-4931)
#define __LDBL_DIG__ 18
#define __declspec(x) __attribute__((x))

Nicolas Noble

unread,
May 11, 2015, 3:44:35 AM5/11/15
to dev.pet...@gmail.com, grp...@googlegroups.com
gcc 3.4.4 ?! This is an insanely old version of the compiler. It was released 10 years ago. Although the "(msys special)" portion might still mean it's a separate branch.

But in all cases, it DOES define "CYGWIN" and "CYGWIN32", and not MINGW, so this is indeed the cygwin compiler you're using, not the mingw one. May I ask how you got that environment installed ? I am curious now.


I've update the installation instruction with how to build gRPC under MSYS2. My compiler version under that environment is "gcc.exe (Rev5, Built by MSYS2 project) 4.9.2", and the dump of its system defines is available here: https://gist.github.com/nicolasnoble/3d4d886f3025cc45a0f8

You can see that it's properly defining WIN32 and all of its variants, as well as MINGW32. CYGWIN or any variant thereof is absent.

dev.pet...@gmail.com

unread,
May 11, 2015, 6:04:23 AM5/11/15
to grp...@googlegroups.com, dev.pet...@gmail.com
After recognizing the old Version of gcc I had a deeper look at mingw and msys. The old gcc-version came from the package msys-gcc... Not the gcc i wanted to use :) But compiling still doesnt work for me. Now it says: 

[C]       Compiling src/core/support/alloc.c
[C]       Compiling src/core/support/cancellable.c
In file included from include/grpc/support/sync.h:62:0,
                 from src/core/support/cancellable.c:37:
include/grpc/support/sync_win32.h:46:1: error: unknown type name 'CONDITION_VARI
ABLE'
 typedef CONDITION_VARIABLE gpr_cv;
 ^
include/grpc/support/sync_win32.h:48:1: error: unknown type name 'INIT_ONCE'
 typedef INIT_ONCE gpr_once;
 ^
make: *** [objs/opt/src/core/support/cancellable.o] Error 1

dev.pet...@gmail.com

unread,
May 11, 2015, 7:15:34 AM5/11/15
to grp...@googlegroups.com
PS.: Now the version is of gcc is 4.8.1

Nicolas Noble

unread,
May 11, 2015, 1:27:54 PM5/11/15
to dev.pet...@gmail.com, grp...@googlegroups.com
My gut feeling now is that this compiler is targetting Windows XP by default. CONDITION_VARIABLE and INIT_ONCE were added in Windows Vista. In fact, there are numerous other features that we're using that require Vista as the oldest version of Windows.

Our current usage of the WINVER and _WIN32_WINNT macros isn't really great. Here's a patch that tries to solve that: https://github.com/nicolasnoble/grpc/commit/ccaebb46164f758e4d974736895ee54e2815bfbd

Could you give it a try and tell me if that solves your issue ?

Thanks!

dev.pet...@gmail.com

unread,
May 23, 2015, 3:24:10 PM5/23/15
to grp...@googlegroups.com, dev.pet...@gmail.com
Thanks for your effort. The problem was mingw32. Your patch didnt worked for me. I think its more a general problem with mingw32. With mingw64 its working properly. 
Reply all
Reply to author
Forward
0 new messages