[SAoC] MLIR Support for LDC

Roberto Rosmaninho Robertogrosmaninho at gmail.com
Fri Oct 18 22:18:29 UTC 2019


On Friday, 18 October 2019 at 21:43:53 UTC, Johan Engelen wrote:
> I just merged it into LDC master, so you can rebase on LDC 
> master again.

Great, I already did the git pull here.

> For LDC, you don't have to do a `ninja install`. If you do, you 
> should specify where to install it when running cmake. What I 
> do is have a `run_cmake.sh` that runs cmake for me so I can 
> remember what options I passed to cmake. For reference, this is 
> my `run_cmake.sh` for building with LLVM trunk:
> ```
> cmake -G Ninja -DRT_SUPPORT_SANITIZERS=ON 
> -DLDC_DYNAMIC_COMPILE=False 
> -DD_COMPILER="/Users/johan/ldc/ldc2-1.12.0-osx-x86_64/bin/ldmd2" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="/Users/johan/ldc/johan/installtrunk" -DLLVM_ROOT_DIR="/Users/johan/llvm/llvmtrunkinstall" ..
> ```
>
> Note that I explicitly pass LLVM_ROOT_DIR where my LLVM trunk 
> build is installed.

I just tried to compile it here using your script as baseline:

$ cmake -G Ninja -DRT_SUPPORT_SANITIZERS=ON 
-DLDC_DYNAMIC_COMPILE=False 
-DD_COMPILER="/home/roberto/dlang/dmd-2.087.1/linux/bin64/dmd" 
-DCMAKE_BUILD_TYPE="Debug" 
-DCMAKE_INSTALL_PREFIX="/home/roberto/dlang/ldc" 
-DLLVM_ROOT_DIR="/home/roberto/llvm-project" ..

$ ninja

Then I tried to compile this example: 
https://run.dlang.io/is/ulDVcv

$ ~/dlang/ldc/build/bin/ldc2 test.d

And get the same error:

Error: cannot find source code for runtime library file 'object.d'
        ldc2 might not be correctly installed.
        Please check your ldc2.conf configuration file.
        Installation instructions can be found at 
http://wiki.dlang.org/LDC.
Specify path to file 'object.d' with -I switch

I'm not trying my code yet, this is just the master branch that 
I'm trying to use.
Any ideas or should I report this as a issue?

>>> I was hoping you had solved these issues. I'm still confused 
>>> by "reach projects directory", is it not possible to `ninja 
>>> install` MLIR ?
>>
>> Well, the instructions on MLIR git just ask for a "cmake 
>> --build . --target check-mlir" when you're compiling LLVM with 
>> MLIR.
>
> The instructions don't say it, because I think most people will 
> already know what to do and there are many cases where one 
> would _not_ want to install LLVM.

Right!

> This is what my `run_cmake.sh` looks like for building LLVM:
> ```
> cmake -G Ninja 
> -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld;polly" 
> -DCMAKE_INSTALL_PREFIX="/Users/johan/llvm/llvmtrunkinstall" 
> -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;Mips;MSP430;NVPTX;PowerPC;X86" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="RISCV;WebAssembly" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_APPEND_VC_REV=ON -DLLVM_INSTALL_UTILS=ON ..
> ```
> Note the "-DCMAKE_INSTALL_PREFIX", that's where LLVM will be 
> installed. And that is what you need to pass to LDC CMake 
> "-DLLVM_ROOT_DIR".

I will test it as soon as I can compile LDC without my code!
Best regards,
Roberto


More information about the Digitalmars-d mailing list