Yiwei
Yiwei

Reputation: 58

About the compilation problem of Kaleidoscope in llvm tutorial

I am learning llvm.

I am trying to compile the code in Kaleidoscope Tutorial 3.6. https://llvm.org/docs/tutorial/LangImpl03.html

clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core` -o toy

I got some errors, but I don't know what to do.

clang++.exe: error: unsupported option '--cxxflags'
clang++.exe: error: unsupported option '--ldflags'
clang++.exe: error: unsupported option '--system-libs'
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 -o'
clang++.exe: error: no such file or directory: 'toy'

By the way, I compiled it under Windows.

Upvotes: 1

Views: 812

Answers (1)

JKRT
JKRT

Reputation: 1207

The main reason you get this error is that your shell does not interpret your command correctly.

See:

clang++.exe: error: no such file or directory: 'llvm-config'

Thus flags that should be passed to llvm-config are passed to clang.exe.

See:

clang++.exe: error: unsupported option '--cxxflags'
clang++.exe: error: unsupported option '--ldflags'
clang++.exe: error: unsupported option '--system-libs'
clang++.exe: error: unsupported option '--libs'

To solve this issue make sure to get llvm-config on you machine and make sure that you use a command line that supports the correct shell semantics. Example of such shells would be git bash or mingw.

Upvotes: 1

Related Questions