executing gcc9 on macOS 10.14

Chris Jones jonesc at hep.phy.cam.ac.uk
Wed Oct 23 08:21:47 UTC 2019


Hi,

( Please always reply to the list )

The error below looks like one we addressed recently. Have you updated 
your ports ? Please run

 > sudo port sync
 > sudo port upgrade outdated

then try again.

Chris


On 23/10/2019 9:17 am, Hans Goedbloed wrote:
> Thanks Chris,
> 
> Looks like what I hoped for: no other tools than gcc9 needed.
> However, when I do precisely what you said, I still get
> 
> hanss-imac:resabs hansgoedbloed$ gfortran-mp-9 -o test.exe ./test.f
> ld: library not found for -lSystem
> collect2: error: ld returned 1 exit status
> 
> All the libraries listed from your otool command are there, except /usr/lib/libSystem.B.dylib.
> Could that be the problem?
> 
> Hans
> 
> ________________________________________
> From: macports-users <macports-users-bounces at lists.macports.org> on behalf of Chris Jones <jonesc at hep.phy.cam.ac.uk>
> Sent: Tuesday, October 22, 2019 7:09 PM
> To: macports-users at lists.macports.org
> Subject: Re: executing gcc9 on macOS 10.14
> 
> Hi,
> 
> Your ld command is incomplete. You aren't passing any of the runtime
> libraries needed to link the .o file into an executable.
> 
> The simplest approach is to let gcc do the full job.
> 
> Titan ~/Documents/Code > cat test.f
>         program hello
>             print *, "Hello World!"
>         end program hello
> Titan ~/Documents/Code > gfortran-mp-9 -o test.exe ./test.f
> Titan ~/Documents/Code > ./test.exe
>    Hello World!
> 
> Titan ~/Documents/Code > otool -L ./test.exe
> ./test.exe:
>          /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 1252.200.5)
>          /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)
> 
> Chris
> 
> On 22/10/2019 5:41 pm, Hans Goedbloed wrote:
>> I have been using g95 for my fortran codes for many years, but it did
>> not work anymore after upgrading to macOS 10.14 Mojave. I was advised to
>> install gccc9 from MacPorts instead. This I did through "sudo port
>> selfupdate" and "sudo port install gcc9".
>>
>> This appeared to give all the required tools. When I then tried to
>> compile and execute the simplest fortran  program test.f (the usual just
>> writing of the message "Hello") by first compiling
>>
>> /opt/local/bin/gfortran-mp-9 -v -c test.f
>>
>> giving the required object file test.o, and then loading:
>>
>> /opt/local/bin/ld -v test.o
>>
>> this resulted in the messages
>>
>> @(#)PROGRAM:ld PROJECT:ld64-512.4
>>
>> BUILD 05:06:53 Aug 16 2019
>>
>> configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32
>> i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
>>
>> Library search paths:
>>
>>             /usr/lib
>>
>> Framework search paths:
>>
>>             /Library/Frameworks/
>>
>>             /System/Library/Frameworks/
>>
>> Undefined symbols for architecture x86_64:
>>
>>    "__gfortran_set_args", referenced from:
>>
>>         _main in test.o
>>
>>    "__gfortran_set_options", referenced from:
>>
>>         _main in test.o
>>
>>    "__gfortran_st_write", referenced from:
>>
>>         _MAIN__ in test.o
>>
>>    "__gfortran_st_write_done", referenced from:
>>
>>         _MAIN__ in test.o
>>
>> ld: symbol(s) not found for architecture x86_64
>>
>> I thought installation of gcc9 would include everything. How should I
>> fix this?‚Äč
>>
>>
>> Hans
>>
>>


More information about the macports-users mailing list