[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:
> ```
> -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:

-DLLVM_ROOT_DIR="/home/roberto/llvm-project" ..

$ ninja

Then I tried to compile this example: 

$ ~/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 
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.


> 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" 
> ```
> Note the "-DCMAKE_INSTALL_PREFIX", that's where LLVM will be 
> installed. And that is what you need to pass to LDC CMake 

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

More information about the Digitalmars-d mailing list