在Windows中为Fortran编译器配置Eclipse-Photran中的LAPACK [英] Configuring LAPACK in Eclipse-Photran for fortran compiler on Windows

查看:892
本文介绍了在Windows中为Fortran编译器配置Eclipse-Photran中的LAPACK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新



谢谢Vladimir对图书馆有用的见解。我采取了另一种方法,在ubuntu中开发第一个(这比Eclipse / Cygwin / ...更容易,然后我正在尝试移植到Windows,但是我也有一些问题, ,发布在这里:从ubuntu移植fortran程序的问题到Windows



问题



我目前有以下设置并且无法获得配置的lapack库,以便我的fortran代码可以编译:




  • Windows 7

  • Cygwin安装(对于GNU fortran),添加到windows PATH

  • lapack和liblapack-devel安装cygwin


      <在文件夹C:/ cygwin / lib中导致liblapack.a和libblas.a



在我的程序中,我使用以下代码

$ b调用lapack库
$ b

 程序myProgram 
!使用lapack(现在保持评论)
...
在Eclipse中,我使用以下设置(使用Photran软件包):



    $ b $ Fortran项目:Windows上的可执行GNU fortran(GCC工具链)
  • GNU fortran编译器: gfortran $ {COMMAND} $ {FLAGS} $ {OUTPUT_FLAG} $ {OUTPUT_PREFIX} $ {OUTPUT} $ {INPUTS}

  • GNU fortran链接器: gfortran $ {COMMAND} $ {FLAGS} $ {OUTPUT_FLAG} $ {OUTPUT_PREFIX} $ {OUTPUT} $ {INPUTS}



我编译了库libblas .a和liblapack.a,用作Windows的静态库,它们位于C:/ cygwin / lib文件夹中。在GNU fortran链接器属性中,这些库在文件夹 C中被称为 lapack blas :/ cygwin的/ lib中。这导致 {$ COMMAND} -LC:/ cygwin / lib-llapack -lblas >部分的编译器和链接器。 (thanx to @ vladimir -f for the help)



在输出中没有任何错误消息。只有我现在在Eclipse中出现以下错误,没有最终的.exe或bin:

 构建期间发生错误。 
项目Hamfem运行构建器CDT Builder的错误
内部错误构建项目Hamfem配置
发布
java.lang.NullPointerException
内部错误构建项目Hamfem配置
发布
java.lang.NullPointerException

然而,构建的结果仍然是可执行文件,在这种情况下称为Hamfem.exe。运行此文件导致错误消息(而不是例程):程序无法启动,因为您的计算机中缺少cyglap​​ack-0.dll。尝试重新安装程序来解决这个问题。



该文件目前位于 C:/ cygwin / lib / lapack / 但是我希望这个文件不需要运行程序,所以我可以在不同的计算机上运行它。有人可以在此协作吗?



其次,在.exe所在的文件夹中复制粘贴.dll文件时,会运行一小段时间,生成一个stackdump文件。由于构建工作区错误,我无法在Eclipse-Photran中使用调试器。当我想在Eclipse中作为本地Fortran程序运行Eclipse时,Eclipse会发送消息未找到二进制文件。任何想法如何解决这个问题?

解决方案

问题在这里

  L / lib / lapack -llapack 

尝试更改它为

  -L / lib / lapack -llapack 

可能是在你的 Makefile



ie

  gfortran -funderscoring -O3 -Wall -c -fmessage-length = 0 -L / lib / lapack -llapack -o 

并确保 lapack.mod 真的在 / lib / lapack 在Cygwin上可能是 C:\cygwin\lib\lapack


Update

Thank you Vladimir for the usefull insights in libraries. I took another approach, developping first in ubuntu (which was a lot easier then messing around with Eclipse/Cygwin/... and now I'm trying to port to windows, which goes rather ok, however I have some questions about that too, posted here: Problems with porting a fortran program from ubuntu to windows

Question

I currently have the following setup and can't get the lapack library configured so that my fortran code can compile:

  • Windows 7
  • Cygwin installation (for GNU fortran), added to the windows PATH
  • lapack and liblapack-devel installed with cygwin
    • resulting in liblapack.a and libblas.a in the folder C:/cygwin/lib

In my program I call the lapack library using the following code

program myProgram
    !use lapack (stays commented now)
    ...

In Eclipse I used the following setup (with the Photran package):

  • Fortran Project: executable GNU fortran on Windows (GCC toolchain)
  • GNU fortran compiler: gfortran ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
  • GNU fortran linker: gfortran ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

I compiled the libraries libblas.a and liblapack.a, to use as a static library, for windows and they are located in the C:/cygwin/lib folder. In the GNU fortran linker properties, the libraries were called lapackand blasin the folder C:/cygwin/lib. This results in a part -L"C:/cygwin/lib" -llapack -lblas in the {$COMMAND} section of the compiler and linker. (thanx to @vladimir-f for the help)

In the output there are no error messages left anymore. Only I got now the following error in Eclipse and no final .exe or bins:

Errors occured during the build.
    Errors running builder 'CDT Builder' on project 'Hamfem'
    Internal error building project Hamfem configuration
    Release
    java.lang.NullPointerException
Internal error building project Hamfem configuration
Release
java.lang.NullPointerException

However, the result of the build is still an executable, in this case called Hamfem.exe. Running this file results in the error message (instead of the routine): The program can't start because cyglapack-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

That file is currently located in C:/cygwin/lib/lapack/ but I want that this file isn't needed to run the program, so I can run it on different computers. Can someone collaborate on this?

Second, when copy-pasting the .dll file in the folder where the .exe is located, it runs for a brief second, generating a stackdump file. I can't use the debugger in Eclipse-Photran due to the 'Building Workspace' error. Eclipse gives the message Binary not found when I want to run it in Eclipse as a local Fortran program. Any ideas how to resolve this problem?

解决方案

The problem is here

L/lib/lapack –llapack

try to change it for

-L/lib/lapack –llapack

probably it is in you Makefile.

i.e.

gfortran -funderscoring -O3 -Wall -c -fmessage-length=0 -L/lib/lapack -llapack -o 

And make sure lapack.mod is really in /lib/lapack which is probably C:\cygwin\lib\lapack on Cygwin.

这篇关于在Windows中为Fortran编译器配置Eclipse-Photran中的LAPACK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆