1 (edited by designer 2025-11-10 17:34:41)

Topic: Trouble with Sample Hello World

Computer: MacMini M4
OS: Tahoe 26.0.1
SimplyFortran: 3.41, Build 4435

I've been having trouble with the Build level of past programs, or at their Run Time.
I opened the HelloWorld Sample, Clicked on hello.f90 and Saved, using the second icon in the tool bar (Save).
Then, under the Project menu I selected Save the Project and it's default path - it creates a Fortran folder in my Users/MyName/folder and put the Hello folder there.
Then I clicked the Build (gear) icon and got this:

==============================================================================
Compiling hello.f90
f951: Error: unknown value 'apple-m1' for '-march'
f951: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8.9-a armv8-r armv9-a armv9.1-a armv9.2-a armv9.3-a armv9.4-a native
f951: note: did you mean '-mcpu=apple-m1'?
Error: Last command making (build/hello.o) returned a bad status
Error: Make execution terminated


* Failed *

In my "real life" program, I get a Complete on the Build, but when I run it, it exits apparently before reading any records.
It looks like this:
OPEN (UNIT=20, FILE = "permutationsBase10.txt", STATUS="OLD", ACTION="READ", IOSTAT=ierror)

Print *, "let the fun begin"

ierror = 0
icount = 0
resultw = ""
reorder = ""

!*******************************************
WRITE(*,*)
WRITE(*,'(A)') 'Before Read Loop'
WRITE(*,*)

DO
    icount = icount + 1
    Read (20,10,IOSTAT=ierror) O, T, S, H, N, I, A, C, R, Y
    10 format (10I1)

WRITE(*,*)
WRITE(*,'(A)', ADVANCE = 'NO') 'READ RECORD AT '
WRITE(*,'(1I8)') icount
WRITE(*,*)

    IF (ierror > 0) THEN
        WRITE (*,'(A)', ADVANCE = 'NO') 'I/O Error at '
        WRITE (*,'(2I8)') ierror, icount
        GOTO 100
    END IF

And ends with:
END DO
100 Write (*,'(A)', ADVANCE = 'NO')  ' read all '
    WRITE (*,'(I9)')  icount
    Write (*,*)

This is what I see:
let the fun begin
read all         1

So it does the Print "let the fun begin"
Then it appears to jump immediately to "read all" at the end of the program.

Those "Write" statements are not permenant code. They are just something I put in to see if the program got that far. If I did my homework, there is probably a diagnostic option to execute by stepping through the code one line at a time.

But if that simple HelloWorld example had a problem, then there might be other demons at work.

I wondered if I had downloaded the wrong version, one NOT For Silicon Mac, but looking at the website, all versions (Mac, Window, SiliconMac, have the same version numbers).

As an aside, I see that two dimensional Plotting (Aplot) is an option for Mac. It would be nice if an program that showed its use would be added to the New Projects examples.

Re: Trouble with Sample Hello World

The first issue, a flag passed via -march might be an options issue.  Can you send the project file and/or makefile for your hello world project?  Also, if you open Project Options and navigate to the Code Generation category, is anything enabled?

On your "real life" program example, I don't think it's actually compiling the program you think it is. What happens if you clean the project first and then build it?

Jeff Armstrong
Approximatrix, LLC

3 (edited by designer 2025-11-11 18:19:09)

Re: Trouble with Sample Hello World

On the "real life" program, I did run the clean option but got the same result.

These problems started happening when I got a new MacMini M4 and updated it by initially restoring from a backup I made of the older M2 mini. It seems components can't find each other. For example, If I launch by double clicking a project file, it may not put the source code file in left hand column. And if I Save Project, it may bring up a Save dialog rather than go back to the folder (on the M4) that it was launched from.

I'm guessing it's best if I start from scratch (only a handful of hobby programs), creating completely New on the M4 and just copy/paste the code from the original programs.

I've zipped the Hello folder and sent it to Support.

In Project Option, General, the target name is "target" and Executable option is selected.
For Launch, Build before Launch is selected.
For Code Generation, Target CPU is native and Compile Strictly for Selection
Trap Floating Point Exceptions has Invalide Operation, Overflow, and Divide by Zero checked
For Fortran, Use Double Precision for all Reals is checked
For Linker, All Static and the three RunTime choices under that are checked.

Re: Trouble with Sample Hello World

It sounds like some of your issues are almost certainly permissions-related.  macOS has some pretty annoying access rules that require you to actually open files directly via "Open" in the File menu to force the question of whether you want to allow Simply Fortran to access certain folders.  My guess is that your new Mac has not asked you these questions yet, and Simply Fortran is being denied access to the folder where your project is saved.

Simply Fortran asking for a filename when you save a known file means that Simply Fortran does not have write access for that file.  I would try saving it as a new file to see if you get a question about access.

It might also help if you provide Simply Fortran with "Full Disk Access" (at your discretion of course).  You can open macOS Settings and click on "Privacy and Security."  In the list of security features, look for "Full Disk Access."  Select that feature, then use the + icon at the bottom of the access list or select Simply Fortran if its already listed and enable full access.

As for your compiler issue, I would disable the architecture-specific flags, including enabling "native" for optimization mode.  I'm not sure exactly what's happening, but I would instead set the Target CPU to generic and disable the Strict checkbox there.  I suspect some lookup of the "native" feature is incorrectly reporting the CPU as "apple-m1" rather than an explicit Arm variant like the compiler is expecting.

Jeff Armstrong
Approximatrix, LLC

5 (edited by designer 2025-11-12 00:52:23)

Re: Trouble with Sample Hello World

After changing the options, Hello World now works.

I'll play with the real code more tomorrow - Start a new project with it's own new folder, etc. and just paste in the old code.