Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i686 intrinsics definitions conflict with mingw-w64 definitions #9052

Closed
jeremyd2019 opened this issue Jan 7, 2021 · 7 comments · Fixed by #8297
Closed

i686 intrinsics definitions conflict with mingw-w64 definitions #9052

jeremyd2019 opened this issue Jan 7, 2021 · 7 comments · Fixed by #8297

Comments

@jeremyd2019
Copy link
Member

I encountered this building libuv, but is an issue with clang when building with -march=i686 (which is specified in makepkg_clang32.conf), where SSE is disabled.

In file included from ../libuv-1.40.0/src/win/thread.c:29:
In file included from C:/msys64/clang32/lib/clang/11.0.0/include/intrin.h:12:
C:/msys64/clang32/i686-w64-mingw32/include/intrin.h:87:36: error: typedef redefinition with different types ('union __m64' vs '__attribute__((__vector_size__(1* sizeof(long long)))) long long' (vector of 1 'long long' value))
typedef union __m64 { char v[7]; } __m64;
                                   ^
C:/msys64/clang32/lib/clang/11.0.0/include/mmintrin.h:13:19: note: previous definition is here
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));
                  ^
In file included from ../libuv-1.40.0/src/win/thread.c:29:
In file included from C:/msys64/clang32/lib/clang/11.0.0/include/intrin.h:12:
C:/msys64/clang32/i686-w64-mingw32/include/intrin.h:90:38: error: typedef redefinition with different types ('union __m128' vs '__attribute__((__vector_size__(4 * sizeof(float)))) float' (vector of 4 'float' values))
typedef union __m128 { char v[16]; } __m128;
                                     ^
C:/msys64/clang32/lib/clang/11.0.0/include/xmmintrin.h:17:15: note: previous definition is here
typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));
              ^
In file included from ../libuv-1.40.0/src/win/thread.c:29:
In file included from C:/msys64/clang32/lib/clang/11.0.0/include/intrin.h:12:
C:/msys64/clang32/i686-w64-mingw32/include/intrin.h:93:39: error: typedef redefinition with different types ('union __m128d' vs '__attribute__((__vector_size__(2 * sizeof(double)))) double' (vector of 2 'double' values))
typedef union __m128d { char v[16]; } __m128d;
                                      ^
C:/msys64/clang32/lib/clang/11.0.0/include/emmintrin.h:15:16: note: previous definition is here
typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16)));
               ^
In file included from ../libuv-1.40.0/src/win/thread.c:29:
In file included from C:/msys64/clang32/lib/clang/11.0.0/include/intrin.h:12:
C:/msys64/clang32/i686-w64-mingw32/include/intrin.h:94:39: error: typedef redefinition with different types ('union __m128i' vs '__attribute__((__vector_size__(2 * sizeof(long long)))) long long' (vector of 2 'long long' values))
typedef union __m128i { char v[16]; } __m128i;
                                      ^
C:/msys64/clang32/lib/clang/11.0.0/include/emmintrin.h:16:19: note: previous definition is here
typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));
                  ^
4 errors generated.
make: *** [Makefile:2588: src/win/libuv_la-thread.lo] Error 1
@jeremyd2019
Copy link
Member Author

jeremyd2019 commented Jan 7, 2021

A workaround that seemed to help was adding -D__MINGW_FORCE_SYS_INTRINS to the CPPFLAGS in makepkg_clang32.conf. Not all packages seem to respect CPPFLAGS as well as they do CFLAGS though.

@mati865
Copy link
Collaborator

mati865 commented Mar 29, 2021

Okay I think know what is wrong. Going to work on it in the evening.

@mati865
Copy link
Collaborator

mati865 commented Mar 29, 2021

Minimal reproducer:

#include <intrin.h>

int main() {
    return 0;
}

@mati865
Copy link
Collaborator

mati865 commented Mar 29, 2021

@mati865
Copy link
Collaborator

mati865 commented Apr 5, 2021

In the upstream repo now: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/c1804804aff14f1b0333d782c9fac1cc904fcd9f/

MXEBot referenced this issue in mirror/mingw-w64 Apr 5, 2021
See https://github.com/msys2/CLANG-packages/issues/6 for the details

The intrin.h header tries to define types like e.g. __m64
if __MMX__ isn't defined. With Clang, mmintrin.h does define such
a type even if __MMX__ isn't defined (and mmintrin.h is included
implicitly via x86intrin.h).

This fixes including intrin.h if building with Clang with -march=i686,
which makes __MMX__ not be defined.

Signed-off-by: Martin Storsjö <martin@martin.st>
@jeremyd2019
Copy link
Member Author

jeremyd2019 commented Apr 5, 2021

I plan to wait for the time stuff (from msys2/CLANG-packages#21) to land and rebuild for both at the same time.

jeremyd2019 referenced this issue in jeremyd2019/MSYS2-packages Apr 7, 2021
This should include fixes for msys2/CLANG-packages#6 and
msys2/CLANG-packages#21
jeremyd2019 referenced this issue in jeremyd2019/MINGW-packages Apr 7, 2021
This should include fixes for msys2/CLANG-packages#6 and
msys2/CLANG-packages#21

Also remove patch from mingw-w64-headers-git which was already applied
upstream.
jeremyd2019 referenced this issue in jeremyd2019/CLANG-packages Apr 7, 2021
This should include fixes for msys2/CLANG-packages#6 and
msys2/CLANG-packages#21

Synced PKGBUILDs with MINGW-packages.
mati865 referenced this issue in msys2/CLANG-packages Apr 7, 2021
This should include fixes for msys2/CLANG-packages#6 and
msys2/CLANG-packages#21

Synced PKGBUILDs with MINGW-packages.
mingwandroid referenced this issue in mingwandroid/MINGW-packages Apr 8, 2021
This should include fixes for msys2/CLANG-packages#6 and
msys2/CLANG-packages#21

Also remove patch from mingw-w64-headers-git which was already applied
upstream.
@jeremyd2019
Copy link
Member Author

I've confirmed this is fixed now.

jeremyd2019 referenced this issue in jeremyd2019/MSYS2-packages Apr 9, 2021
This should include fixes for msys2/CLANG-packages#6,
msys2/CLANG-packages#21, and msys2/MINGW-packages#8310
atomlong referenced this issue in atomlong/MSYS2-packages Apr 14, 2021
This should include fixes for msys2/CLANG-packages#6,
msys2/CLANG-packages#21, and msys2/MINGW-packages#8310
@jeremyd2019 jeremyd2019 transferred this issue from msys2/CLANG-packages Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants