Built on MinGW and error in running basic compiation

Helo,

I built Clang using MinGW. Everything seemed to go well in the build.

However, when I ran a simple test (compilation of the following using ‘clang t.c’):

#include <stdio.h>

int main(int argc, char **argv) { printf("hello world\n"); }

I get these messages:


C:\Tools\build.llvm\testcomp>clang t.c
In file included from t.c:1:
c:/mingw/include/stdio.h:571:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  fgetwc (FILE*);
        ^
c:/mingw/include/stdio.h:571:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  fgetwc (FILE*);
               ^

In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^

In file included from t.c:1:
c:/mingw/include/stdio.h:572:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  fputwc (wchar_t, FILE*);
        ^
c:/mingw/include/stdio.h:572:16: error: expected identifier or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  fputwc (wchar_t, FILE*);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:

#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:573:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  ungetwc (wchar_t, FILE*);

        ^
c:/mingw/include/stdio.h:573:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  ungetwc (wchar_t, FILE*);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:584:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwc (FILE*);
        ^
c:/mingw/include/stdio.h:584:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwc (FILE*);
               ^

In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^

In file included from t.c:1:
c:/mingw/include/stdio.h:585:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwchar (void);
        ^
c:/mingw/include/stdio.h:585:16: error: expected identifier or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwchar (void);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:

#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:587:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwc (wint_t, FILE*);

        ^
c:/mingw/include/stdio.h:587:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwc (wint_t, FILE*);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:589:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwchar (wint_t);
        ^
c:/mingw/include/stdio.h:589:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwchar (wint_t);
               ^

In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^

In file included from t.c:1:
c:/mingw/include/stdio.h:630:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  _fgetwchar (void);
        ^
c:/mingw/include/stdio.h:630:16: error: expected identifier or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  _fgetwchar (void);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:
c:/mingw/include/_mingw.h:145:20: note: instantiated from:

#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:631:9: error: unknown type name 'wint_t'
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  _fputwchar (wint_t);

        ^
c:/mingw/include/stdio.h:631:16: error: expected identifier or '('
_CRTIMP wint_t __cdecl __MINGW_NOTHROW  _fputwchar (wint_t);
               ^
In file included from t.c:1:
In file included from c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:
#  define __cdecl  __attribute__ ((__cdecl__))
                   ^
In file included from t.c:1:
c:/mingw/include/stdio.h:636:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW  fgetwchar (void);
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Try running with -fms-extensions to enable Microsoft extensions (some of which MinGW supports).

Sean

clang -fms-extensions t.c yields the same errors regarding _wint_t.

clang -fms-extensions t.c yields the same errors regarding _wint_t.

This is bug in mingw headers. Feel free to post a problem report there.

Some information is available in
http://llvm.org/bugs/show_bug.cgi?id=7068 and around.

clang -fms-extensions t.c yields the same errors regarding _wint_t.

In case you hadn’t noticed, Sean committed a wint_t fix in r105985.

  • Doug

I did - no getting this compile error when building clang:


[ 90%] Building CXX object tools/clang/lib/Driver/CMakeFiles/clangDriver.dir/Dri

ver.cpp.obj
C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp: In member function 'clang::dri
ver::DerivedArgList* clang::driver::Driver::TranslateInputArgs(const clang::driv

er::InputArgList&) const':
C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:128:12: error: 'const class cla
ng::driver::Arg' has no member named 'containsValue'

C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:130:12: error: 'class clang::dr
iver::DerivedArgList' has no member named 'AddFlagArg'

C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:130:42: error: 'OPT_Z_Xlinker__
no_demangle' is not a member of 'clang::driver::options'
C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:135:16: error: 'class clang::dr

iver::DerivedArgList' has no member named 'AddSeparateArg'
C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:150:14: error: 'class clang::dr

iver::DerivedArgList' has no member named 'AddFlagArg'
C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:152:14: error: 'class clang::dr
iver::DerivedArgList' has no member named 'AddFlagArg'

C:\Tools\clang\tools\clang\lib\Driver\Driver.cpp:153:12: error: 'class clang::dr
iver::DerivedArgList' has no member named 'AddSeparateArg'

mingw32-make[2]: *** [tools/clang/lib/Driver/CMakeFiles/clangDriver.dir/Driver.c
pp.obj] Error 1
mingw32-make[1]: *** [tools/clang/lib/Driver/CMakeFiles/clangDriver.dir/all] Err

or 2
mingw32-make: *** [all] Error 2
 
C:\Tools\build.llvm>

Did you update both llvm and clang at the same time, and rebuild everything? It looks like you have some out-of-date code.

  • Doug

Seems like this regressed - clean checkout of code and get the error again.

Duncan McQueen <dwmcqueen@...> writes:

Helo,I built Clang using MinGW. Everything seemed to go well in the build.

However, when I ran a simple test (compilation of the following using 'clang
t.c'):#include <stdio.h>

int main(int argc, char **argv) { printf("hello world\n"); }I get these

messages:C:\Tools\build.llvm\testcomp>clang t.cIn file included from
t.c:1:c:/mingw/include/stdio.h:571:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*);

^c:/mingw/include/stdio.h:571:16: error: expected identifier or '('_CRTIMP
wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*); ^

In file included from t.c:1:In file included from

c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:# define __cdecl __attribute__
((__cdecl__)) ^

In file included from t.c:1:c:/mingw/include/stdio.h:572:9: error: unknown

type name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t,
FILE*); ^c:/mingw/include/stdio.h:572:16: error: expected identifier
or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t,

FILE*); ^In file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:

# define __cdecl __attribute__ ((__cdecl__)) ^In file

included from t.c:1:c:/mingw/include/stdio.h:573:9: error: unknown type
name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*);

        ^c:/mingw/include/stdio.h:573:16: error: expected identifier

or '('_CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t,
FILE*); ^In file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:# define __cdecl

__attribute__ ((__cdecl__)) ^In file included from
t.c:1:c:/mingw/include/stdio.h:584:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwc (FILE*);

^c:/mingw/include/stdio.h:584:16: error: expected identifier or '('_CRTIMP
wint_t __cdecl __MINGW_NOTHROW getwc (FILE*); ^

In file included from t.c:1:In file included from

c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:# define __cdecl __attribute__
((__cdecl__)) ^

In file included from t.c:1:c:/mingw/include/stdio.h:585:9: error: unknown

type name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwchar
(void); ^c:/mingw/include/stdio.h:585:16: error: expected identifier
or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwchar (void); ^In

file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:

# define __cdecl __attribute__ ((__cdecl__)) ^In file

included from t.c:1:c:/mingw/include/stdio.h:587:9: error: unknown type
name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwc (wint_t, FILE*);

        ^c:/mingw/include/stdio.h:587:16: error: expected identifier

or '('_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwc (wint_t,
FILE*); ^In file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:# define __cdecl

__attribute__ ((__cdecl__)) ^In file included from
t.c:1:c:/mingw/include/stdio.h:589:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwchar (wint_t);

^c:/mingw/include/stdio.h:589:16: error: expected identifier or '('_CRTIMP
wint_t __cdecl __MINGW_NOTHROW putwchar (wint_t); ^

In file included from t.c:1:In file included from

c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:# define __cdecl __attribute__
((__cdecl__)) ^

In file included from t.c:1:c:/mingw/include/stdio.h:630:9: error: unknown

type name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fgetwchar
(void); ^c:/mingw/include/stdio.h:630:16: error: expected identifier
or '('

_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fgetwchar (void); ^In

file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:c:/mingw/include/_mingw.h:145:20: note:
instantiated from:

# define __cdecl __attribute__ ((__cdecl__)) ^In file

included from t.c:1:c:/mingw/include/stdio.h:631:9: error: unknown type
name 'wint_t'_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fputwchar (wint_t);

        ^c:/mingw/include/stdio.h:631:16: error: expected identifier

or '('_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fputwchar
(wint_t); ^In file included from t.c:1:In file included from
c:/mingw/include/stdio.h:19:

c:/mingw/include/_mingw.h:145:20: note: instantiated from:# define __cdecl

__attribute__ ((__cdecl__)) ^In file included from
t.c:1:c:/mingw/include/stdio.h:636:9: error: unknown type name 'wint_t'

_CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwchar (void); ^fatal

error: too many errors emitted, stopping now [-ferror-limit=]20 errors
generated.-- Duncan McQueenOpenThinking Systems,
LLChttp://www.openthinkingsystems.com

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Hi:
     I am using cygwin to build llvm and clang.I meet the same question as you
description. Have you soluted the question? If you have soluted, please email
me ! Thanks you

No - it was once fixed but then looks removed. I think the true issue is in glibc, so that is why the fix was uncommitted from clang.