Build Error from mlir-capi-ir-test

Hello,

I’m having an issue installing LLVM and Flang on a SGI and Cray machine and both are giving me the same error. This is using the latest version from GitHub that I just downloaded. I use the following for the cmake instruction:

cmake -G “Unix Makefiles” -DLLVM_ENABLE_PROJECTS=flang -DCMAKE_INSTALL_PREFIX=install_prefix -DCMAKE_CXX_COMPILER=pathway_to_g++ -DCMAKE_C_COMPILER=pathway_to_gcc …/llvm

The installation crashes with the following message:

Scanning dependencies of target mlir-capi-ir-test

[ 78%] Building C object tools/mlir/test/CAPI/CMakeFiles/mlir-capi-ir-test.dir/ir.c.o

[ 78%] Linking C executable …/…/…/…/bin/mlir-capi-ir-test

CMakeFiles/mlir-capi-ir-test.dir/ir.c.o: In function `printAffineExpr’:

/llvm-project/mlir/test/CAPI/ir.c:1272: undefined reference to `mlirAffineExprIsNull’

collect2: error: ld returned 1 exit status

make[2]: *** [bin/mlir-capi-ir-test] Error 1

make[1]: *** [tools/mlir/test/CAPI/CMakeFiles/mlir-capi-ir-test.dir/all] Error 2

make: *** [all] Error 2

In a previous build, I was able to use:

cmake --build . --target check-mlir

Following the instructions here: https://github.com/tensorflow/mlir/issues/138 to fix a similar issue but it hasn’t been successful this time. Does anyone know what might be happening and how to fix the issue?

Hi,

It seems like you were unlucky and checked out a buggy revision: this was a known bug a couple of days ago. Please git pull and try again, let us know if you have any issues!

Also MLIR folks communicate mainly here: https://llvm.discourse.group/c/mlir/31

Best,

Hello,

I pulled from git again and re-did the installation. I didn’t make it far enough into the installation to test the issue that I had as the installation failed with this:

[ 49%] Built target LLVMXCoreCodeGen

[ 49%] Built target LLVMXCoreDisassembler

[ 49%] Linking CXX shared library …/…/lib/libLTO.so

/usr/bin/ld:/p/work1/avermeer/llvm-project/build/tools/lto/LTO.exports:3: syntax error in VERSION script

collect2: error: ld returned 1 exit status

make[3]: *** [lib/libLTO.so.12git] Error 1

make[2]: *** [tools/lto/CMakeFiles/LTO.dir/all] Error 2

make[1]: *** [CMakeFiles/check-all.dir/rule] Error 2

make: *** [check-all] Error 2

Outlook-cid_image0.png

Hi,

It may be an issue of our CMake script detecting correctly your environment: I don’t know what linker you’re using.
You can look at the content of build/tools/lto/LTO.exports to see what’s wrong, and you can try to fix the generating script here: https://github.com/llvm/llvm-project/blob/master/llvm/cmake/modules/AddLLVM.cmake#L92-L134

Feel free to send a patch! :slight_smile:

Outlook-cid_image0.png