Why llvm-config on Windows does not give the correct parameters for clang ++. Exe?

I am not an experienced LLVM user, but I am trying to compile the LLVM Linux project on Windows. The project is GHDL.

Since the ready-to-use LLVM installers for Windows do not contain llvm-config, I needed to compile LLVM and clange from sources. The project requires LLVM 3.5.

So, first I downloaded llvm-3.5.2and clang-3.5.2used CMake to translate it into Visual Studio 2013 projects. Then I used VS2013 to compile it.

The original make file calls llvm-config. The resulting string is transmitted to clang++:

clang++ -c -I`/usr/lib/llvm-3.5/bin/llvm-config --includedir --cflags --cxxflags` -o llvm-cbindings.o src/ortho/llvm/llvm-cbindings.cpp

I use PowerShell to call llvm-configand save the result in a variable:

$LLVM_CONFIG_RESULT = & $LLVM_CONFIG --cxxflags

Result:

-IC:\Tools\LLVM-3.5/include  /DWIN32 /D_WINDOWS /W3     /MP -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4180 -wd4244 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4722 -wd4800 -w14062 -we4238 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

I notice a few problems:

  • / \
    -IC:\Tools\LLVM-3.5/include
  • - /
    ... -IC:\Tools\LLVM-3.5/include /DWIN32 /D_WINDOWS ...

  • ... /W3 /MP ...
  • clang++. exe :

    clang++. exe: error: : '-wd4146'
    clang++. exe: error: : '-wd4180'
    clang++. exe: error: : '-wd4244'
    clang++. exe: error: : '-wd4267'
    clang++. exe: error: : '-wd4291'
    clang++. exe: : : '-wd4345'
    clang++. exe: error: : '-wd4351'
    clang++. exe: error: : '-wd4355'
    clang++. exe: : : '-wd4503'
    clang++. exe: error: : '-wd4624'
    clang++. exe: error: : '-wd4722'
    clang++. exe: error: : '-wd4800'
    clang++. exe: error: : '-w14062'
    clang++. exe: error: : '-we4238'

clang++. exe, .

Command: 'C:\Tools\LLVM-3.5\bin\clang++.exe -c -c -v -IC:\Tools\LLVM-3.5/include  /DWIN32 /D_WINDOWS /W3     /MP -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4180 -wd4244 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4722 -wd4800 -w14062 -we4238 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -o llvm-cbindings.o ../../src\ortho\llvm\llvm-bindings.cpp -o llvm-cbindings.o ../../src\ortho\llvm\llvm-cbindings.cpp'  
clang++.exe: error: unknown argument: '-wd4146'  
clang++.exe: error: unknown argument: '-wd4180'  
clang++.exe: error: unknown argument: '-wd4244'  
clang++.exe: error: unknown argument: '-wd4267'  
clang++.exe: error: unknown argument: '-wd4291'  
clang++.exe: error: unknown argument: '-wd4345'  
clang++.exe: error: unknown argument: '-wd4351'  
clang++.exe: error: unknown argument: '-wd4355'  
clang++.exe: error: unknown argument: '-wd4503'  
clang++.exe: error: unknown argument: '-wd4624'  
clang++.exe: error: unknown argument: '-wd4722'  
clang++.exe: error: unknown argument: '-wd4800'  
clang++.exe: error: unknown argument: '-w14062'  
clang++.exe: error: unknown argument: '-we4238'  
clang version 3.5.2 (tags/RELEASE_352/final)  
Target: i686-pc-windows-msvc  
Thread model: posix  
clang++.exe: error: no such file or directory: '/DWIN32'  
clang++.exe: error: no such file or directory: '/D_WINDOWS'  
clang++.exe: error: no such file or directory: '/W3'  
clang++.exe: error: no such file or directory: '/MP'  

, :

  • llvm-config Windows?
  • ?
  • -wd*** ?
+4
2

llvm-config Windows?

?

. llvm-config , Windows. clang++ , GNU (g++ ..). Windows (clang-cl) Visual Studio , llvm-config.

clang++, , :

PS C:\Users\XXX> clang++ -wd4146
clang++.exe: error: unknown argument: '-wd4146'
clang++.exe: error: no input files

clang-cl:

PS C:\Users\XXX> clang-cl -wd4146
clang-cl.exe: error: no input files

. , GNU Visual Studio . :

-wd ***?

-wd *** , 4146 :

C4146: unary minus operator applied to unsigned type, result still unsigned
+5

, , Clang llvm-config Powershell:

> clang $($(llvm-config --cxxflags).split())

- lvm-config clang.

0

Source: https://habr.com/ru/post/1623409/


All Articles