Error when building flang with LLVM 11.0.0


I’m using Linux Fedora 33 (e.g. with cmake 3.18.4, g++ 10.2.11, etc.) on a laptop (Intel(R) Core™ i7-2630QM CPU @ 2.00GHz) to build the LLVM 11.0.0 compiler infrastructure (the sources were downloaded today with Git) using a minimal project list:

cmake -G Ninja …/llvm/ -DBUILD_SHARED_LIBS=“Release” -DLLVM_ENABLE_PROJECTS=“clang;flang;polly”

However, there are error messages related to the flang side:

FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/check-expression.cpp.o
FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o
FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-complex.cpp.o
FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-character.cpp.o
FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold.cpp.o

Please, any clue for solving this issue?
Thanks in advance.

If you want release build use -DCMAKE_BUILD_TYPE=Release and if want to build llvm as shared library use -DBUILD_SHARED_LIBS=On.

Specifying -DBUILD_SHARED_LIBS=“Release” mixing two different options.

Hi Shivam,
Uppss … Thank you very much for pointing out my crude typo (I missed an extra cup of coffee …). I was able to move forward but now I have problems with make check-all:

Testing: 0… 10… 20… 30… 40… 50… 60… 70… 80…
FAIL: LLVM :: tools/llvm-ar/error-opening-permission.test (69523 of 76951)
******************** TEST ‘LLVM :: tools/llvm-ar/error-opening-permission.test’ FAILED ********************

: ‘RUN: at line 5’; rm -rf /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp && mkdir -p /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp
: ‘RUN: at line 6’; echo file1 > /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/1.txt
: ‘RUN: at line 9’; /home/bigpack/llvm-paq/11.0.0/llvm-project/build/bin/llvm-ar rc /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/1.txt
: ‘RUN: at line 10’; chmod 100 /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b
: ‘RUN: at line 11’; not /home/bigpack/llvm-paq/11.0.0/llvm-project/build/bin/llvm-ar p /home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b 2>&1 | /home/bigpack/llvm-paq/11.0.0/llvm-project/build/bin/FileCheck /home/bigpack/llvm-paq/11.0.0/llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test --check-prefix=NO-PERMISSION -DARCHIVE=/home/bigpack/llvm-paq/11.0.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b

Exit Code: 1

Command Output (stderr):

/home/bigpack/llvm-paq/11.0.0/llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test:14:18: error: NO-PERMISSION: expected string not found in input

NO-PERMISSION: error: unable to open ‘[[ARCHIVE]]’: {{[pP]}}ermission denied


:1:1: note: scanning from here
:1:1: note: with “ARCHIVE” equal to “/home/bigpack/llvm-paq/11\.0\.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission\.test\.tmp/permission\.b”

Input file:
Check file: /home/bigpack/llvm-paq/11.0.0/llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test

-dump-input=help explains the following input dump.

Input was:
1: file1
check:14’0 X~~~~ error: no match found
check:14’1 with “ARCHIVE” equal to “/home/bigpack/llvm-paq/11\.0\.0/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission\.test\.tmp/permission\.b”

Any suggestion to fix it? By the way, how do I control the number of threads with make check-all ? (e.g. does the -jN flag work in this context?).

It looks FileCheck’s ARCHIVE varible is not correctly set because of 11.0.0 string in directory path. So FileCheck unable to find ‘error: unable to open ‘[[ARCHIVE]]’: {{[pP]}}ermission denied’ on the output of command line(insted seeing file not found). It may be bug in Fileckeck. You should file a bug on with complete reproducer.

You can try running a single test to check if it is passing by:
cd /home/bigpack/llvm-paq/11.0.0/llvm-project/build/

bin/llvm-lit ../llvm/test/tools/llvm-ar/error-opening-permission.test

Output should be
– Testing: 1 tests, 1 workers –
PASS: LLVM :: tools/llvm-ar/error-opening-permission.test (1 of 1)

Testing Time: 0.49s
Passed: 1

No, I think it doesn’t work here, but I will try if I can find some solution. To run tests parallel use bin/llvm-lit -jN ../llvm/test in your build directory.

→ Yes. If you think so, I would fill a bug report.

→ The single test is no passed, the output is
cd /home/bigpack/llvm-paq/11.0.0/llvm-project/build/
$ bin/llvm-lit …/llvm/test/tools/llvm-ar/error-opening-permission.test
– Testing: 1 tests, 1 workers –
FAIL: LLVM :: tools/llvm-ar/error-opening-permission.test (1 of 1)

Failed Tests (1):
LLVM :: tools/llvm-ar/error-opening-permission.test

Testing Time: 0.16s
Failed: 1

→ Ok with the recipe for run tests parallel use bin/llvm-lit -jN ../llvm/test


Sorry, Jorge, I think the issue is not relative to FileCheck or LLVM component so please don’t file bug there.

I found the patch that introduces this test. The test that failing is unsupported on windows and maybe on your system also.

Here is the patch I think you should ping @sameerarora101 on Phabricator & explain the issue.