www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Building against LLVM 6.0

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Now that https://github.com/ldc-developers/ldc/pull/2608 is in 
can I try building LDC myself against LLVM-6.0?

If so which build settings control which version of LLVM it 
builds against?

If I only have LLVM 6.0 installed will it work automatically?
Apr 15 2018
parent reply "David Nadlinger" <code klickverbot.at> writes:
On 15 Apr 2018, at 11:12, Per Nordlöw via digitalmars-d-ldc wrote:
 Now that https://github.com/ldc-developers/ldc/pull/2608 is in can I 
 try building LDC myself against LLVM-6.0?
You should be able to, yes.
 If so which build settings control which version of LLVM it builds 
 against?

 If I only have LLVM 6.0 installed will it work automatically?
It should pick it up automatically, yes, but you can also use -DLLVM_CONFIG=<path to llvm-config executable> or -DLLVM_ROOT_DIR=<path to llvm installation> to explicitly specify which version to use. — David
Apr 15 2018
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 15 April 2018 at 14:30:59 UTC, David Nadlinger wrote:
 On 15 Apr 2018, at 11:12, Per Nordlöw via digitalmars-d-ldc 
 wrote:
 Now that https://github.com/ldc-developers/ldc/pull/2608 is in 
 can I try building LDC myself against LLVM-6.0?
You should be able to, yes.
 If so which build settings control which version of LLVM it 
 builds against?

 If I only have LLVM 6.0 installed will it work automatically?
It should pick it up automatically, yes, but you can also use -DLLVM_CONFIG=<path to llvm-config executable> or -DLLVM_ROOT_DIR=<path to llvm installation> to explicitly specify which version to use. — David
I installed the 6.0 version on Ubuntu 17.10 using deb http://apt.llvm.org/artful/ llvm-toolchain-artful-6.0 main deb-src http://apt.llvm.org/artful/ llvm-toolchain-artful-6.0 main and built ldc using it. For some reason it didn't build and install the asan and LLVMgold.so plugin because my compilation errors as Error: The LLVMgold.so plugin (needed for LTO) was not found. You can specify its path with -flto-binary=<file>. ldc2 failed with exit code 1. Which build (cmake) configuration flags control inclusion of the asan and the LLVMgold.so plugin and the build and installation?
Apr 15 2018
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 15 April 2018 at 21:44:04 UTC, Per Nordlöw wrote:
 Which build (cmake) configuration flags control inclusion of 
 the asan and the LLVMgold.so plugin and the build and 
 installation?
Or rather all plugins part of the standard distribution of ldc.
Apr 15 2018
next sibling parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 15 April 2018 at 21:47:28 UTC, Per Nordlöw wrote:
 On Sunday, 15 April 2018 at 21:44:04 UTC, Per Nordlöw wrote:
 Which build (cmake) configuration flags control inclusion of 
 the asan and the LLVMgold.so plugin and the build and 
 installation?
Or rather all plugins part of the standard distribution of ldc.
I followed the instructions at https://wiki.dlang.org/Building_LDC_from_source#LDC
Apr 15 2018
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 15 April 2018 at 21:53:38 UTC, Per Nordlöw wrote:
 On Sunday, 15 April 2018 at 21:47:28 UTC, Per Nordlöw wrote:
 On Sunday, 15 April 2018 at 21:44:04 UTC, Per Nordlöw wrote:
 Which build (cmake) configuration flags control inclusion of 
 the asan and the LLVMgold.so plugin and the build and 
 installation?
Or rather all plugins part of the standard distribution of ldc.
I followed the instructions at https://wiki.dlang.org/Building_LDC_from_source#LDC
My printouts from cmake are -- The C compiler identification is GNU 7.2.0 -- The CXX compiler identification is GNU 7.2.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found host D compiler /home/per/.local/ldc-snapshot/bin/ldmd2, with default flags '' -- Host D compiler version: LDC - the LLVM D compiler (1.8.0git-7b3f7af) -- Found LLVM: /usr/lib/llvm-6.0 (found suitable version "6.0.1", minimum required is "3.7") -- LDC version identifier: 1.8.0git-7b3f7af -- Building LDC with dynamic compilation support: True (LDC_DYNAMIC_COMPILE=True) -- Looking for C++ include lld/Common/Driver.h -- Looking for C++ include lld/Common/Driver.h - not found -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Looking for setupterm in tinfo -- Looking for setupterm in tinfo - found -- Building LDC with plugin support ON (LDC_ENABLE_PLUGINS=ON) -- Host D compiler linker program: /usr/bin/cc -- Host D compiler linker flags: -L/home/per/.local/ldc-snapshot/lib;-lphobos2-ldc;-ldruntime-ldc;-Wl,--gc-sections;-lrt;-ldl;-lpthread;-lm;-m64 -- Looking for _SC_ARG_MAX -- Looking for _SC_ARG_MAX - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of void* -- Check size of void* - done -- Using path for Intrinsics.td: /usr/lib/llvm-6.0/include -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Looking for unistd.h -- Looking for unistd.h - found -- GDB 8.0.1 detected -- Configuring done -- Generating done -- Build files have been written to: /home/per/ware/ldc Why don't I get the plugins when it says -- Building LDC with plugin support ON (LDC_ENABLE_PLUGINS=ON) ? The lib part of the installation contains /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-shared.so.78 /home/per/.local/ldc-snapshot/lib/libldc-jit.so.2.0.78 /home/per/.local/ldc-snapshot/lib/libldc-jit-rt.a /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-shared.so /home/per/.local/ldc-snapshot/lib/libldc-jit.so.78 /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-shared.so.2.0.78 /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-shared.so.2.0.78 /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-debug-shared.so.78 /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-shared.so /home/per/.local/ldc-snapshot/lib/libldc-jit.so /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-debug-shared.so.2.0.78 /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-debug-shared.so.2.0.78 /home/per/.local/ldc-snapshot/lib/libphobos2-ldc.a /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-debug.a /home/per/.local/ldc-snapshot/lib/libdruntime-ldc.a /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-debug-shared.so.78 /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-shared.so.78 /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-debug.a /home/per/.local/ldc-snapshot/lib/libphobos2-ldc-debug-shared.so /home/per/.local/ldc-snapshot/lib/libdruntime-ldc-debug-shared.so
Apr 15 2018
parent kinke <noone nowhere.com> writes:
On Sunday, 15 April 2018 at 22:14:03 UTC, Per Nordlöw wrote:
 Why don't I get the plugins when it says

 -- Building LDC with plugin support ON (LDC_ENABLE_PLUGINS=ON)

 ?
That's because the compiler-rt libs (incl. ASan) aren't considered plugins. Plugins here denote Clang-compatible LLVM-IR plugins. - What you are probably looking for here is `-DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON` in the LDC CMake command line.
Apr 15 2018
prev sibling parent reply kinke <noone nowhere.com> writes:
On Sunday, 15 April 2018 at 21:47:28 UTC, Per Nordlöw wrote:
 On Sunday, 15 April 2018 at 21:44:04 UTC, Per Nordlöw wrote:
 Which build (cmake) configuration flags control inclusion of 
 the asan and the LLVMgold.so plugin and the build and 
 installation?
Or rather all plugins part of the standard distribution of ldc.
The 'full experience' of official prebuilt packages currently requires our minimally touched LLVM [1], otherwise `-link-internally` doesn't work. It also requires LLVM to be built with `-DLLVM_BINUTILS_INCDIR=<path/to/plugin.h>` in the CMake command line (reqiring the binutils-dev package for that header) in order to generate the LTO plugin LLVMgold.so. This goes on, there's a whole lot of little details to get right. So if you just want to give LLVM 6.0 a shot, consider downloading a ready-made CI package from [2] - they're equivalent to the release packages modulo enabled LLVM & LDC assertions. If you still want to build yourself, all up-to-date details are in our CircleCI (Linux & macOS) and AppVeyor (Windows) config files, as they generate the official prebuilt packages. [3, 4] [1] https://github.com/ldc-developers/llvm [2] https://github.com/ldc-developers/ldc/releases/tag/CI [3] https://github.com/ldc-developers/llvm/blob/ldc-release_60/.circleci/config.yml [4] https://github.com/ldc-developers/ldc/blob/master/.circleci/config.yml
Apr 15 2018
parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 15 April 2018 at 22:23:19 UTC, kinke wrote:
 [1] https://github.com/ldc-developers/llvm
 [2] https://github.com/ldc-developers/ldc/releases/tag/CI
 [3] 
 https://github.com/ldc-developers/llvm/blob/ldc-release_60/.circleci/config.yml
 [4] 
 https://github.com/ldc-developers/ldc/blob/master/.circleci/config.yml
Wonderful! Thanks. I'm curious to see whether there are any improvements to LLVM-6.0 codegen; I have an annoying performance problem I'm investigating.
Apr 15 2018