[petsc-dev] Fortran macOS Linkage Warning

Barry Smith bsmith at petsc.dev
Fri Apr 16 21:36:59 CDT 2021


  If I had understand from the beginning this was merely a bug report we could have processed it much quicker and easier. 

  Hopefully this will resolve the problem and can get into the release branch soon. 


  https://gitlab.com/petsc/petsc/-/merge_requests/3884 <https://gitlab.com/petsc/petsc/-/merge_requests/3884>



> On Apr 16, 2021, at 3:23 PM, Jacob Faibussowitsch <jacob.fai at gmail.com> wrote:
> 
>>  I am not sure what the point is here. Are you unable to configure? or make all? or make check PETSc? 
> 
> At least on my end, none of them are possible without setting MAOSX_DEPLOYMENT_TARGET or --LDFLAGS=-mmacosx-version-min=11.2. Configure fails when it tests fortran linkage capability.
> 
> <configure.log>
> 
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> 
>> On Apr 16, 2021, at 15:03, Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
>> 
>> 
>>    I am not sure what the point is here. Are you unable to configure? or make all? or make check PETSc? 
>> 
>>    If so that should clearly be reported as a bug with all relevant information supplied. 
>> 
>>    No, we have never and do not ever intend for PETSc users even developers to know or care about MACOSX_DEPLOYMENT_TARGET
>> 
>>    Anyways if you are reporting a bug  and I am guess the bug correctly the fix is to add "was built for newer macOS version" to the list of filtered link warnings. There will be a bunch of such warnings that will need to be added to the filtering in the next few months but once they are in place the filtering should not be an issue.
>> 
>> 
>>    Barry
>> 
>> 
>> 
>>> On Apr 16, 2021, at 6:20 AM, Pierre Jolivet <pierre at joliv.et <mailto:pierre at joliv.et>> wrote:
>>> 
>>> Barry,
>>> That issue + this commit:
>>> $ git bisect bad
>>> 36c166f2bbb44c2987d8fb7385fbe9e2d1cfb0c8 is the first bad commit
>>> commit 36c166f2bbb44c2987d8fb7385fbe9e2d1cfb0c8
>>> Author: Barry Smith <bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>
>>> Date:   Sat Apr 10 13:40:10 2021 -0500
>>> makes it actually impossible to ./configure on macOS.
>>> Do we really expect all macOS users to know about the variable MACOSX_DEPLOYMENT_TARGET?
>>> 
>>> Thanks,
>>> Pierre
>>> 
>>> $ ./configure
>>> ===============================================================================
>>>              Configuring PETSc to compile on your system
>>> ===============================================================================
>>> TESTING: checkFortranLibraries from config.compilers(config/BuildSystem/config/compilers.py:921)                                                         
>>>  *******************************************************************************
>>>          UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log for details):
>>> -------------------------------------------------------------------------------
>>> Fortran libraries cannot be used with C as linker
>>> *******************************************************************************
>>> 
>>> Executing: mpicc  -o /var/folders/_9/0qn1m4z92wzbhz9434vx39fc0000gn/T/petsc-bhav6feq/config.setCompilers/conftest  -Wl,-bind_at_load -Wl,-multiply_defined,suppress -Wl,-multiply_defined -Wl,suppress -Wl,-commons,use_dylibs -Wl,-search_paths_first -Wl,-no_compact_unwind  -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -fno-stack-check -Qunused-arguments -fvisibility=hidden -g3 /var/folders/_9/0qn1m4z92wzbhz9434vx39fc0000gn/T/petsc-bhav6feq/config.setCompilers/conftest.o -lc++ -ldl  -lc++ -ldl -Wl,-rpath,/usr/local/Cellar/mpich/3.4.1_1/lib -L/usr/local/Cellar/mpich/3.4.1_1/lib -lmpifort -lmpi -lpmpi -lgfortran -Wl,-rpath,/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -L/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -Wl,-rpath,/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10 -L/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10 -lgfortran -lquadmath -lm
>>> Possible ERROR while running linker:
>>> stderr:
>>> ld: warning: dylib (/usr/local/Cellar/mpich/3.4.1_1/lib/libmpifort.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libgfortran.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libquadmath.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libquadmath.0.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>>           compilers: Cannot compile/link C with mpicc.
>>> 
>>>> On 12 Mar 2021, at 6:16 PM, Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
>>>> 
>>>> 
>>>>   You should be able to edit lib/petsc/conf/rules and add it to the filter for .cu.PETSc .kokkos.cxx.PETSc .c.PETSc .cxx.PETSc:  and .F.PETSc .F90.PETSc:
>>>> 
>>>>   I think it is fine to hide this warning; it is impossible for me to understand anyway :-(.
>>>> 
>>>>    Barry
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Mar 12, 2021, at 2:44 AM, Pierre Jolivet <pierre at joliv.et <mailto:pierre at joliv.et>> wrote:
>>>>> 
>>>>> Sorry to dig up this old thread, but this is triggering false positives while make checking for people who don’t want to toy around with MACOSX_DEPLOYMENT_TARGET.
>>>>> Could/should we filter this somehow, or have BuildSystem tinker with the environment variable itself?
>>>>> 
>>>>> Thanks,
>>>>> Pierre
>>>>> 
>>>>> $ make check
>>>>> Running check examples to verify correct installation
>>>>> Using PETSC_DIR=/Users/jolivet/repo/petsc and PETSC_ARCH=arch-darwin-c-debug-real
>>>>> *******************Error detected during compile or link!*******************
>>>>> See http://www.mcs.anl.gov/petsc/documentation/faq.html <http://www.mcs.anl.gov/petsc/documentation/faq.html>
>>>>> /Users/jolivet/repo/petsc/src/snes/tutorials ex19
>>>>> *********************************************************************************
>>>>> mpicc -Wl,-bind_at_load -Wl,-multiply_defined,suppress -Wl,-multiply_defined -Wl,suppress -Wl,-commons,use_dylibs -Wl,-search_paths_first -Wl,-no_compact_unwind -Wall -g  -Wall -g    -I/Users/jolivet/repo/petsc/include -I/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/include -I/opt/intel/mkl/include     ex19.c  -Wl,-rpath,/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib -L/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib -Wl,-rpath,/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib -L/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib -Wl,-rpath,/opt/intel/mkl/lib -L/opt/intel/mkl/lib -Wl,-rpath,/opt/intel/lib -L/opt/intel/lib -Wl,-rpath,/usr/local/Cellar/mpich/3.4.1_1/lib -L/usr/local/Cellar/mpich/3.4.1_1/lib -Wl,-rpath,/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -L/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -Wl,-rpath,/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10 -L/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10 -lpetsc -lHYPRE -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lmkl_scalapack_lp64 -lmkl_blacs_mpich_lp64 -lEl -lElSuiteSparse -lpmrrr -lp4est -lsc -liomp5 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lparmmg -lmmg -lmmg3d -lptesmumps -lptscotchparmetis -lptscotch -lptscotcherr -lesmumps -lscotch -lscotcherr -lparmetis -lmetis -ltriangle -ltet -lz -lX11 -lc++ -ldl -lmpifort -lmpi -lpmpi -lgfortran -lquadmath -lm -lc++ -ldl -o ex19
>>>>> ld: warning: dylib (/usr/local/Cellar/mpich/3.4.1_1/lib/libmpifort.dylib) was built for newer macOS version (11.1) than being linked (11.0)
>>>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libgfortran.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libquadmath.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: dylib (/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libquadmath.0.dylib) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: object file (/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib/libcmumps.a(cana_aux.o)) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: object file (/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib/libdmumps.a(dana_aux.o)) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: object file (/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib/libsmumps.a(sana_aux.o)) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: object file (/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib/libzmumps.a(zana_aux.o)) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> ld: warning: object file (/Users/jolivet/repo/petsc/arch-darwin-c-debug-real/lib/libmumps_common.a(front_data_mgt_m.o)) was built for newer macOS version (11.2) than being linked (11.0)
>>>>> C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process
>>>>> 
>>>>> 
>>>>>> On 15 Feb 2021, at 6:08 PM, Jacob Faibussowitsch <jacob.fai at gmail.com <mailto:jacob.fai at gmail.com>> wrote:
>>>>>> 
>>>>>> Yes, this also seems to work on my end.
>>>>>> 
>>>>>> Best regards,
>>>>>> 
>>>>>> Jacob Faibussowitsch
>>>>>> (Jacob Fai - booss - oh - vitch)
>>>>>> Cell: (312) 694-3391
>>>>>> 
>>>>>>> On Feb 15, 2021, at 12:05, Satish Balay <balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>> wrote:
>>>>>>> 
>>>>>>> Does setting MACOSX_DEPLOYMENT_TARGET also work?
>>>>>>> 
>>>>>>> Satish
>>>>>>> 
>>>>>>> On Mon, 15 Feb 2021, Jacob Faibussowitsch wrote:
>>>>>>> 
>>>>>>>> I think this problem ultimately stems from the fact that gcc/g++ and gfortran are not from the same people on macOS. It seems like clang is configured to build for 11.0 target, whilst gcc defaults to newest available target. And indeed if I change my compile command there is no warning:
>>>>>>>> 
>>>>>>>> mkdir -p build && gfortran -c -o ./build/conftest.o conftest.F90 && gcc-10 -o ./build/libconftest.dylib ./build/conftest.o -dynamiclib -undefined dynamic_lookup && rm -rf ./build
>>>>>>>> 
>>>>>>>> Note I now call gcc-10 as the linker which is the __actual__ gcc (not clang in a trench coat).
>>>>>>>> 
>>>>>>>> Best regards,
>>>>>>>> 
>>>>>>>> Jacob Faibussowitsch
>>>>>>>> (Jacob Fai - booss - oh - vitch)
>>>>>>>> Cell: (312) 694-3391
>>>>>>>> 
>>>>>>>>> On Feb 15, 2021, at 11:46, Jacob Faibussowitsch <jacob.fai at gmail.com <mailto:jacob.fai at gmail.com>> wrote:
>>>>>>>>> 
>>>>>>>>> Ok so if I pass -mmacosx-version-min=11.2 to the linker the warning disappears...
>>>>>>>>> 
>>>>>>>>> Best regards,
>>>>>>>>> 
>>>>>>>>> Jacob Faibussowitsch
>>>>>>>>> (Jacob Fai - booss - oh - vitch)
>>>>>>>>> Cell: (312) 694-3391
>>>>>>>>> 
>>>>>>>>>> On Feb 15, 2021, at 11:41, Jacob Faibussowitsch <jacob.fai at gmail.com <mailto:jacob.fai at gmail.com> <mailto:jacob.fai at gmail.com <mailto:jacob.fai at gmail.com>>> wrote:
>>>>>>>>>> 
>>>>>>>>>> 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 at mcs.anl.gov <mailto:balay at mcs.anl.gov> <mailto:balay at mcs.anl.gov <mailto:balay at 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 <https://github.com/spack/spack/issues/21644> <https://github.com/spack/spack/issues/21644 <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
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20210416/efb37c2a/attachment-0001.html>


More information about the petsc-dev mailing list