I can reproduce the warning compiling just that simple code you listed. This is the compile command:

mkdir -p build && gfortran -c -o ./build/conftest.o conftest.F90 && gcc -o ./build/libconftest.dylib ./build/conftest.o -dynamiclib -undefined dynamic_lookup && rm -rf ./build

And error:
ld: warning: object file (./build/conftest.o) was built for newer macOS version (11.2) than being linked (11.0)

Note I recently uninstalled and reinstalled command line tools too, which does not seem to have fixed it.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

On Feb 15, 2021, at 11:30, Satish Balay <balay@mcs.anl.gov> wrote:

Here is the compile command and the warning:


===== Checking linker
Executing: gfortran -c -o /var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers/conftest.o -I/var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers   /var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers/conftest.F90
Successful compile:
Source:
     function foo(a)
     real:: a,x,bar
     common /xx/ x
     x=a
     foo = bar(x)
     end
Executing: gcc  -o /var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers/libconftest.dylib  -dynamiclib -single_module -undefined dynamic_lookup -multiply_defined suppress  /var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers/conftest.o
Possible ERROR while running linker:
stderr:
ld: warning: object file (/var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/petsc-dk9aiv7x/config.setCompilers/conftest.o) was built for newer macOS version (11.2) than being linked (11.0)
         Accepted FC PIC code without compiler flag
         =============================================================================================
<<<<<<

Its likely due to the way brew built gfortran. You can try compiling a simple test code and see if you can reproduce this warning.

There is a related issue at:

https://github.com/spack/spack/issues/21644

Satish


On Sat, 13 Feb 2021, Jacob Faibussowitsch wrote:

Hello All,

I’ve been getting these warnings for weeks, at first I figured it was due to gfortran brew package not being updated for Big Sur, but since it has persisted through a few gfortran brew updates I’m thinking it may be petsc related. This is on clean build on master.

ld: warning: object file (master-arch-darwin-c-debug/obj/sys/classes/bag/f2003-src/fsrc/bagenum.o) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: object file (master-arch-darwin-c-debug/obj/sys/f90-src/fsrc/f90_fwrap.o) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: object file (master-arch-darwin-c-debug/obj/sys/objects/f2003-src/fsrc/optionenum.o) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: object file (master-arch-darwin-c-debug/obj/sys/fsrc/somefort.o) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: object file (master-arch-darwin-c-debug/obj/sys/f90-mod/petscsysmod.o) was built for newer macOS version (11.2) than being linked (11.0)

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391