How to setup LLVM for building Functions branch?

I’m trying to build functions branch on Ubuntu 18.04, and I need to get llvm/IR/IRBuilder.h

[ 81%] Building CXX object source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o
In file included from /home/design/blender-git/blender/source/blender/functions/backends/llvm/llvm_types.hpp:5:0,
                 from /home/design/blender-git/blender/source/blender/functions/FN_llvm.hpp:4,
                 from /home/design/blender-git/blender/source/blender/functions/FN_all.hpp:10,
                 from /home/design/blender-git/blender/source/blender/functions/initialize.cpp:1:
/home/design/blender-git/blender/source/blender/functions/backends/llvm/builder.hpp:4:10: fatal error: llvm/IR/IRBuilder.h: No this file or dirrectory
 #include <llvm/IR/IRBuilder.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
source/blender/functions/CMakeFiles/bf_functions.dir/build.make:62: recipe for target 'source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o' failed
make[2]: *** [source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o] Error 1

I installed sudo apt-get install clang-8 lldb-8 lld-8 from https://apt.llvm.org/ but it doesn’t helps.

./install_deps.sh also doesn’t help

How can I get this dependency?

see if there are any -dev packages?

This are installed as dependencies:

libclang-common-8-dev libomp-8-dev llvm-8-dev

llvm-8-dev installed

you installed clang 5.x and added the 8.x dev packages?

no, i installed 8 versions of this

sudo apt-get install clang-8 lldb-8 lld-8

try adding -DLLVM_INCLUDE_DIRS=/usr/wherever/the/llvm/includes/are/on/your/system/ to your cmake invocation

hm… and how to do this?

run cmake -DLLVM_INCLUDE_DIRS=/usr/wherever/the/llvm/includes/are/on/your/system/ . in your build folder, followed by make

design@design-MS-7850:~/blender-git/build_linux$ cmake -DLLVM_INCLUDE_DIRS=/usr/lib/x86_64-linux-gnu/
CMake Error: The source directory "/home/design/blender-git/build_linux" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

you missed the . at the end of the line.

I have a small progress…

[ 81%] Building CXX object source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o
In file included from /home/design/blender-git/blender/source/blender/functions/backends/llvm/builder.hpp:4:0,
                 from /home/design/blender-git/blender/source/blender/functions/backends/llvm/llvm_types.hpp:5,
                 from /home/design/blender-git/blender/source/blender/functions/FN_llvm.hpp:4,
                 from /home/design/blender-git/blender/source/blender/functions/FN_all.hpp:10,
                 from /home/design/blender-git/blender/source/blender/functions/initialize.cpp:1:
/usr/include/llvm-8/llvm/IR/IRBuilder.h:18:10: fatal error: llvm-c/Types.h: Нет такого файла или каталога
 #include "llvm-c/Types.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
source/blender/functions/CMakeFiles/bf_functions.dir/build.make:62: recipe for target 'source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o' failed
make[2]: *** [source/blender/functions/CMakeFiles/bf_functions.dir/initialize.cpp.o] Error 1
CMakeFiles/Makefile2:6579: recipe for target 'source/blender/functions/CMakeFiles/bf_functions.dir/all' failed
make[1]: *** [source/blender/functions/CMakeFiles/bf_functions.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

I always have to run make BUILD_CMAKE_ARGS="-U *LLVM* -D WITH_LLVM=ON -D LLVM_VERSION=6.0. This is just copied from the output of install_deps.sh.

Tried 6.0 version and make BUILD_CMAKE_ARGS="-U *LLVM* -D WITH_LLVM=ON -D LLVM_VERSION=6.0" - same result…

I have IRBuilder.h in /usr/include/llvm-6.0/ and llvm-c/Types.h in /usr/include/llvm-c-6.0/llvm-c. How to setup second path?

I have encountered the same problem here, and I have solved it by adding a second path like this cmake -DLLVM_INCLUDE_DIRS="/usr/include/llvm-6.0/;/usr/include/llvm-c-6.0/" . but unfortunately when building complete it throws this error:

Scanning dependencies of target blender
[100%] Building C object source/creator/CMakeFiles/blender.dir/buildinfo.c.o
[100%] Linking CXX executable ../../bin/blender
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:llvm::VerifyDisableABIBreakingChecks: error: undefined reference to 'llvm::DisableABIBreakingChecks'
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:function FN::initialize_llvm(): error: undefined reference to 'LLVMInitializeX86TargetInfo'
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:function FN::initialize_llvm(): error: undefined reference to 'LLVMInitializeX86Target'
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:function FN::initialize_llvm(): error: undefined reference to 'LLVMInitializeX86TargetMC'
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:function FN::initialize_llvm(): error: undefined reference to 'LLVMInitializeX86AsmPrinter'
../../lib/libbf_functions.a(initialize.cpp.o):initialize.cpp:function FN::initialize_llvm(): error: undefined reference to 'LLVMInitializeX86AsmParser'
../../lib/libbf_functions.a(numeric_lists.cpp.o):numeric_lists.cpp:llvm::VerifyDisableABIBreakingChecks: error: undefined reference to 'llvm::DisableABIBreakingChecks
...

Any idea would be appreciated?
@LazyDodo @jacqueslucke @MichailSoluyanov

I have the exact same problem. Any input from developers will be helpful.
@LazyDodo @jacqueslucke @MichailSoluyanov