No debug in conda install lfortran on m1 mac?

This is more of a simple how-to question so I thought I’d ask here first instead of adding an issue over on github. My goal is to be able to compile and breakpoint debug on a Mac. Hobbyist user, relearning Fortran. I think LFortran is the compiler I want. I followed the conda based install but it seems lfortran wasn’t built with stack trace enabled?

Should I ditch conda and do a complete source build on the Mac? I don’t mind doing so, I just want to make sure I’m going down the right path.

Pertinent output:

(lf) troi ~/projects/fortran/quickstart $ lfortran --version
LFortran version: 0.31.0
Platform: macOS ARM
Default target: arm64-apple-darwin23.2.0
(lf) troi ~/projects/fortran/quickstart $ cat hello.f90
program hello
  ! This is a comment line; it is ignored by the compiler
  print *, 'Hello, World!'
end program hello
(lf) troi ~/projects/fortran/quickstart $ lfortran -g hello.f90
semantic error: The `runtime stacktrace` is not enabled. To get the stack traces or debugging information, please re-build LFortran with `-DWITH_RUNTIME_STACKTRACE=yes`

Thanks all,


1 Like

Good catch, I think it’s not enabled indeed. Can you please create an issue at our github?

I got it working locally on my Apple M1:

$ lfortran -g --debug-with-line-column  examples/expr2.f90
$ lldb expr2.out
(lldb) b main
Breakpoint 1: where = expr2.out`expr2 + 8 at expr2.f90:1:1, address = 0x0000000100003f28
(lldb) run
Process 8543 launched: '/Users/ondrej/repos/lfortran/lfortran/expr2.out' (arm64)
Process 8543 stopped
* thread #1, queue = '', stop reason = breakpoint 1.1
    frame #0: 0x0000000100003f28 expr2.out`expr2(x=1) at expr2.f90:1:1
-> 1   	program expr2
   2   	implicit none
   4   	integer :: x
   6   	x = (2+3)*5
   7   	print *, x
Target 0: (expr2.out) stopped.
(lldb) next
Process 8543 stopped
* thread #1, queue = '', stop reason = step over
    frame #0: 0x0000000100003f2c expr2.out`expr2(x=1) at expr2.f90:6:1
   4   	integer :: x
-> 6   	x = (2+3)*5
   7   	print *, x
   9   	end program
Target 0: (expr2.out) stopped.

You will likely discover bugs, please report them all. Right now our main focus is on compilation, after we reach beta, we’ll get these other aspects (like other backends, good debugging, interactive usage, etc.) ironed out.

sure thing. heading there to enter an issue now.

1 Like