0

I'm trying to compile Tlusty and Synspec which are programs to generate model of stellar atmospheres and synthetic spectra. As in the guide that you can find here https://arxiv.org/pdf/2104.02829 I'm at the point where I have to compile Tlusty and Synspec using gfortran and I need -mcmodel=large to allocate more memory (I'm unsure whether this is the real reason but it should be something similar). If you want to check in the guide I linked above, look at section 5 (5.3 for a summary) and 6. Here I just put the output of my terminal

:~/tlusty208-package/tl208-s54/tlusty$ gfortran -fno-automatic -mcmodel=large -o tlusty.exe tlusty208.f 

tlusty208.f:13753:72:

13753 |   230    A(I,J)=SUM
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 230 at (1)
tlusty208.f:33348:72:

33348 |          DO 230 J=1,NMU
      |                                                                        1
Warning: Fortran 2018 deleted feature: Shared DO termination label 230 at (1)
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang integrated assembler command failed due to signal (use -v to see invocation)
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: x86_64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

I noticed several people have a similar problem and they say the path to gfortran should be put before the one of clang. However, this seems to be true already.

~/tlusty208-package/tl208-s54/tlusty$ which gfortran

/usr/local/bin/gfortran

~/tlusty208-package/tl208-s54/tlusty$ which clang

/usr/bin/clang

~/tlusty208-package/tl208-s54/tlusty$ gfortran --version

GNU Fortran (Homebrew GCC 14.2.0_1) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/tlusty208-package/tl208-s54/tlusty$ clang --version

Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: x86_64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

~/tlusty208-package/tl208-s54/tlusty$ echo $PATH

...
/usr/local/bin:
...
/usr/bin:
...

Where above I removed the other paths and substituted them with ...

If I don't use -mcmodel=large I have this problem.

~/tlusty208-package/tl208-s54/tlusty$ gfortran -fno-automatic -O3 -o tlusty.exe tlusty208.f 
tlusty208.f:13753:72:

13753 |   230    A(I,J)=SUM
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 230 at (1)
tlusty208.f:33348:72:

33348 |          DO 230 J=1,NMU
      |                                                                        1
Warning: Fortran 2018 deleted feature: Shared DO termination label 230 at (1)
ld: fixup error (kind=x86_64_was_rip_got_load_elide_got) at '_divstr_.part.0'+0x8 from ccOcdtfu.o, 32-bit RIP-relative reference out of range (displacement=2279953044, max is +/-2GB), from 0x1000008C8 to 0x187E55B60 ('_straux_')
final section layout:
    __PAGEZERO           addr=0x000000000, size=0x100000000, fileOffset=0x00000000, fileSize=0x00000000
    __TEXT               addr=0x100000000, size=0x000159000, fileOffset=0x00000000, fileSize=0x00159000
        __text           addr=0x1000008c0, size=0x000115eee, fileOffset=0x000008c0
        __text_startup   addr=0x1001167b0, size=0x00000001f, fileOffset=0x001167b0
        __stubs          addr=0x1001167d0, size=0x000000108, fileOffset=0x001167d0
        __cstring        addr=0x1001168d8, size=0x00000000c, fileOffset=0x001168d8
        __const          addr=0x100116900, size=0x000036bdc, fileOffset=0x00116900
        __eh_frame       addr=0x10014d4e0, size=0x00000b798, fileOffset=0x0014d4e0
    __DATA_CONST         addr=0x100159000, size=0x000001000, fileOffset=0x00159000, fileSize=0x00001000
        __got            addr=0x100159000, size=0x0000001e8, fileOffset=0x00159000
        __const          addr=0x1001591e8, size=0x0000000d0, fileOffset=0x001591e8
    __DATA               addr=0x10015a000, size=0x0aaf05000, fileOffset=0x0015a000, fileSize=0x00017000
        __data           addr=0x10015a000, size=0x0000164a0, fileOffset=0x0015a000
        __bss            addr=0x1001704a0, size=0x01a6d19a0, fileOffset=0x00000000
        __common         addr=0x11a841e40, size=0x09081cc68, fileOffset=0x00000000
    __LINKEDIT           addr=0x1ab05f000, size=0x000021000, fileOffset=0x00171000, fileSize=0x000207d0
collect2: error: ld returned 1 exit status

Thank you!!

P.S. I add also that I checked gcc --version and it was pointing at clang, so I put these lines in my bash profile

alias gcc='/usr/local/bin/gcc-14'
alias g++='/usr/local/bin/g++-14'
alias gfortran='/usr/local/bin/gfortran-14'
export FC=/usr/local/bin/gfortran-14
export F77=/usr/local/bin/gfortran-14

but yet I get the same exact error, and clang is still being used.

4
  • Where is the gfortran from? How was it installed? Commented May 10 at 21:28
  • @VladimirFГероямслава It was installed via Homebrew using 'brew install'. Maybe the line was hidden in the code but I also show this in the second box of code above: GNU Fortran (Homebrew GCC 14.2.0_1) 14.2.0 Commented May 11 at 12:19
  • The existing answer, despite mostly concentrating on irrelwvant points is true that the environment during make does not have to be the same as the outside one. I do not think that the alias commands achieve anything (but I may be wrong). Also, check which as or (gas) is being called. Commented May 12 at 7:05
  • Check also stackoverflow.com/questions/76096681/… Commented May 26 at 8:39

1 Answer 1

0

Presumably your "gfortran" is really the LLVM Fortran compiler (Apple is very allergic towards GNU tools). Call it directly with [code]--version[/code] and see what it tells you. Note that the environment used in the [code]Makefile[/code] might not have the same [code]PATH[/code] as your account. Edit it to force the exact compiler you want to use.

If that isn't the case, maybe you should try an older Fortran standard, e.g. by [code]-std=2008[/code]

Sign up to request clarification or add additional context in comments.

2 Comments

Why should it be LLVM instead (which exactly?) and why should Apple's politics matter when gfortran is in /usr/local?
Also, the deleted feature warnings are just red herrings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.