1

I am trying to compile a code with crayftn.

I get an error message

/opt/cray/pe/cce/10.0.1/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax

So it wants the flag --no-relax? OK, I can do that. So I re-link with that flag, and then it tells me

ftn -O3 --no-relax -dynamic -h pic -h omp -o stream_cray stream_mpi.o mysecond.o
ftn-2115 crayftn: ERROR in command line
  "-no-relax" is an invalid command-line option.

So it asks for "--no-relax", but then it doesn't understand it. Anyone know of a way out of this conundrum? Or another way of solving the root problem in the first place?

bob.sacamento
  • 6,283
  • 10
  • 56
  • 115
  • Q: Have you been able to successfully compile, link and run *ANY* program with your crayftn? Q: What version of crayftn? 10.0.1? Q: What platform? Where is x86_64-pc-linux coming from? Just curious... – paulsm4 Jul 06 '20 at 17:03
  • It's strange that it says `"-no-relax" is an invalid command-line option` with a single `-` in the flag. – Jonatan Öström Jul 06 '20 at 20:56
  • @JonatanÖström If I give the flag with a single `-`, then it complains that `no-relax` is invalid. Apparently, it drops the leading `-` in its reporting. – bob.sacamento Jul 10 '20 at 20:41
  • 2
    @JonatanÖström: perhaps if the OP typed `-mooseturd`, it might say `"mooseturd" is an invalid command-line option`. The real issues: Q1: does the *linker* understand "---no-relax"? Q2: If so, is "---no-relax" ever actually *passed* to the linker? SUGGESTION: wrap the option with `-Wl,--no-relax` to ensure it's passed *ONLY* to the linker. – paulsm4 Jul 10 '20 at 21:28
  • @paulsm4 About the `-`, sure;) Yeah, I agree, the linker is complaining, not the compiler, so it would seem like cray might have missed passing that flag to the linker. It might even be possible to link the program using `gfortran` or `gcc` or `ld` since it seems to be a `gnu` linker. But if passing with `-Wl,--no-relaxed` works that's nicer. – Jonatan Öström Jul 17 '20 at 16:11

1 Answers1

2

I found this link:

https://bb.cgd.ucar.edu/cesm/threads/failed-to-convert-gotpcrel-relocation-relink-with-no-relax.4494/

PROBLEM:

Hi, I get the following error message for CLM5.0 compilation with Intel compilers, during the final cesm bld ..ld: failed to convert GOTPCREL relocation; relink with --no-relax

SOLUTION:

Hi, Seems like found a solution to fix the compilation ...Adding of "-Wl,--no-relax" in LDFLAGS does not solve this problem, but "-mcmodel medium" in FFLAGS fixes this issue, after searching for "Relocation truncated to fit" in google search engine, it comes up with this link which was helpful to solve the issue "https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268394"

Best Regards,Prabhakar

See also:

https://community.intel.com/t5/Intel-Fortran-Compiler/relocation-truncated-to-fit/td-p/1146616

This looks like mixing compilers and libraries from different systems mixed up, either 32bit vs. 64bit or installations for ifort and mpiifort based on different glibc or something similar.

I'm still curious about your "development environment":

Q: Have you been able to successfully compile, link and run ANY program with your crayftn? Q: What version of crayftn? 10.0.1? Q: What platform? Where is x86_64-pc-linux coming from? Just curious...

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • Well, I guess I should have mentioned that the "mcmodel" doesn't work either. Intel and GNU recognize it but not Cray. I am using 10.0.1. No idea about the x86_64-pc-linux. I have successfully compiled several times here. I *think* the problem stems from a particularly large array in this code. Thanks. – bob.sacamento Jul 06 '20 at 17:56
  • FYI, the 2nd link I cited also talks about "large arrays" with respect to the "GOTPCREL relocation" error. Check it out :) – paulsm4 Jul 06 '20 at 18:04
  • Q: Did you resolve the problem? 1) If you "successfully compiled several times", then your environment is probably "OK". 2) Your [toolchain](https://support.nesi.org.nz/hc/en-gb/articles/360000329015-Compiling-software-on-Mahuika) has several elements, so it's sunsurprising there are "differences" in CLI options. 3) Try also `"-Wl,--no-relax" `. 4) "Large arrays" sounds most promising; https://sourceware.org/legacy-ml/binutils/2017-09/msg00052.html, – paulsm4 Jul 10 '20 at 19:58