I'm no experienced LLVM user, but I'm trying to compile a Linux LLVM project on Windows. The project is GHDL.
Because ready-to-use LLVM installers for Windows don't have llvm-config
bundled, I needed to compile LLVM and clange from sources. The project requires LLVM 3.5.
So first, I downloaded llvm-3.5.2
and clang-3.5.2
and used CMake to translate it into Visual Studio 2013 projects. Then I used VS2013 to compile it.
The original makefile calls llvm-config
. The resulting string is passed 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'm using PowerShell to call llvm-config
and store the result in a variable:
$LLVM_CONFIG_RESULT = & $LLVM_CONFIG --cxxflags
The result is:
-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 several problems:
- Some paths have
/
instead of\
-IC:\Tools\LLVM-3.5/include
- Some switches and parameters are used with
-
others with/
... -IC:\Tools\LLVM-3.5/include /DWIN32 /D_WINDOWS ...
- Some parameters are delimited by more then one space sign
... /W3 /MP ...
- clang++.exe prints errors on unknown arguments:
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'
The result is now included into the clang++.exe call, which causes errors.
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'
So here are my questions:
- Why does
llvm-config
emit false results on Windows? - How can I fix it?
- What are these
-wd***
switches for?