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.