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

Meson + clang-cl with ASAN, UBSAN, etc build for Windows #10115

Open
XVilka opened this issue May 17, 2018 · 18 comments
Open

Meson + clang-cl with ASAN, UBSAN, etc build for Windows #10115

XVilka opened this issue May 17, 2018 · 18 comments
Labels
buildsystem Windows Microsoft Windows platform support issues

Comments

@XVilka
Copy link
Contributor

XVilka commented May 17, 2018

We have enough power at our paid AppVeyor account. Would be nice to have the version for Windows with all sanitizers enabled, which will help us to catch the bugs easier.

See https://clang.llvm.org/docs/MSVCCompatibility.html and Google Chrome success story http://blog.llvm.org/2018/03/clang-is-now-used-to-build-chrome-for.html

@XVilka XVilka added good first issue Windows Microsoft Windows platform support issues buildsystem labels May 17, 2018
@pelijah
Copy link
Contributor

pelijah commented May 17, 2018

@radare radare added this to To do in New Contributors Sep 21, 2018
@XVilka
Copy link
Contributor Author

XVilka commented Nov 14, 2018

@pelijah it was fixed by mesonbuild/meson#4250

@pelijah
Copy link
Contributor

pelijah commented Mar 15, 2019

C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2653:1: error: conflicting types for '_bittest'
_bittest (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2653:1: note: '_bittest' is a builtin with type 'unsigned char (const long *, long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2677:1: error: conflicting types for '_interlockedbittestandset'
_interlockedbittestandset (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2677:1: note: '_interlockedbittestandset' is a builtin with type 'unsigned char (volatile long *, long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2683:1: error: conflicting types for '_interlockedbittestandreset'
_interlockedbittestandreset (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2683:1: note: '_interlockedbittestandreset' is a builtin with type 'unsigned char (volatile long *, long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2689:1: error: conflicting types for '_bittest64'
_bittest64 (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2689:1: note: '_bittest64' is a builtin with type 'unsigned char (const long long *, long long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2713:1: error: conflicting types for '_interlockedbittestandset64'
_interlockedbittestandset64 (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2713:1: note: '_interlockedbittestandset64' is a builtin with type 'unsigned char (volatile long long *, long long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2719:1: error: conflicting types for '_interlockedbittestandreset64'
_interlockedbittestandreset64 (
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2719:1: note: '_interlockedbittestandreset64' is a builtin with type 'unsigned char (volatile long long *, long long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\winnt.h:2889:1: error: conflicting types for '_InterlockedIncrement16'
InterlockedIncrement16 (
^

@XVilka
Copy link
Contributor Author

XVilka commented Mar 18, 2019

@pelijah what version of Clang/LLVM you are using?

@pelijah
Copy link
Contributor

pelijah commented Mar 18, 2019

7.0.1

@XVilka
Copy link
Contributor Author

XVilka commented Mar 18, 2019

TOO OLD. Try with 8.0.0-rc5 (release is a matter of days now).

@pelijah
Copy link
Contributor

pelijah commented Mar 18, 2019

[1/1116] Compiling C object shlr/cafa177@@r2windbg@sta/windbg_kd.c.obj.
FAILED: shlr/cafa177@@r2windbg@sta/windbg_kd.c.obj
clang @shlr/cafa177@@r2windbg@sta/windbg_kd.c.obj.rsp
Assertion failed: !isAnnotation() && "Annotation tokens have no length field", file C:\src\llvm_package_800-rc5\llvm\tools\clang\include\clang/Lex/Token.h, line 128
0x00007FF6F7892B76 (0x0000000000000016 0x00007FF6F7892B70 0x000000B300000000 0x00007FFD57EBA510)
0x00007FFD57E3DA2D (0x0000000000000001 0x00007FF600000000 0x0000000000000080 0x00007FF6FAD5D43E), raise() + 0x1DD bytes(s)
0x00007FFD57E3E901 (0x00007FFD00000003 0x00007FFD00000003 0x00007FF6FAD5D43E 0x00007FF6FAD5C2B0), abort() + 0x31 bytes(s)
0x00007FFD57E40261 (0x0000000000000080 0x00007FF6FAD5D43E 0x00007F0100000000 0x0000EBDB6EC94E5D), _get_wpgmptr() + 0x18A1 bytes(s)
0x00007FFD57E40591 (0x00000000001B90AD 0x00000000801B90AD 0x00000205B58EFCF0 0x000000B3A0D8C7E0), _wassert() + 0x71 bytes(s)
0x00007FF6F9993F61 (0x00000000000071E6 0x000000B3A0D8C787 0x000000B3A0D8C770 0x00000205B585883E)
0x00007FF6F99917AA (0x00000001001A42DF 0x0000000000000000 0x000000000000003E 0x00000008001A42E5)
0x00007FF6F9991240 (0x00000001001A4308 0x0000000000000000 0x0000000000000013 0x00000001001A4309)
0x00007FF6F9977C54 (0x00000205B58119A8 0x00000000001A412F 0x00000205B5858400 0x0000000000000008)
0x00007FF6F996CD46 (0x00000205B513F8C0 0x00007FF6F9932CE4 0x0000EBDB6EC95E3D 0x0000000000010000)
0x00007FF6F99328D5 (0x000000B3A0D8D8CF 0x000000B3001A3FCC 0x00000205001A4004 0x000000B3A0D8DAF0)
0x00007FF6F9925A6C (0x00000205B51D4AD0 0x00000205B51D4AB8 0x00000205B51D4AE8 0x010000B3A0D8D901)
0x00007FF6F992A867 (0x00000000001A3543 0x00000205B51D4AC0 0x0000000000000000 0x0000EBDB6EC95C8D)
0x00007FF6F99293A8 (0x0000EBDB6EC9530D 0x000000B3A0D8DAF0 0x0000000000000003 0x00000205B51D4AB0)
0x00007FF6F9932CE4 (0x00000205B5721F98 0x0000020100000000 0x0000EBDB6EC9526D 0x0000EBDB6EC9531D)
0x00007FF6F8CB77A6 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF6F8CB7030 (0x00000205B51D4AB0 0x00007FF6FAE1796F 0x0000000000000000 0x00007FF6F99293A8)
0x00007FF6F8CB59AD (0x00000205B513E970 0x00007FF6F9B67E7C 0x00000205B51D4AB0 0x00007FF6F9B78600)
0x00007FF6F8CB4635 (0x0000000000000009 0x0000000000000013 0x00007FF6FA89F3E6 0x0000000000000004)
0x00007FF6F8CB0706 (0x0000000000000000 0x0000000000000000 0x00000205B513C610 0x00000205B50E9930)
0x00007FF6F80249B0 (0x00000000000000C0 0x00000205B5164E30 0x00000205B50E9930 0x00000205B5128AB0)
0x00007FF6F7FE051F (0x00000205B510E701 0x0000000000000000 0x0000000000000000 0x0000000000000055)
0x00007FF6F8081E37 (0x00000205B50E0000 0x0000000000800003 0x0000000000001000 0x0000000000001010)
0x00007FF6F5CB75F7 (0x00000000000006A6 0x0000000000000000 0x0000000008000008 0x00000000000006B0)
0x00007FF6F5CB47D2 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF6F9B73D00 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FFD5BAA81F4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFD5BBEA251 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 8.0.0 (tags/RELEASE_800/rc5)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

@XVilka
Copy link
Contributor Author

XVilka commented Mar 18, 2019

can you please paste output with -v? I am reporting bug to Clang devs.

@XVilka
Copy link
Contributor Author

XVilka commented Mar 18, 2019

@pelijah
Copy link
Contributor

pelijah commented Mar 18, 2019

Preprocessed source(s) and associated run script(s):
Temp.zip

@pelijah
Copy link
Contributor

pelijah commented Mar 18, 2019

Another example:

[13/971] Compiling C object libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.obj.
FAILED: libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.obj 
clang @libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.obj.rsp
clang version 8.0.0 (tags/RELEASE_800/rc5)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
 "C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows-msvc19.16.27027 -emit-obj -mincremental-linker-compatible -disable-free -main-file-name io_windbg.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -momit-leaf-frame-pointer -v -coverage-notes-file "C:\\dev\\radare2\\build_clang\\libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.gcno" -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\8.0.0" -dependency-file "libr/io\\4d97eb2@@r_io@sha\\p_io_windbg.c.obj.d" -sys-header-deps -MT libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.obj -I "libr/io\\4d97eb2@@r_io@sha" -I . -I "..\\" -I "..\\libr/include" -I "..\\libr/include/msvc" -I "..\\shlr\\sdb/src" -I "..\\shlr\\bochs/include" -I "..\\shlr\\./gdb/include" -I "..\\shlr\\./gdb/include/gdbclient" -I "..\\shlr\\./gdb/include/gdbserver" -I "..\\shlr\\windbg" -I "..\\shlr\\qnx/include" -I "..\\shlr\\zip/include" -I "..\\shlr\\ar" -D _CRT_SECURE_NO_WARNINGS -D _CRT_NONSTDC_NO_DEPRECATE -D CORELIB=1 -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\8.0.0\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17134.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17134.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17134.0\\winrt" -O3 -Wall -Winvalid-pch -fdebug-compilation-dir "C:\\dev\\radare2\\build_clang" -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -pthread -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.16.27027 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -fcolor-diagnostics -o libr/io/4d97eb2@@r_io@sha/p_io_windbg.c.obj -x c ../libr/io/p/io_windbg.c -faddrsig
clang -cc1 version 8.0.0 based upon LLVM 8.0.0-rc5 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 libr/io\4d97eb2@@r_io@sha
 .
 ..
 ..\libr/include
 ..\libr/include/msvc
 ..\shlr\sdb/src
 ..\shlr\bochs/include
 ..\shlr\./gdb/include
 ..\shlr\./gdb/include/gdbclient
 ..\shlr\./gdb/include/gdbserver
 ..\shlr\windbg
 ..\shlr\qnx/include
 ..\shlr\zip/include
 ..\shlr\ar
 C:\Program Files\LLVM\lib\clang\8.0.0\include
 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt
 C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared
 C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um
 C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt
End of search list.
Assertion failed: !isAnnotation() && "Annotation tokens have no length field", file C:\src\llvm_package_800-rc5\llvm\tools\clang\include\clang/Lex/Token.h, line 128
0x00007FF6F7892B76 (0x0000000000000016 0x00007FF6F7892B70 0x000000FA00000000 0x00007FFD57EBA510)
0x00007FFD57E3DA2D (0x0000000000000001 0x00007FF600000000 0x0000000000000080 0x00007FF6FAD5D43E), raise() + 0x1DD bytes(s)
0x00007FFD57E3E901 (0x00007FFD00000003 0x00007FFD00000003 0x00007FF6FAD5D43E 0x00007FF6FAD5C2B0), abort() + 0x31 bytes(s)
0x00007FFD57E40261 (0x0000000000000080 0x00007FF6FAD5D43E 0x00007F0100000000 0x00007DF7F384E467), _get_wpgmptr() + 0x18A1 bytes(s)
0x00007FFD57E40591 (0x000000000133F088 0x000000008133F088 0x000001FEDD07DFF0 0x000000FA0538C160), _wassert() + 0x71 bytes(s)
0x00007FF6F9993F61 (0x0000000000000111 0x000001FED8BEDC90 0x0000000000049874 0x000001FED8BFAC80)
0x00007FF6F99917AA (0x000000010133E76A 0x0000000000000000 0x000000000000003E 0x000000080133E770)
0x00007FF6F9991240 (0x000000010133E793 0x0000000000000000 0x0000000000000013 0x000000010133E794)
0x00007FF6F9977C54 (0x000001FEDD075FB0 0x000000000133E5BA 0x000001FEDB5F3AF0 0x0000000000000008)
0x00007FF6F996CD46 (0x000001FED8BEEBE0 0x00007FF6F9932CE4 0x00007DF7F3849407 0x0000000000010000)
0x00007FF6F99328D5 (0x000000FA0538D24F 0x000000FA0133E457 0x000001FE0133E48F 0x000000FA0538D470)
0x00007FF6F9925A6C (0x000001FED8C82AE0 0x000001FED8C82AC8 0x000001FED8C82AF8 0x010000FA0538D301)
0x00007FF6F992A867 (0x000000000133D9CE 0x000001FED8C82AD0 0x0000000000000000 0x00007DF7F3848BB7)
0x00007FF6F99293A8 (0x00007DF7F3848937 0x000000FA0538D470 0x0000000000000003 0x000001FED8C82AC0)
0x00007FF6F9932CE4 (0x0000000000540000 0x000001FED9FBC820 0x000001FEDB73AF90 0x00007DF7F3848927)
0x00007FF6F8CB77A6 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF6F8CB7030 (0x000001FED8C82AC0 0x00007FF6FAE1796F 0x0000000000000000 0x00007FF6F99293A8)
0x00007FF6F8CB59AD (0x000001FED8BEDC90 0x00007FF6F9B67E7C 0x000001FED8C82AC0 0x00007FF6F9B78600)
0x00007FF6F8CB4635 (0x000000000000001F 0x0000000000000016 0x000000FA0538DA48 0x00007FFD57DDCA26)
0x00007FF6F8CB0706 (0x0000000000000000 0x0000000000000000 0x000000FA0538EE28 0x000001FED8B95F10)
0x00007FF6F80249B0 (0x00000000000000C0 0x000001FE00000000 0x000001FED8B95F10 0x000001FED8BEC930)
0x00007FF6F7FE051F (0x000001FED8BB6001 0x0000000000000000 0x0000000000000000 0x0000000000000069)
0x00007FF6F8081E37 (0x000001FED8B90000 0x0000000000800003 0x0000000000001000 0x0000000000001010)
0x00007FF6F5CB75F7 (0x00000000000006A6 0x0000000000000000 0x0000000008000008 0x00000000000006B0)
0x00007FF6F5CB47D2 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF6F9B73D00 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FFD5BAA81F4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFD5BBEA251 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 8.0.0 (tags/RELEASE_800/rc5)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
clang: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: C:\Users\XXXX\AppData\Local\Temp\io_windbg-f96a2c.c
clang: note: diagnostic msg: C:\Users\XXXX\AppData\Local\Temp\io_windbg-f96a2c.sh
clang: note: diagnostic msg: 

Files: Temp.zip

@XVilka
Copy link
Contributor Author

XVilka commented Mar 19, 2019

Sadly 8.0 is practically released, so this bug will survive until 9.0 I guess. There is no joy in this world...

@XVilka
Copy link
Contributor Author

XVilka commented Aug 16, 2019

clang-cl AppVeyor build was merged in #14814

@XVilka
Copy link
Contributor Author

XVilka commented Sep 7, 2019

Now we do wait for these being fixed in meson:

@XVilka
Copy link
Contributor Author

XVilka commented Oct 1, 2019

@pelijah you might be interested that patch for Clang that will fix that pragma problem is under review for Clang 10.0 https://reviews.llvm.org/D68114

@pelijah
Copy link
Contributor

pelijah commented Oct 1, 2019

Weird but the bug is not reproduced even on AppVeyor with its Clang 8.0.0 (https://ci.appveyor.com/project/radare/radare2/builds/27785044/job/jvd6sjvemoqstyth?fullLog=true#L44)

@XVilka
Copy link
Contributor Author

XVilka commented Oct 9, 2019

@pelijah what bug? Because pragma one was refactored in the radare2 code.

@XVilka
Copy link
Contributor Author

XVilka commented Nov 8, 2019

Landed in llvm/llvm-project@6bdfe3a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildsystem Windows Microsoft Windows platform support issues
Projects
Development

No branches or pull requests

3 participants