[cfe-dev] Problem building latest llvm/clang on Windows using gcc-5.3

Edward Diener via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 28 20:55:35 PDT 2016


When I try to build the latest llvm/clang on Windows with 
mingw-64/gcc-5.3 I get a slew of errors:

> [4/1059] Building C object projects/co...file-i386.dir/InstrProfilingUtil.c.obj
> FAILED: C:\Utilities\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin\gcc
> .exe  -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MA
> CROS -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializ
> ers -pedantic -Wno-long-long -Wno-comment -Wall -O3  -Iprojects/compiler-rt/lib/
> profile -IE:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile -I
> include -IE:/Programming/VersionControl/llvm/include    -UNDEBUG  -m32 -DCOMPILE
> R_RT_HAS_ATOMICS=1 -MMD -MT projects/compiler-rt/lib/profile/CMakeFiles/clang_rt
> .profile-i386.dir/InstrProfilingUtil.c.obj -MF projects/compiler-rt/lib/profile/
> CMakeFiles/clang_rt.profile-i386.dir/InstrProfilingUtil.c.obj.d -o projects/comp
> iler-rt/lib/profile/CMakeFiles/clang_rt.profile-i386.dir/InstrProfilingUtil.c.ob
> j   -c E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/Instr
> ProfilingUtil.c
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/InstrProfili
> ngUtil.c:21:25: fatal error: sys/utsname.h: No such file or directory
> compilation terminated.
> [4/1059] Building C object projects/co..._rt.profile-i386.dir/WindowsMMap.c.obj
> FAILED: C:\Utilities\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin\gcc
> .exe  -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MA
> CROS -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializ
> ers -pedantic -Wno-long-long -Wno-comment -Wall -O3  -Iprojects/compiler-rt/lib/
> profile -IE:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile -I
> include -IE:/Programming/VersionControl/llvm/include    -UNDEBUG  -m32 -DCOMPILE
> R_RT_HAS_ATOMICS=1 -MMD -MT projects/compiler-rt/lib/profile/CMakeFiles/clang_rt
> .profile-i386.dir/WindowsMMap.c.obj -MF projects/compiler-rt/lib/profile/CMakeFi
> les/clang_rt.profile-i386.dir/WindowsMMap.c.obj.d -o projects/compiler-rt/lib/pr
> ofile/CMakeFiles/clang_rt.profile-i386.dir/WindowsMMap.c.obj   -c E:/Programming
> /VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.c
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c: In function 'mmap':
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:42:3: error: unknown type name 'DWORD'
>    DWORD flProtect;
>    ^
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:45:19: error: 'PAGE_EXECUTE_READWRITE' undeclared (first use in this function)
>
>        flProtect = PAGE_EXECUTE_READWRITE;
>                    ^
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:45:19: note: each undeclared identifier is reported only once for each functio
> n it appears in
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:47:19: error: 'PAGE_READWRITE' undeclared (first use in this function)
>        flProtect = PAGE_READWRITE;
>                    ^
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:50:19: error: 'PAGE_EXECUTE_READ' undeclared (first use in this function)
>        flProtect = PAGE_EXECUTE_READ;
>                    ^
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:52:19: error: 'PAGE_EXECUTE' undeclared (first use in this function)
>        flProtect = PAGE_EXECUTE;
>                    ^
> E:/Programming/VersionControl/llvm/projects/compiler-rt/lib/profile/WindowsMMap.
> c:54:17: error: 'PAGE_READONLY' undeclared (first use in this function)
>      flProtect = PAGE_READONLY;

etc. etc.

Previous builds of llvm/clang with mingw-64/gcc on Windows worked fine.

Any ideas why this got broken and what is needed to fix it so I can 
build the latest clang on Windows with gcc ?

I use CMake to configure and generate the build using ninja with gcc as 
the compiler, and then I use ninja to kick off the build.





More information about the cfe-dev mailing list