Skip to content

Build llvmlite with MSYS2

valtron edited this page May 18, 2017 · 1 revision

This assumes you have set up MSYS2 and you have LLVM installed in $LLVM. Replace all paths accordingly.

  1. Download llvmlite source into $SRC
  2. Edit $SRC/ffi/build.py:
    1. Change subprocess.check_call(['cmake', ... to subprocess.check_call(['cmake', '-G', generator, '-D', 'LLVM_DIR=$LLVM/lib/cmake/llvm', cmake_dir])
    2. Before print("Trying generator %r" % (generator,)), add generator = 'MinGW Makefiles'
    3. Change shutil.copy(os.path.join(build_dir, config, 'llvmlite.dll'), target_dir) to shutil.copy(os.path.join(build_dir, 'libllvmlite.dll'), os.path.join(target_dir, 'llvmlite.dll'))
  3. Edit $SRC/ffi/CMakeLists.txt:
    1. After llvm_map_components_to_libnames(llvm_libs all), add line list(REMOVE_ITEM llvm_libs "LTO")
  4. Create $SRC/build.sh
    PATH="/c/Windows/system32:$DEV/msys64/mingw64/bin"
    PYTHON="wherever your python.exe happens to be"
    $PYTHON setup.py build
    $PYTHON setup.py install
  5. cd $SRC
  6. Run sh build.sh
  7. cd ..; run tests: python -m llvmlite.tests