如果没有 .mod 文件,带有 -gen-dep 选项的 ifort 无法生成依赖项的情况
The case that ifort with -gen-dep option cannot generate dependecy without .mod files
首先,请阅读---PS---部分。这个问题是我的误会。
我正在使用 ubuntu18.04 OS 和“parallel studio xe 2020 update 4”ifort 的 intel fortran 编译器。
我尝试使用带 -gen-dep 选项的 ifort 编译器在 fortran 源文件之间生成依赖关系。
下面的简单代码是为我的测试而写的。文件名为“main.f90”。
program main
use mod_a
implicit none
end program main
我执行了以下命令来生成“main.f90”的依赖项。
ifort -gen-dep -syntax-only main.f90
因此,我收到以下错误消息。
main.f90(2): エラー #7002: コンパイル済みモジュールファイルを開くときのエラーです。INCLUDE パスを確認してください。 [MOD_A]
use mod_a
--------^
错误消息通知“mod_a.mod”文件尚不存在(虽然它是用日语写的)。
在编译 mod_a.f90 已经生成“mod_a.mod”的情况下,我通过执行上述命令获得了以下“真正的依赖性”。
main.o : \
main.f90 mod_a.mod
如何在不生成 mod_a.mod 的情况下生成依赖项?
如果存在额外的ifort选项来实现我的目标,我想知道优先选项。
感谢您的阅读。
---PS---
我向所有读过这篇文章的人表示歉意post。
这个问题是我的误会。
我尝试用 ifort -gen-dep -syntax-only main.f90
再次编译我的“main.f90”程序。
program main
use mod_a
implicit none
end program main
结果,我收到了以下错误消息和“真正的依赖关系”。
main.f90(2): エラー #7002: コンパイル済みモジュールファイルを開くときのエラーです。INCLUDE パスを確認してください。 [MOD_A]
use mod_a
--------^
main.o : \
main.f90 mod_a.mod
我不知道为什么我没有看到这种“真正的依赖”,但我的目的已经达到了。
但是,另外,我发现了另一个问题并解决了。
如果“main.f90”有大量使用许多子例程、函数、变量等的代码……
ifort -gen-dep -syntax-only main.f90
returned
fatal error: too many errors emitted, stopping now
并且没有 return 依赖。
为了解决这个问题,我在 ifort 命令中添加了 -no-diag-error-limit
。
您需要提供有关 mod_a
的信息。
要么预先编译它,要么将它提供给 ifort -gen-dep
命令
$ ifort -gen-dep -syntax-only main.f90 mod_a.f90
main.o : \
main.f90 mod_a.mod
mod_a.mod : \
mod_a.f90
mod_a.o : \
mod_a.f90
首先,请阅读---PS---部分。这个问题是我的误会。
我正在使用 ubuntu18.04 OS 和“parallel studio xe 2020 update 4”ifort 的 intel fortran 编译器。
我尝试使用带 -gen-dep 选项的 ifort 编译器在 fortran 源文件之间生成依赖关系。
下面的简单代码是为我的测试而写的。文件名为“main.f90”。
program main
use mod_a
implicit none
end program main
我执行了以下命令来生成“main.f90”的依赖项。
ifort -gen-dep -syntax-only main.f90
因此,我收到以下错误消息。
main.f90(2): エラー #7002: コンパイル済みモジュールファイルを開くときのエラーです。INCLUDE パスを確認してください。 [MOD_A]
use mod_a
--------^
错误消息通知“mod_a.mod”文件尚不存在(虽然它是用日语写的)。 在编译 mod_a.f90 已经生成“mod_a.mod”的情况下,我通过执行上述命令获得了以下“真正的依赖性”。
main.o : \
main.f90 mod_a.mod
如何在不生成 mod_a.mod 的情况下生成依赖项? 如果存在额外的ifort选项来实现我的目标,我想知道优先选项。
感谢您的阅读。
---PS---
我向所有读过这篇文章的人表示歉意post。 这个问题是我的误会。
我尝试用 ifort -gen-dep -syntax-only main.f90
再次编译我的“main.f90”程序。
program main
use mod_a
implicit none
end program main
结果,我收到了以下错误消息和“真正的依赖关系”。
main.f90(2): エラー #7002: コンパイル済みモジュールファイルを開くときのエラーです。INCLUDE パスを確認してください。 [MOD_A]
use mod_a
--------^
main.o : \
main.f90 mod_a.mod
我不知道为什么我没有看到这种“真正的依赖”,但我的目的已经达到了。
但是,另外,我发现了另一个问题并解决了。
如果“main.f90”有大量使用许多子例程、函数、变量等的代码……
ifort -gen-dep -syntax-only main.f90
returned
fatal error: too many errors emitted, stopping now
并且没有 return 依赖。
为了解决这个问题,我在 ifort 命令中添加了 -no-diag-error-limit
。
您需要提供有关 mod_a
的信息。
要么预先编译它,要么将它提供给 ifort -gen-dep
命令
$ ifort -gen-dep -syntax-only main.f90 mod_a.f90
main.o : \
main.f90 mod_a.mod
mod_a.mod : \
mod_a.f90
mod_a.o : \
mod_a.f90