Development/clang-cl
Jump to navigation
Jump to search
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Work in progress to build LibreOffice on Windows with clang-cl:
Prerequisites
- Install needed tools to build clang:
- Set up clang tree (note the patch instructions below):
- Start MSVC shell ("VS2015 x64 Native Tools Command Prompt")
- cd <directory-of-your-choice>
- mkdir clang
- git clone https://git.llvm.org/git/llvm.git
- cd llvm
- cd tools
- git clone https://git.llvm.org/git/clang.git
- cd ..\projects
- git clone https://git.llvm.org/git/compiler-rt.git
- cd ..\..
- mkdir llvm-objdir
- cd llvm-objdir
- cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 ..\llvm
- ninja
- find the fresh built clang-cl executable in
Set up clang-cl
- Recent llvm/clang trunk repos (known working: rev. 261722 of 2016-02-24)
- Patches to the clang repo that were needed in the past:
- (“clang-cl: support __cdecl-on-struct anachronism”, merged as rev. 263947)
- (“clang-cl: Take dllexport from original function decl into account”, merged as rev. 326990)
- (“For MS ABI, emit dllexport friend functions defined inline in class”, merged as rev. 264841)
Set up LibreOffice build
- Recent LibreOffice master repo (known working: “Work around -Werror,-Wunused-macros with clang-cl”)
- Patches that were needed in the past:
- (“TODO: work around clang-cl ABI bug PR25641” to work around ”clang-cl: vtordisp thunks not emitted for functions with class template specializations in their signatures” until there is a fix for that bug; merged for now as core commit 81ce629c9e8a4fc26ded9d49157e3f3263991e03)
- In autogen.input (using whatever
-fmsc-version=nnnn
matches your installed compiler version, see documentation of_MSC_VER
at [1]):CC=.../clang-cl.exe -FIIntrin.h -fmsc-version=1915 -Qunused-arguments --target=x86_64-pc-windows-msvc
CXX=.../clang-cl.exe -D_CRT_RAND_S= -FIIntrin.h -fmsc-version=1915 -Qunused-arguments --target=x86_64-pc-windows-msvc
--disable-pch
--disable-compiler-plugins
- Only tested with
--enable-64-bit
- There is an issue with
safeint.h
at least from Windows SDK 10.0.10240, see core commit 2685678cd0221f4522e8502183baeaecb5ddd0a4, which is known to be solved at least with Windows SDK 10.0.15063.137 available from [2].
Future Work
Investigate whether clang-cl works on Windows Subsystem for Linux, aka "Windows Bash".
See also
- “Finally Building on Windows” has presentation slides about earlier progress towards the above.