Error when compiling simple LLVM example with Mingw

956 Views Asked by At

I'm trying to learn about LLVM API working on Windows, I have installed LLVM 3.6 (llvm tools, clang, etc) successfully, have Mingw and I'm trying to compile this example.

both commmands work on my environment:

clang -c -emit-llvm test.c -o test.ll
llc -march=cpp test.ll -o test.cpp

but when trying to compile this new test.cpp file I got:

C:\Users\Alex\Desktop>clang test.cpp `llvm-config --cxxflags --ldflags --libs core` -o test
clang.exe: error: unsupported option '--cxxflags'
clang.exe: error: unsupported option '--ldflags'
clang.exe: error: unsupported option '--libs'
clang.exe: error: no such file or directory: '`llvm-config'
clang.exe: error: no such file or directory: 'core`'

Any idea? I'm very newbie using LLVM.

1

There are 1 best solutions below

2
On BEST ANSWER

It looks like you are using Windows' cmd.exe as your shell, (i.e. command interpreter), but you are attempting to invoke the clang command using a Unix Bourne shell syntax, (the back-tick quoted llvm-config command substitution), which cmd.exe simply doesn't understand.

If you want to use this command syntax, then you'd better find a more capable shell than cmd.exe; perhaps try MSYS or cygwin.