0

I am getting an error with gcc(7.2.0) and also pgi(18.4) compilers. There is a scientific application (in fortran) that I am compiling that has some dependencies. These dependencies are compiled with -fPIC flag. While compiling the main application, I get an error "relocation truncated to fit". When I add the flag -mcmodel=medium(pgi), the compilation succeds. But I am not willing to add this flag for some reasons. Also when I compile the main application with -fPIC, i get linker error and a suggestion to add --no-relax flag. After adding the same, I still get the relocation error. Is there any way I can compile without the -mcmodel=medium flag?

Edit: Also, when using gnu compilers, whatever mcmodel I use, I am getting the relocation error. Can this be something related to an old linker. Because I think, the application and its dependencies are compiled with 64 bit libraries, and the linker is what I assume operates with 32 bit libraries. As a reason for successful compilation with pgi when I perform /ld-linux.so --list , I get an error saying cannot map to zero fill pages. And while running the executable, I get a message as Killed.

Vineet
  • 3
  • 6
  • I assume that mcmodel is only related to the size of the arrays that you are using. For instance, if the arrays/matrices are relatively large, one has to increase the memory that the application can use via -mcmodel flag. You can check also similar question: https://stackoverflow.com/questions/10486116/what-does-this-gcc-error-relocation-truncated-to-fit-mean . In any case, if the compilation works with the flag, just take it as it is or you can of course reduce the size of arrays in your program. – msi_gerva Oct 12 '18 at 18:11
  • @msi_gerva : Thanks, this is a very good explanation in the link. Well, can you please look into my edit and suggest me about the linker. Thanks. – Vineet Oct 13 '18 at 00:30
  • I looked at your edit, but unfortunately cannot give you any suggestions. When I Googled about your issue with the "cannot map ...", it still looked like some memory issue - at least I saw some posts, where this indicated memory issues. In anyhow, seems like your program is having some really large arrays and as you said that some of the libraries have been compiled with -fPIC option (also something associated how arrays are treated within memory), make sure you are using the same compiler/options for all dependent libraries and your program. – msi_gerva Oct 14 '18 at 17:17
  • In addition, you may look some posts like https://www.pgroup.com/userforum/viewtopic.php?t=18&sid=0817c7a37cc2afa6f5a67caa22696015, where they use addional flag. – msi_gerva Oct 14 '18 at 17:18
  • For pgi, mdmodel=medium is the one that is tar largest. For gnu mcmodel=large exists. Well dependencies are compiled with -fPIC and -m64 and the application is with mcmodel and m64. – Vineet Oct 14 '18 at 17:20
  • Yes, I googled just after made the comment (I am using GNU compiler myself). Sorry for confusion! – msi_gerva Oct 14 '18 at 17:23
  • But if those libraries are about to work with your large arrays, shouldn't they also be compiled with mcmodel option? I am not sure how that works, but in any case if they cannot handle large arrays, they may raise an issue. What exactly is the size of your arrays, can it be problem in any case? Perhaps you can make some small test, where you use arrays with small dimension. – msi_gerva Oct 14 '18 at 17:25
  • Have tried that. But no success.. Thanks, will try changing the linker to a newer one. I actually have a very old os version n libraries. And I can't upgrade since this is a live cluster environment. – Vineet Oct 14 '18 at 17:28
  • Unfortunate to hear that. In any case good luck solving and troubleshooting the problem! – msi_gerva Oct 14 '18 at 17:42

0 Answers0