ubuntu - 在 64 位 Ubuntu 14.04 上编译 32 位 fortran 程序

标签 ubuntu fortran linker-errors 32bit-64bit

我有一个需要在 64 位机器上编译的 32 位 fortran 代码。我研究了一下,发现是可以做到的。我安装了 gfortran-multilib 来编译它。但是我遇到了这样的错误:

gfortran -lm bessj.o bessj0.o bessj1.o bessj2.o caxcb.o cgemp.o cmemcpy.o   four1.o gemp.o getdata.o qsbstab.o qsfftinv.o qshkpsv.o qshksh.o qskern.o qslayer.o qsmainC.o qsmatinv.o qsmatrix.o qsmoment.o qspsv.o qsqmodel.o qssh.o qssublay.o qswaveno.o qswvint.o wavelet.o -o qsmainC.0
/usr/bin/ld: i386 architecture of input file `bessj0.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `bessj2.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `caxcb.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `cgemp.o' is incompatible with i386:x86-64 output

然后我按照stackoverflow中的一个线程中的建议使用了-m32标志。我发现有些子程序是 32 位架构的,而有些是 64 位架构的。我现在收到其他文件的错误,如下所示:
gfortran -m32 -lm bessj.o bessj0.o bessj1.o bessj2.o caxcb.o cgemp.o cmemcpy.o four1.o gemp.o getdata.o qsbstab.o qsfftinv.o qshkpsv.o qshksh.o qskern.o qslayer.o qsmainC.o qsmatinv.o qsmatrix.o qsmoment.o qspsv.o qsqmodel.o qssh.o qssublay.o qswaveno.o qswvint.o wavelet.o -o qsmainC.0
/usr/bin/ld: i386:x86-64 architecture of input file `bessj.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `bessj1.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `four1.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `qsfftinv.o' is incompatible with i386 output

有没有办法编译这段代码?有人可以建议吗?

最佳答案

看起来您的一些 .o 文件是 32 位和一些 64 位的。

请注意,在第一个命令中报告为不兼容的文件与在另一个命令中报告为 -m32 的文件不同。 .

一致地重新编译所有这些。

关于ubuntu - 在 64 位 Ubuntu 14.04 上编译 32 位 fortran 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43406569/

相关文章:

shell - 每个用户的 SSH MOTD

linux - 使用 shell 脚本从 postgreSQL 检索数据并通过邮件发送

fortran - 使用常量参数调用函数时出现段错误

c++ - 对应于 C++ 中的 main 函数的编译时错误

c++ - OpenGl - 未解析的外部符号 __imp____iob_func 被引用

ubuntu - 为 dokku 容器指定 Ubuntu 版本

parallel-processing - 基于求和的 OpenMP

c# - 如何使用 C# 以科学格式解析 double

c++ - 使用 std::auto_ptr 时出现错误 LNK2019

python - Cmake:找不到 Python 2.7