executing gcc9 on macOS 10.14

Chris Jones jonesc at hep.phy.cam.ac.uk
Wed Oct 23 09:45:03 UTC 2019


No problem, always glad to help someone use MacPorts !

On 23/10/2019 10:38 am, Hans Goedbloed wrote:
> Thanks!, I now know what to expect and how to fix it.
> Hans
> ________________________________________
> From: macports-users <macports-users-bounces at lists.macports.org> on behalf of Chris Jones <jonesc at hep.phy.cam.ac.uk>
> Sent: Wednesday, October 23, 2019 11:30 AM
> To: macports-users at lists.macports.org
> Subject: Re: executing gcc9 on macOS 10.14
> 
> On 23/10/2019 10:23 am, Hans Goedbloed wrote:
>> The xcrun did work, I do have turn around now!
>> Thanks for the help, Chris.
>>
>> I do have macOs 10.14.4 with Xcode 11.0 installed though, Should I change Xcode right now or can I wait for the next SDK issue to turn up?
> 
> That is up to you. It is just it is known that using Xcode 11 on macOS
> 10.14 does lead to these sort of SDK issues. They are being ironed out,
> slowly, but if you want to just avoid them its best to still to Xcode 10
> on 10.14..
> 
>>
>> Hans
>>
>> ________________________________________
>> From: macports-users <macports-users-bounces at lists.macports.org> on behalf of Chris Jones <jonesc at hep.phy.cam.ac.uk>
>> Sent: Wednesday, October 23, 2019 10:46 AM
>> To: macports-users at lists.macports.org
>> Subject: Re: executing gcc9 on macOS 10.14
>>
>> Another idea.
>>
>> What Xcode version are you running on mac OS 10.14 ?
>>
>> If Xcode 11, this is not recommended as it does lead to a lot of SDK
>> related issues, due to the fact Xcode 11 only has the 10.15 SDK (yes,
>> even on macOS 10.14).
>>
>> It is recommended to use Xcode 10 on macOS 10.14.
>>
>> Chris
>>
>> On 23/10/2019 9:37 am, Hans Goedbloed wrote:
>>> I updated the ports. looked allright (reply was "nothing to upgrade"), but the same problem:
>>> "ld: library not found for -lSystem"
>>>
>>> I also checked for the ld64 port and the reply was:
>>> "The following ports are currently installed:
>>> ld64 @3_1+ld64_xcode (active)"
>>>
>>> Any other suggestions?
>>>
>>> Hans
>>> ________________________________________
>>> From: macports-users <macports-users-bounces at lists.macports.org> on behalf of Chris Jones <jonesc at hep.phy.cam.ac.uk>
>>> Sent: Wednesday, October 23, 2019 10:27 AM
>>> To: macports-users at lists.macports.org
>>> Subject: Re: executing gcc9 on macOS 10.14
>>>
>>> Hi,
>>>
>>> One other comment. What version of the ld64 port do you have installed ?
>>> If it is not using the xcode variant, then please reinstall in using that
>>>
>>>      > port installed ld64
>>> The following ports are currently installed:
>>>       ld64 @3_1+ld64_xcode (active)
>>>
>>> if you do not get the above, run
>>>
>>>     > sudo port -f uninstall ld64
>>>     > sudo port install ld64
>>>
>>> Chris
>>>
>>> On 23/10/2019 9:21 am, Chris Jones wrote:
>>>> 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