[PATCH] D29464: [MinGWToolChain] Don't use GCC headers on Win32

Mateusz MikuĊ‚a via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 04:45:25 PST 2017


mati865 added a comment.

@yaron.keren, @rnk I would like to see OpenMP support by MinGW Clang but using GCC "internal" headers is just wrong.

> For example, the most popular (37089 download this week) https://sourceforge.net/projects/mingw-w64 distribuion for Windows had elected to place the includes omp.h, quadmath.h, openacc.h at c:\mingw32\lib\gcc\i686-w64-mingw32\5.4.0\include\

It wasn't mingw-w64 decision but rather GCC. Linux examples:

- Arch Linux: `/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include/`
- Ubuntu 14.04: `/usr/lib/gcc/x86_64-linux-gnu/4.8/include`
- Ubuntu 17.04: `/usr/lib/gcc/x86_64-linux-gnu/6/include`

None of those directories are searched by Clang on Linux host.

> Removing the include dir will make clang less useful for mingw users using these includes, since they will not be found anymore.

I highly doubt it:

Summary:

1. quadmath.h:
  - Linux:                                    not working, quadmath. not found
  - MinGW with GCC headers:      not working, __float128 isn't supported
  - MinGW without GCC headers: not working, quadmath. not found and __float128 isn't supported
2. omp.h:
  - Linux:                                    working via http://openmp.llvm.org/
  - MinGW with GCC headers:      not working, compilation error
  - MinGW without GCC headers: not working, http://openmp.llvm.org/ is not buildable
3. openacc.h:
  - Linux:                                    not working, openacc.h not found
  - MinGW with GCC headers:      not working, not tested
  - MinGW without GCC headers: not working, openacc.h not found

Details:
**quadmath.h** is useless without __float128

Clang with enabled __float128 via patch:

  $ clang++ float128_ex.cc -std=gnu++11
  
  $ ./a
  Segmentation fault

Clang with unpatched __float128:

  $ clang++ float128_ex.cc -std=gnu++11
  
  D:\projekty\msys2\clang\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\6.3.0\include\quadmath.h:43:26: error: __float128 is not supported on this target
  extern __float128 acosq (__float128) __quadmath_throw;

GCC:

  $ g++ float128_ex.cc -lquadmath -std=gnu++11
  
  $ ./a
  r=0
  exp_d=255250

**omp.h** crashes, example https://computing.llnl.gov/tutorials/openMP/samples/C/omp_hello.c :

  $ g++ omp.cc -fopenmp
  
  $ ./a
  Hello World from thread = 0
  Hello World from thread = 1
  Number of threads = 2
  
  $ clang++ omp.cc -fopenmp
  D:\projekty\msys2\clang\msys64\tmp\omp-87d437.o:(.text+0x35): undefined reference to `__imp___kmpc_fork_call'
  clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

**openacc.h** isn't available even on Linux (openacc.h not found) and I cannot test it with MinGW


https://reviews.llvm.org/D29464





More information about the cfe-commits mailing list