Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relocation truncation error when linking 2dx_fftrans.exe #229

Open
andrew-niaid opened this issue Jul 30, 2018 · 2 comments
Open

relocation truncation error when linking 2dx_fftrans.exe #229

andrew-niaid opened this issue Jul 30, 2018 · 2 comments
Assignees

Comments

@andrew-niaid
Copy link

I get the following error when building focus on Linux (CentOS 7.5).

[ 52%] Linking Fortran executable 2dx_fftrans.exe
CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o: In function `MAIN__':
2dx_fftrans.for:(.text+0x10c): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x112): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x1b6): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x1cd): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x3e0): relocation truncated to fit: R_X86_64_32S against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x42d): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x54d): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x6a1): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x742): relocation truncated to fit: R_X86_64_PC32 against symbol `__BLNK__' defined in COMMON section in CMakeFiles/2dx_fftrans.dir/2dx_fftrans.for.o
2dx_fftrans.for:(.text+0x774): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
kernel/mrc/source/CMakeFiles/2dx_fftrans.dir/build.make:94: recipe for target 'kernel/mrc/source/2dx_fftrans.exe' failed
make[2]: *** [kernel/mrc/source/2dx_fftrans.exe] Error 1
CMakeFiles/Makefile2:4932: recipe for target 'kernel/mrc/source/CMakeFiles/2dx_fftrans.dir/all' failed
make[1]: *** [kernel/mrc/source/CMakeFiles/2dx_fftrans.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
Build failed for Focus

I'm linking against fftw 3.3.3 provided with the distro (not sure if it's relevant here).

I've tried gcc/gfortran versions 4.8.5 and 6.3.1 and get the same result.

@rdrighetto rdrighetto self-assigned this Jul 31, 2018
@sthennin
Copy link
Contributor

sthennin commented Aug 2, 2018

That error means that a 32-bit compiler was asked to allocate memory larger than the 32-bit addressing can reach.
I now reduced the block dimensions in 2dx_fftrans.for. Please try again if this works now better.
Thanks.

@sthennin sthennin closed this as completed Aug 2, 2018
@sthennin sthennin reopened this Aug 2, 2018
@andrew-niaid
Copy link
Author

Interesting. Since I don't have a 32bit compiler anywhere on the system, I did some more digging. It appears we are bumping into a memory model issue. The default gcc/gfortran option of -mcmodel=small is generating this error.

https://stackoverflow.com/a/12917191

I was able to fix the error (with the original larger block dimensions in 2dx_fftrans.for) by adding this option to the cmake in build_all:

-DCMAKE_Fortran_FLAGS=-mcmodel=medium

I can also confirm that the reduced block dimensions also compile correctly now without this option.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants