c3_clang_extensions

Crates.ioc3_clang_extensions
lib.rsc3_clang_extensions
version0.3.9
sourcesrc
created_at2017-08-18 00:58:47.502872
updated_at2023-10-22 00:04:26.263239
descriptionUgly hacks to get information hidden/malformed by libclang See C3 for usable interface.
homepagehttps://gitlab.com/citrus-rs/c3
repositoryhttps://gitlab.com/citrus-rs/c3.git
max_upload_size
id27943
size381,280
Kornel (kornelski)

documentation

README

C3

Internal for the C3 project.

Building

  • Run cargo clean if upgrading from a previous version of LLVM.
  • Build LLVM 4 or 5 and Clang from source (libclang.a is needed, and pre-built packages won't have it).
  • Add directory containing llvm-config to your PATH, or set LLVM_CONFIG_PATH env variable poiting to the llvm-config executable file.
  • Set LIBCLANG_INCLUDE_PATH pointing to Clang's include directory (<clang install dir>/clang/include/)

Building clang (Linux and macOS)

This will require 20GB of disk space and 16GB of RAM. This method creates static binaries, which can be redistributed without hassle.

  1. Install cmake, subversion, build-essential, libffi-dev, libncursesw5-dev
  2. curl -LO http://releases.llvm.org/5.0.2/llvm-5.0.2.src.tar.xz
  3. tar xf llvm-5.0.2.src.tar.xz
  4. curl -LO http://releases.llvm.org/5.0.2/cfe-5.0.2.src.tar.xz
  5. tar xf cfe-5.0.2.src.tar.xz
  6. mv cfe-5.0.2.src llvm-5.0.2.src/tools/clang
  7. cd llvm-5.0.2.src
  8. mkdir build; cd build
  9. cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$HOME/llvm-5-c3 -DLIBCLANG_BUILD_STATIC=ON -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_POLLY_BUILD=OFF -DLLVM_ENABLE_LIBCXX=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_RUNTIME=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_FFI=OFF ..
  10. make -j8; make install
  11. Take a nap.
  12. cp lib/libclang.a "$HOME/llvm-5-c3/lib/"
  13. Set the following variables. Note that you will need to set them every time you compile, so add them to your bashrc or make a script and source it.
    • export LIBCLANG_INCLUDE_PATH="$HOME/llvm-5-c3/tools/clang/include/:$HOME/llvm-5-c3/include/"
    • export LIBCLANG_STATIC_PATH="$HOME/llvm-5-c3/lib/"
    • export LLVM_CONFIG_PATH="$HOME/llvm-5-c3/bin/llvm-config"
Commit count: 79

cargo fmt