libSystem not found using gfortran

Chris Jones jonesc at hep.phy.cam.ac.uk
Fri Oct 11 12:08:15 UTC 2019


Hi,

Note, using the test application at

https://gist.github.com/certik/9755084

On my macOS 10.15 Xcode 11.1 machine here works just fine. See below.

I suspect your issue is the SDK path baked into the compiler you are 
using does not match what is now available on your system. You should 
check the output you get from the -v compilation and compare to what is 
actually available.

cheers Chris

Oberon ~/cernbox/MacPorts > cat test.f90
program test
implicit none
integer, parameter :: dp = kind(0d0)
real(dp), allocatable :: x(:)
integer :: i, n

n = 10
allocate(x(n))
forall(i=1:n) x(i) = i
print *, foo(x)

contains

real(dp) function foo(a) result(r)
real(dp), intent(in) :: a(:)
r = sum(a)
end function

end program

Oberon ~/cernbox/MacPorts > gfortran-mp-9 -v test.f90
Driving: gfortran-mp-9 -v test.f90 -mmacosx-version-min=10.15.0 
-asm_macosx_version_min=10.15 -l gfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran-mp-9
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin19/9.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: 
/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_lang_gcc9/gcc9/work/gcc-9.2.0/configure 
--prefix=/opt/local --build=x86_64-apple-darwin19 
--enable-languages=c,c++,objc,obj-c++,lto,fortran 
--libdir=/opt/local/lib/gcc9 --includedir=/opt/local/include/gcc9 
--infodir=/opt/local/share/info --mandir=/opt/local/share/man 
--datarootdir=/opt/local/share/gcc-9 --with-local-prefix=/opt/local 
--with-system-zlib --disable-nls --program-suffix=-mp-9 
--with-gxx-include-dir=/opt/local/include/gcc9/c++/ 
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local 
--with-isl=/opt/local --enable-stage1-checking --disable-multilib 
--enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug 
--with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld 
--with-ar=/opt/local/bin/ar 
--with-bugurl=https://trac.macports.org/newticket --disable-tls 
--with-pkgversion='MacPorts gcc9 9.2.0_0' 
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Thread model: posix
gcc version 9.2.0 (MacPorts gcc9 9.2.0_0)
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=10.15.0' 
'-asm_macosx_version_min=10.15' '-shared-libgcc' '-mtune=core2'
  /opt/local/libexec/gcc/x86_64-apple-darwin19/9.2.0/f951 test.f90 -fPIC 
-quiet -dumpbase test.f90 -mmacosx-version-min=10.15.0 -mtune=core2 
-auxbase test -version -fintrinsic-modules-path 
/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/finclude -o 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//cc2ojbSD.s
GNU Fortran (MacPorts gcc9 9.2.0_0) version 9.2.0 (x86_64-apple-darwin19)
	compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, 
MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (MacPorts gcc9 9.2.0_0) version 9.2.0 
(x86_64-apple-darwin19)
	compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, 
MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=10.15.0' 
'-shared-libgcc' '-mtune=core2'
  /opt/local/bin/as -arch x86_64 -v -force_cpusubtype_ALL 
-mmacosx-version-min=10.15 -o 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//ccC4YLDY.o 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//cc2ojbSD.s
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-9.0/bin
  "/opt/local/libexec/llvm-9.0/bin/clang" -cc1as -triple 
x86_64-apple-macosx10.15.0 -filetype obj -main-file-name cc2ojbSD.s 
-target-cpu penryn -fdebug-compilation-dir /Users/chris/cernbox/MacPorts 
-dwarf-debug-producer "clang version 9.0.0 (tags/RELEASE_900/final)" 
-dwarf-version=4 -mrelocation-model pic -o 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//ccC4YLDY.o 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//cc2ojbSD.s
Reading specs from 
/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/../../../libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=10.15.0' 
'-shared-libgcc' '-mtune=core2'
COMPILER_PATH=/opt/local/libexec/gcc/x86_64-apple-darwin19/9.2.0/:/opt/local/libexec/gcc/x86_64-apple-darwin19/9.2.0/:/opt/local/libexec/gcc/x86_64-apple-darwin19/:/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/:/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/
LIBRARY_PATH=/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/:/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=10.15.0' 
'-shared-libgcc' '-mtune=core2'
  /opt/local/libexec/gcc/x86_64-apple-darwin19/9.2.0/collect2 
-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/ 
-dynamic -arch x86_64 -macosx_version_min 10.15.0 
-weak_reference_mismatches non-weak -o a.out 
-L/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0 
-L/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/../../.. 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//ccC4YLDY.o -lgfortran 
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm 
-lgcc_ext.10.5 -lgcc -lSystem -v
collect2 version 9.2.0
/opt/local/bin/ld -syslibroot 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/ -dynamic -arch 
x86_64 -macosx_version_min 10.15.0 -weak_reference_mismatches non-weak 
-o a.out -L/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0 
-L/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0/../../.. 
/var/folders/97/z7_b52957j36mhz075gflttr0000gn/T//ccC4YLDY.o -lgfortran 
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm 
-lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-512.4
BUILD 14:16:54 Aug 26 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 
i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
	/opt/local/lib/gcc9/gcc/x86_64-apple-darwin19/9.2.0
	/opt/local/lib/gcc9
	/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib
Framework search paths:
	/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/

Oberon ~/cernbox/MacPorts > ./a.out
    55.000000000000000

Oberon ~/cernbox/MacPorts > otool -L ./a.out
./a.out:
	/opt/local/lib/libgcc/libgfortran.5.dylib (compatibility version 6.0.0, 
current version 6.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1281.0.0)
	/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, 
current version 1.0.0)
	/opt/local/lib/libgcc/libquadmath.0.dylib (compatibility version 1.0.0, 
current version 1.0.0)
Oberon ~/cernbox/MacPorts >


On 11/10/2019 1:02 pm, Chris Jones wrote:
> 
> one more request.
> 
> please post the full output from compiling your test code with the -v 
> option.
> 
> cheers Chris
> 
> On 11/10/2019 12:59 pm, Chris Jones wrote:
>>
>> can you please direct us to the exact test application code you are 
>> using ?
>>
>> Also, can you confirm the exact Xcode version you are using ?
>>
>> Have you correctly followed the macports migration guide after 
>> updating your OS ?
>>
>> https://trac.macports.org/wiki/Migration
>>
>> cheers Chris
>>
>> On 11/10/2019 12:55 pm, Guillaume Houzeaux @ BSC wrote:
>>> Hello,
>>>
>>> I'm compiling with gfortran9 on catalina and get this error:
>>>
>>> gfortran test.f90
>>> ld: library not found for -lSystem
>>> collect2: error: ld returned 1 exit status
>>>
>>> Seems that it does not find the library libSystem. I changed all the 
>>> library paths in my bash_profile
>>>
>>> to include /usr/lib but does not work. The only solution for the 
>>> moment is to compile with
>>>
>>> gfortran test.f90-L/usr/lib
>>>
>>> but this is not a practical option... Any idea on how to fix this?
>>>
>>> Thanks in advance
>>>
>>> -- 
>>> Guillaume Houzeaux
>>> Team Leader
>>> Dpt. Computer Applications in Science and Engineering
>>> Barcelona Supercomputing Center (BSC-CNS)
>>> Edificio NEXUS II - Office 3A, c) Jordi Girona 29
>>> 08034 Barcelona, Spain
>>>
>>> Location: 
>>> <https://www.google.es/maps/place/Carrer+de+Jordi+Girona,+08034+Barcelona/@41.3881175,2.1132195,17z/data=!3m1!4b1!4m8!1m2!10m1!1e2!3m4!1s0x12a4985099390467:0xd9abcf1987739b3e!8m2!3d41.3881175!4d2.1154135?hl=en> 
>>>
>>> Tel: +34 93 413 7781
>>> Skype user: guillaume_houzeaux_bsc
>>> WWW: BSC profile <https://www.bsc.es/houzeaux-guillaume>
>>> ResearcherID: D-4950-2012
>>> Scientific Profile: 
>>> <https://www.researchgate.net/profile/Guillaume_Houzeaux> 
>>> <http://scholar.google.es/citations?user=cL9khdYAAAAJ&hl=en> 
>>> <http://orcid.org/0000-0002-2592-1426> 
>>> <http://www.researcherid.com/rid/D-4950-2012>
>>>


More information about the macports-users mailing list