With VS Code, I can program, compile and execute my code in Fortran 90.
Compile with a Makefile specific to the program + terminal then Execute via the terminal.
or Compile and execute the programme with a button that launches a generic script.
On the other hand, I can’t get a Fortran 90 debugger to work on MacOS (Sonoma): neither GDB nor LLDB. Either in the terminal or via VS Code.
With GDB, it crashes. With LLDB, the breakpoints work but the variables are not displayed (in the VS Code VARIABLES explorer or via the terminal): “This version of LLDB has no plugin for the language “fortran95”. Inspection of frame variables will be limited”.
My configuration:
MacOS Sonoma (14.5)
VS Code 1.91.1 + Modern Fortran 3.2.0 + Fortran Breakpoint Support 0.0.4 + CodeLLDB 1.10.0
gfortan (GCC) 14.1.0
GDB 15.1
LLDB 18.1.8
Xcode 15.4 (I don’t know if it matters)
Does anyone debug their Fortran 90 code on MacOS Sonoma?
If yes, with which debugger (version) ? More generally, what is your configuration? Is there a specific procedure or trick?
Thank you in advance for your feedback. Maybe what I’m looking for just doesn’t exist.
Hello,
I’m in a similar position. When working from home I use an Apple M1 running Sonoma 14.5. I write Fortran in VS Code with Modern Fortran and compile with GFortran (GCC 14.1.0). As far as I can tell GDB isn’t available for M1 Macs and I have the same problem as you with LLDB (18.1.8). Fortuntately my work PC runs Linux (CentOS), which means I can log on remotley and use GDB for debugging. At least I can use a debugger but I’d also like to know if there’s a Mac based solution that works (perhaps LFortran in time, which I haven’t yet).
This is likely has something to do with code signing on Mac OS Sonoma, just search for gdb code signing Mac OS Sonoma and you should be able to figure it out.
Yes, code signing works if you have an Intel Mac but as far as I can tell GDB isn’t available for Apple silicon (I’ve looked at Homebrew and Macports).
Bummer… my primary machine is a 27" iMac but I do my fortran develoment remotely on a Linux server at this point (more CPU cores / nVidia support).
I worked on MacOS X at Apple for 10+ years and I still enjoy using MacOS… If and when Apple decides to actually make a 27" iMac that I can afford I will update… but for the foreseeable future it’s going to be this setup.
Maybe you could build gdb and gfortran as native on MacOS? That is where I would start.
I’m not certain, but I think the commercial Simply Fortran works on Apple ARM cpus and with the latest versions of MacOS. That package includes the gdb debugger, so they must have somehow figured out the code signing security problems.
[edit: after looking around the site some more, I see a few “intel only” tags scattered around, so maybe it doesn’t work after all on Apple ARM.]
I wonder if the Apple Silicon has some sort of protection that doesn’t allow GDB to work… LLDB in the past has been for LLVM compiled code so I suspect it wouldn’t work well.
I think that is a possibility once we have LLVM-based fortran compilers. At least, that was one of the rationals for supporting LLVM based compilers in the first place. Until then, it looks like one step forward, two steps back…
I’ve never been able to use GDB on Sonoma.
So I tried Simply Fortran and it works. I don’t know why: it also uses GDB…
I bought a license and it works also on Sequoia.