如何调试以下 Fortran 程序

发布于 2024-12-17 17:36:13 字数 1126 浏览 5 评论 0原文

我正在尝试编译以下软件,以便我可以单步执行并调试它。我只是一个新手程序员,我试图了解整个 makefile 业务如何与 Fortran 一起工作。我知道有大量关于 makefile 的文献,但我只需要插入一个简单的调试标志,我认为如果有人为我提供这个问题的答案,那将是我学习的最佳方式。

所以我试图编译的程序 TINKER 实际上是由几个包组成的,位于 http://dasher.wustl.edu/tinkerwiki/index.php/Main_Page。我想编译和调试一个特定的可执行文件“analyze”。我联系了开发商并收到了以下答复,但我仍然陷入困境......

由于 TINKER 有很多小的源代码文件,我们要做的是 使用“-c”标志将每个小文件编译为目标文件。 然后我们将所有这些目标代码文件(即“.o”文件)放入 一个对象库。最后,我们链接每个 TINKER 顶层 程序,例如针对对象库的“分析”。有一个 TINKER 提供的 Makefile 可以执行此操作。我们还供应 称为“compile.make”、“library.make”的单独脚本和 “link.make”用于可以运行的各种CPU/编译器组合 为了执行我上面描述的步骤。构建“可调试” 可执行文件,您只需要包含适当的调试标志 (通常是“-g”)作为编译和链接阶段的一部分。

我目前运行的是 OSX 10.6.8。如果有人可以告诉我我进入了哪些文件夹,我输入了哪些命令,那就太棒了!

谢谢!

我的后续问题(一旦我能弄清楚如何通过命令行回答上述问题,将涉及如何使用 Photran IDE 导入相同的过程 - http://wiki.eclipse.org/PTP/photran/documentation/photran5#Starting_a_Project_with_a_Hand-Written_Makefile)

I am trying to compile the following software so that I can step through and debug it. I am only a novice programmer and I am trying to understand how this whole makefile business works with Fortran. I know that there is a ton of literature on makefiles but I just need to insert a simple debug flag and I think if someone provided me with the answer to this question that would be the best way for me to learn.

So the program I am trying to compile, TINKER, is actually made up of several packages, located at http://dasher.wustl.edu/tinkerwiki/index.php/Main_Page. I would like to compile and debug JUST ONE specific executable, "analyze". I contacted the developer and received the following reply but I am still stuck...

Since TINKER has lots of small source code files, what we do is
compile each of the small files to an object file using the "-c" flag.
Then we put all of these object code files (ie, the ".o" files) into
an object library. Finally, we link each of the TINKER top level
programs, such as "analyze", against the object library. There is a
Makefile supplied with TINKER that does this. We also supply
individual scripts called "compile.make", "library.make" and
"link.make" for various CPU/compiler combinations that can be run in
order to perform the steps I describe above. To build a "debuggable"
executable, you just need to include the appropriate debug flags
(usually "-g") as part of the compile and link stages.

I am currently running OSX 10.6.8. If someone could show me which folders I cd into, what commands I enter that would be so great!

Thanks!

My follow up question (once I can figure out how to answer the above via command line will concern how to import the same procedure but using the Photran IDE - http://wiki.eclipse.org/PTP/photran/documentation/photran5#Starting_a_Project_with_a_Hand-Written_Makefile)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹊巢 2024-12-24 17:36:14

说明位于 http://dasher.wustl.edu/tinkerwiki/index.php /Main_Page#Installing_TINKER_on_your_Computer

也许已经过时了? g77 已经过时了——最好使用 gfortran。

关键步骤:“使用脚本文件构建 TINKER 的第一步是运行适合您的操作系统和编译器版本的compile.make 脚本。接下来,您必须使用library.make 脚本创建目标代码模块的存档。最后,运行 link.make 脚本来生成完整的 TINKER 可执行文件集,可以通过编辑和运行“重命名”脚本来重命名可执行文件并将其移动到您喜欢的任何位置。

因此,cd 到 Mac 的目录 - 基于“我们还提供了特定于机器的目录,其中包含三个单独的 shell 脚本来编译源代码、构建对象库并链接二进制可执行文件。”然后运行命令脚本。可能是./compile.make。环顾四周寻找目录...您可能可以从名称中找出答案。或者搜索文件“compile.make”。

或者找到您当地更了解编程的人。

The directions are at http://dasher.wustl.edu/tinkerwiki/index.php/Main_Page#Installing_TINKER_on_your_Computer

Maybe out of date? g77 is obsolete -- it would be better to use gfortran.

The key steps: "The first step in building TINKER using the script files is to run the appropriate compile.make script for your operating system and compiler version. Next you must use a library.make script to create an archive of object code modules. Finally, run a link.make script to produce the complete set of TINKER executables. The executables can be renamed and moved to wherever you like by editing and running the ‘‘rename’’ script."

So cd to the directory for the Mac -- based on "we also provide machine-specific directories with three separate shell scripts to compile the source, build an object library, and link binary executables." Then run the command scripts. Probably ./compile.make. Look around for the directories ... you can probably figure it out from the names. Or search for the file "compile.make".

Or find someone local to you who knows more about programming.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文