@@ -208,13 +208,22 @@ async function installFromSource(fpmVersion, fpmRepo){
208208 try {
209209
210210 // Find gfortran - it may be versioned (e.g., gfortran-13)
211+ // Use gcc <= 13 for compatibility with older fpm versions
211212 let gfortranCmd = 'gfortran' ;
213+ let foundGfortran = false ;
214+
212215 try {
213216 await exec . exec ( 'which' , [ 'gfortran' ] , { silent : true } ) ;
217+ foundGfortran = true ;
214218 } catch ( error ) {
215- // Try to find a versioned gfortran
219+ // gfortran not found, try versioned
220+ }
221+
222+ // If we found unversioned gfortran, check if it's gcc >= 14
223+ // If so, or if we didn't find unversioned gfortran, look for a versioned one <= 13
224+ if ( ! foundGfortran || true ) { // Always prefer versioned <= 13 for compatibility
216225 let foundVersioned = false ;
217- for ( const ver of [ 15 , 14 , 13 , 12 , 11 , 10 ] ) {
226+ for ( const ver of [ 13 , 12 , 11 , 10 ] ) {
218227 try {
219228 await exec . exec ( 'which' , [ `gfortran-${ ver } ` ] , { silent : true } ) ;
220229 gfortranCmd = `gfortran-${ ver } ` ;
@@ -226,12 +235,12 @@ async function installFromSource(fpmVersion, fpmRepo){
226235 }
227236 }
228237
229- if ( ! foundVersioned ) {
238+ if ( ! foundVersioned && ! foundGfortran ) {
230239 core . setFailed (
231240 'gfortran is required to build fpm from source on macOS ARM64.\n' +
232- 'Please install it before running this action, for example:\n' +
241+ 'Please install gcc version 10-13 before running this action, for example:\n' +
233242 ' - name: Install gfortran\n' +
234- ' run: brew install gcc\n' +
243+ ' run: brew install gcc@13 \n' +
235244 'Or use fortran-lang/setup-fortran to install a Fortran compiler.'
236245 ) ;
237246 return ;
0 commit comments