and it works perfectly. As part of LFortran’s MVP, I want to compile all the example projects that you reported at lfortran#540, on Linux, macOS (Intel+Arm) and Windows. I looked into the examples and I think it will not be difficult to implement all the missing features in LFortran that those examples need.
Yes cc seems to work on Linux and macOS. I am not sure about Windows, but I think it’s easy to change that by setting the FPM_C_COMPILER variable, so I think this is good enough for now.
fpm is also supported in windows-msys2. I tried to install lfortran in miniconda, but it seems to be very dependent on the conda environment. It is difficult (maybe not) for me to use lfortran in an environment outside of conda, such as cmd.
Is it possible to support lfortran in windows-msys2 in the future? @certik Thank you for your great work!
Yes, it works in cmd.exe without Conda. It just needs to be installed in some way. How do you contribute to windows-msys2? All we need to do is to create a package.
Note that the checks are disable (--nocheck), because they don’t pass yet. The error log from the failing tests is below:
findSymbol failure in test_llvm
Start 6: test_llvm
6/10 Test #6: test_llvm ........................***Failed 0.31 sec
[doctest] doctest version is "2.3.4"
[doctest] run with "--help" for options
LLVM Version:
===============================================================================
../src/lfortran/tests/test_llvm.cpp:18:
TEST CASE: llvm 1
../src/lfortran/tests/test_llvm.cpp:29: ERROR: CHECK( e.int64fn("f1") == 4 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:31: ERROR: CHECK( e.int64fn("f1") == 4 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:39: ERROR: CHECK( e.int64fn("f1") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:41: ERROR: CHECK( e.int64fn("f1") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:63:
TEST CASE: llvm 2
../src/lfortran/tests/test_llvm.cpp:75: ERROR: CHECK( e.int64fn("f1") == 4 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:86: ERROR: CHECK( e.int64fn("f2") == 4 ) THREW exception: "findSymbol() failed to find the symbol 'f2'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:98:
TEST CASE: llvm 3
../src/lfortran/tests/test_llvm.cpp:121: ERROR: CHECK( e.int64fn("f1") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:98: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'inc'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:183:
TEST CASE: llvm 4
../src/lfortran/tests/test_llvm.cpp:202: ERROR: CHECK( e.int64fn("f1") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
../src/lfortran/tests/test_llvm.cpp:183: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'inc'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:237:
TEST CASE: llvm array 1
../src/lfortran/tests/test_llvm.cpp:276: ERROR: CHECK( e.int64fn("f") == 6 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:279:
TEST CASE: llvm array 2
../src/lfortran/tests/test_llvm.cpp:321: ERROR: CHECK( e.int64fn("f") == 6 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:328:
TEST CASE: llvm callback 0
../src/lfortran/tests/test_llvm.cpp:345: ERROR: CHECK( e.int64fn("f1") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f1'"
Module:
; ModuleID = 'LFortran'
source_filename = "LFortran"
define i32 @f() {
.entry:
%f = alloca i32, align 4
store i32 5, i32* %f, align 4
%0 = load i32, i32* %f, align 4
ret i32 %0
}
===============================================================================
../src/lfortran/tests/test_llvm.cpp:349:
TEST CASE: ASR -> LLVM 1
../src/lfortran/tests/test_llvm.cpp:374: ERROR: CHECK( e.int32fn("f") == 5 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
Module:
; ModuleID = 'LFortran'
source_filename = "LFortran"
define i32 @f() {
.entry:
%f = alloca i32, align 4
store i32 4, i32* %f, align 4
%0 = load i32, i32* %f, align 4
ret i32 %0
}
===============================================================================
../src/lfortran/tests/test_llvm.cpp:377:
TEST CASE: ASR -> LLVM 2
../src/lfortran/tests/test_llvm.cpp:401: ERROR: CHECK( e.int32fn("f") == 4 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:404:
TEST CASE: FortranEvaluator 1
../src/lfortran/tests/test_llvm.cpp:404: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:419:
TEST CASE: FortranEvaluator 2
../src/lfortran/tests/test_llvm.cpp:419: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_1'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:431:
TEST CASE: FortranEvaluator 3
../src/lfortran/tests/test_llvm.cpp:431: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:446:
TEST CASE: FortranEvaluator 4
../src/lfortran/tests/test_llvm.cpp:446: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:472:
TEST CASE: FortranEvaluator 5
../src/lfortran/tests/test_llvm.cpp:472: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_3'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:520:
TEST CASE: llvm complex type
../src/lfortran/tests/test_llvm.cpp:552: ERROR: CHECK( std::abs(e.floatfn("f") - 8) < 1e-6 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:556:
TEST CASE: llvm complex type value
../src/lfortran/tests/test_llvm.cpp:591: ERROR: CHECK( std::abs(e.floatfn("f") - 8) < 1e-6 ) THREW exception: "findSymbol() failed to find the symbol 'f'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:595:
TEST CASE: llvm boolean type
../src/lfortran/tests/test_llvm.cpp:621: ERROR: CHECK( e.boolfn("b") == false ) THREW exception: "findSymbol() failed to find the symbol 'b'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:625:
TEST CASE: llvm boolean type
../src/lfortran/tests/test_llvm.cpp:651: ERROR: CHECK( e.boolfn("b") == false ) THREW exception: "findSymbol() failed to find the symbol 'b'"
===============================================================================
../src/lfortran/tests/test_llvm.cpp:655:
TEST CASE: llvm pointers 1
../src/lfortran/tests/test_llvm.cpp:655: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'f'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:678:
TEST CASE: llvm pointers 2
../src/lfortran/tests/test_llvm.cpp:678: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'f'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:697:
TEST CASE: llvm pointers 3
../src/lfortran/tests/test_llvm.cpp:697: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'f'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:737:
TEST CASE: llvm pointers 4
../src/lfortran/tests/test_llvm.cpp:737: ERROR: test case THREW exception: findSymbol() failed to find the symbol 'f'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:774:
TEST CASE: FortranEvaluator 7
../src/lfortran/tests/test_llvm.cpp:774: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:786:
TEST CASE: FortranEvaluator 8
../src/lfortran/tests/test_llvm.cpp:786: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:798:
TEST CASE: FortranEvaluator 8 double
../src/lfortran/tests/test_llvm.cpp:798: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:810:
TEST CASE: FortranEvaluator 9 single complex
../src/lfortran/tests/test_llvm.cpp:810: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_1'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:823:
TEST CASE: FortranEvaluator 9 double complex
../src/lfortran/tests/test_llvm.cpp:823: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_1'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:836:
TEST CASE: FortranEvaluator integer kind 1
../src/lfortran/tests/test_llvm.cpp:836: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:851:
TEST CASE: FortranEvaluator integer kind 2
../src/lfortran/tests/test_llvm.cpp:851: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:866:
TEST CASE: FortranEvaluator re-declaration 1
../src/lfortran/tests/test_llvm.cpp:866: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
../src/lfortran/tests/test_llvm.cpp:892:
TEST CASE: FortranEvaluator re-declaration 2
../src/lfortran/tests/test_llvm.cpp:892: ERROR: test case THREW exception: findSymbol() failed to find the symbol '__lfortran_evaluate_2'
===============================================================================
[doctest] test cases: 33 | 2 passed | 31 failed | 0 skipped
[doctest] assertions: 46 | 29 passed | 17 failed |
[doctest] Status: FAILURE!
LLVM (http://llvm.org/):
LLVM version 11.0.0
Optimized build.
Default target: x86_64-pc-msys
Host CPU: skylake
This might be related to LFortran mistaking the Cygwin-like runtime for Linux: