首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >"Relocation truncated to fit“仅适用于-static

"Relocation truncated to fit“仅适用于-static
EN

Stack Overflow用户
提问于 2015-07-30 00:25:23
回答 1查看 2K关注 0票数 2

我在windows7上使用cygwin (x86_64)的gfortran来编译一些来自NASA的旧fortran代码。当我使用

代码语言:javascript
复制
gfortran cma.f -o cma.exe

代码可以编译并运行,但需要在同一文件夹中使用以下四个库: cyggcc_s-seh-1.dll、cyggfortran-3.dll、cygquadmath 0.dll和cygwin1.dll

我想让它独立运行,所以我试过了

代码语言:javascript
复制
gfortran cma.f -static -o cma.exe

但是随后我得到了几个"relocation truncated to fit: R_X86_64_PC32 to undefined symbol“错误:

代码语言:javascript
复制
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(write.o): In function `write_float':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/write_float.def:1300:(.text$write_float+0x15c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(write.o): In function `determine_en_precision':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/write_float.def:1213:(.text$write_float+0x7cf): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(write.o): In function `write_float':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/write_float.def:1300:(.text$write_float+0x84e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(write.o): In function `output_float_FMT_G_16':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/write_float.def:1140:(.text$write_float+0xf22): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/write_float.def:1140:(.text$write_float+0x1781): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(read.o): In function `_gfortrani_convert_real':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/read.c:175:(.text$_gfortrani_convert_real+0x72): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `strtoflt128'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgfortran.a(read.o): In function `_gfortrani_convert_infnan':
/usr/src/debug/gcc-4.9.3-1/libgfortran/io/read.c:251:(.text$_gfortrani_convert_infnan+0x53): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `strtoflt128'
collect2: error: ld returned 1 exit status

我刚开始从源代码进行编译,但我已经做过一些编程(主要是在matlab/octave中)。我不知道Fortran,代码有4418行,做一些复杂的热力学。因此,修改代码对我来说不是一个很好的选择。

我还知道它可以使用Intel Fortran composer XE2013,更新5,编译器在MS Visual Studio的32位windows控制台应用程序中编译,具有以下选项: 132列,32位发布版本,并且没有运行时数组边界检查。但我没有英特尔编译器。

因此,这应该只是gfortran使用哪个编译器选项的问题。我已经尝试了很多不同的标志,但到目前为止还没有一个成功。那么如何才能让exe独立运行呢?

还有一些类似的问题,但是这些解决方案似乎涉及到代码是如何编写的。我不能更改代码,所以我需要一个涉及如何编译代码的解决方案。

EN

回答 1

Stack Overflow用户

发布于 2015-08-23 21:02:46

我认为你必须去掉cygwin64中的"-static“。cygwin64包中只提供了gfortran的共享库版本。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31706089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档