有关Fortran编译的一个错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了有关Fortran编译的一个错误相关的知识,希望对你有一定的参考价值。

从来没有用过fortran, 今天有师弟让我帮忙跑一个fortran的程序, 我一编译就报如下错误

/tmp/ccy4yDLX.o: In function `output_‘:
Hjdk.for:(.text+0xc3): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0xfa): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x131): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x168): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x314): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x34b): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x382): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x3b9): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
/tmp/ccy4yDLX.o: In function `rk_‘:
Hjdk.for:(.text+0x653): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x663): relocation truncated to fit: R_X86_64_32S against symbol `sol_‘ defined in COMMON section in /tmp/ccy4yDLX.o
Hjdk.for:(.text+0x809): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status

解决方案是在编译时加上参数设置 -mcmodel=medium 就可以

gfortran  a.for  -mcmodel=medium

 

以上是关于有关Fortran编译的一个错误的主要内容,如果未能解决你的问题,请参考以下文章

Matlab调用Fortran编译的DLL——未完待续

使用OpenMP从Fortran子例程中导致错误的结果和崩溃

Fortran语言在线代码运行编译工具推荐

编译旧Fortran代码的语法错误

mpifort -DMPI 编译错误:派生类型“mpi_status”用作实际参数。适用于英特尔 Fortran,但不适用于 GNU Fortran

MPI Fortran编译器优化错误[重复]