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

时间:2017-04-14 06:47:20

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

我有一个32位的fortran代码,我需要在64位机器上编译。我研究并发现可以做到这一点。我安装了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

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

1 个答案:

答案 0 :(得分:1)

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

请注意,第一个命令中报告为不兼容的文件与另一个命令 String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); URL = "https://stackoverflow.com" webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setAppCacheEnabled(true); webView.getSettings().setAppCacheMaxSize(1024 * 1024 * 8); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); webView.getSettings().setAppCachePath(appCachePath); if (isNetworkAvailable()) { appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); } else { Log.e(TAG,"Load page from cache"); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); } 中报告的文件不同。

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