setup-fortran icon indicating copy to clipboard operation
setup-fortran copied to clipboard

Struggling to get the example working, especially with Windows

Open johncoxon opened this issue 5 months ago • 2 comments

Hi everyone,

I'm trying to get the example in the README working for a repository I maintain called tsyganenko. This uses CMake and f2py to build wheels for PyPI.

ubuntu-latest compiled successfully with every compiler.

I found that macOS and Windows both immediately fail with nvidia-hpc 25.1 so I believe this should be removed from the front-page example, as I think this must be an error.

macOS also fails with the intel-classic compiler due to an architecture problem, which I was surprised not to see in the exclude list in the front-page example. I think this exclusion should be added to the front-page example.

Now we move to the things where I'm not sure if it's me that is doing something wrong.

Firstly, Windows fails with every Fortran compiler, with the error No CMAKE_Fortran_COMPILER could be found. How do I successfully build a Windows wheel? Is this related to #45 – is Windows just not currently correctly supported?

Secondly, to get macOS to compile required setting an environment variable MACOSX_DEPLOYMENT_TARGET=14.0 and it only succeeds with gcc 13. I'm quite happy that it's succeeding with one of them, but in lfortran 0.45 it fails with:

ninja: build stopped: subcommand failed.

*** CMake build failed

ERROR Backend subprocess exited when trying to invoke build_wheel

I'm not sure whether this is something I'm doing wrong or something wrong with the example, but thought I'd report it just in case it's important. I've attached the logs for the ones where I can't decipher the errors below.

Please let me know if I can give any more information. I'm rather new to all this, so apologies in advance if this is something going wrong due to my own stupidity…

2_Build wheels for windows-latest.txt 9_Build wheels for windows-latest.txt 10_Build wheels for windows-latest.txt 11_Build wheels for windows-latest.txt 12_Build wheels for macos-latest.txt

johncoxon avatar Jul 03 '25 09:07 johncoxon

Hey @johncoxon

I found that macOS and Windows both immediately fail with nvidia-hpc 25.1 so I believe this should be removed from the front-page example, as I think this must be an error.

Yeah, sounds like the compatibility matrix is out of date. Likewise for intel-classic/mac which used to work when the default mac runners were intel but now they are aarch. I'll check on that. Thanks for the heads up.

Everything else sounds like a CMake-specific issue? I think most people are using this action with meson or fpm. As you've seen #45 has been thorny forever. I have no CMake experience or experience building Fortran extensions, so I'm useless to help, sorry. Maybe someone else can.

wpbonelli avatar Jul 03 '25 10:07 wpbonelli

the readme now omits nvidia on windows and mac, and intel-classic on mac. thanks for pointing that out

wpbonelli avatar Sep 20 '25 03:09 wpbonelli