gfortran for M1?

Christopher Jones jonesc at hep.phy.cam.ac.uk
Sat Mar 20 15:50:37 UTC 2021


Hi,

You probably need to specify the SDK location. There are a number ways you can do this, gcc now supports the same mechanisms as clang. i.e. using scrub or setting SDKROOT .
I personally have

export SDKROOT=`xcrun --show-sdk-path`
in my shell profile for this very reason.

Chris

> On 20 Mar 2021, at 2:59 pm, petr.2006 at centrum.cz wrote:
> 
> Thank you Marius,
> 
> it did not help. I also reboot the machine.
> Now I am getting:
> 
> ld: library not found for -lm
> collect2: error: ld returned 1 exit status
> 
> I am not sure whether the message from collect2 was there before running 
> sudo port select gcc mp-gcc-devel.
> 
> I am using bash, but in default zsh it behaves the same.
> 
> pmm:work pet$ env
> SHELL=/bin/zsh
> XPC_FLAGS=0x0
> TERM_PROGRAM_VERSION=440
> __CFBundleIdentifier=com.apple.Terminal
> SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.SMYfudJeEJ/Listeners
> TERM_SESSION_ID=1AAB1E17-A7F0-4363-9F82-6F387012CAC1
> PWD=/Users/pet/work
> LOGNAME=pet
> HOME=/Users/pet
> TMPDIR=/var/folders/tk/dp822xl925n937bzfkc1t6v00000gn/T/
> TERM=xterm-256color
> USER=pet
> DISPLAY=/private/tmp/com.apple.launchd.EJPRpCSOgP/org.macports:0
> SHLVL=1
> XPC_SERVICE_NAME=0
> LC_CTYPE=UTF-8
> LC_COLLATE=C
> PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
> OLDPWD=/Users/pet
> TERM_PROGRAM=Apple_Terminal
> _=/usr/bin/env
> 
> Petr
> 
> 
> ______________________________________________________________
>> Od: "Marius Schamschula" <lists at schamschula.com>
>> Komu: "Gerben Wierda via macports-users" <macports-users at lists.macports.org>
>> Datum: 20.03.2021 15:24
>> Předmět: Re: gfortran for M1?
>> 
>> Petr,
>> 
>> sudo port select gcc mp-gcc-devel
>> 
>> will add links so that the binaries, includes and libraries can be found.
>> 
>>> On Mar 20, 2021, at 8:59 AM, <petr.2006 at centrum.cz> <petr.2006 at centrum.cz> wrote:
>>> 
>>> Thank you Chris,
>>> 
>>> I found gfortran-mp-devel in /opt/local/bin.
>>> 
>>> However trying to compile my source a got linker error:
>>> ld: library not found for -lm
>>> 
>>> And I am lost again. I did not specified any linker options,
>>> just compiler options:
>>> -g -fbounds-check -ffpe-trap=invalid,zero,overflow -ffpe-summary=invalid,zero,overflow -fno-sign-zero -fno-automatic -Wuninitialized
>>> 
>>> (Sorry for beginner question. Google did not help.)
>>> 
>>> Petr
>>> 
>>> ______________________________________________________________
>>>> Od: "Chris Jones" <jonesc at hep.phy.cam.ac.uk>
>>>> Komu: petr.2006 at centrum.cz
>>>> Datum: 20.03.2021 14:04
>>>> Předmět: Re: gfortran for M1?
>>>> 
>>>> CC: <macports-users at lists.macports.org>
>>>> Hi,
>>>> 
>>>> Gcc-devel provides gfortran for M1 machines by default.
>>>> 
>>>> Chris
>>>> 
>>>>> On 20 Mar 2021, at 1:01 pm, petr.2006 at centrum.cz wrote:
>>>>> 
>>>>> Is it already possible to install gfortran on M1?
>>>>> It seems that gcc-devel does not have +gfortran variant and and other gcc versions are not compatible. 
>>>>> Thank you, 
>>>>> Petr
>>>> 
>>>> 
>>>> 
>> 
>> Marius
>> --
>> Marius Schamschula
>> 
>> 
>> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1930 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20210320/669401b7/attachment.bin>


More information about the macports-users mailing list