LLVM tutorial --system-libs does not exist

I am working on the Kaleidoscope tutorial for LLVM and has endless problems compiling it. The following tutorial shows that the "-system-libs" flag does not exist for llvm-config (it just prints out the usage block). I tried to leave it, but it looks like a rabbit hole of linker errors, which leads me to believe that I just set up my development environment completely wrong. I've tried this on both OSX Yosemite and Ubuntu with similar results. The not found error can be resolved by adding -I [path to llvm], however this just shows more errors, making me think this is the wrong approach.

http://llvm.org/releases/3.6.0/docs/tutorial/LangImpl3.html

$make
#clang++ -g -v -L -std=c++11 -O3 toy.cpp -I/usr/include/llvm-3.5/ `llvm-config --cxxflags --ldflags --libs all` -o toy
clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core` -o toy
usage: llvm-config <OPTION>... [<COMPONENT>...]

Get various configuration information needed to compile programs which use
LLVM.  Typically called from 'configure' scripts.  Examples:
  llvm-config --cxxflags
  llvm-config --ldflags
  llvm-config --libs engine bcreader scalaropts

Options:
  --version         Print LLVM version.
  --prefix          Print the installation prefix.
  --src-root        Print the source root LLVM was built from.
  --obj-root        Print the object root used to build LLVM.
  --bindir          Directory containing LLVM executables.
  --includedir      Directory containing LLVM headers.
  --libdir          Directory containing LLVM libraries.
  --cppflags        C preprocessor flags for files that include LLVM headers.
  --cflags          C compiler flags for files that include LLVM headers.
  --cxxflags        C++ compiler flags for files that include LLVM headers.
  --ldflags         Print Linker flags.
  --libs            Libraries needed to link against LLVM components.
  --libnames        Bare library names for in-tree builds.
  --libfiles        Fully qualified library filenames for makefile depends.
  --components      List of all possible components.
  --targets-built   List of all targets currently built.
  --host-target     Target triple used to configure LLVM.
  --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).
Typical components:
  all               All LLVM libraries (default).
  engine            Either a native JIT or a bitcode interpreter.
toy.cpp:1:10: fatal error: 'llvm/IR/Verifier.h' file not found
#include "llvm/IR/Verifier.h"
         ^
1 error generated.
make: *** [parser] Error 1

      

+3


source to share


1 answer


It turns out that the version of llvm-config I'm using is outdated. On Ubuntu I can simple apt-get install llvm-config-3.6

, but on OSX I can do brew install homebrew/versions/llvm36

. Finally, use llvm-config-3.6 instead of llvm-config.



+2


source







All Articles