You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started experimenting with Fortran builds and I tried to create a static library used from the main program. The compilation of main program fails, because it cannot find the mod file(s) of the static library. I assume this is because the compilation command does not define the static library directory as include directory (-I option with gfortran).
(Note that I may be completely wrong in my assumptions, because I am just starting with both Fortran and meson.)
I have the the following files all in the same directory:
program hello
use static_hello
implicit none
call static_say_hello()
end program hello
static_hello.f95
module static_hello
implicit none
private
public :: static_say_hello
interface static_say_hello
module procedure say_hello
end interface static_say_hello
contains
subroutine say_hello
print *, "Hello World!"
end subroutine say_hello
end module static_hello
Output that shows the error:
> ninja
[3/4] Compiling fortran object test_exe@exe\main.f95.obj
FAILED: gfortran "-pipe" "-Wall" "-g" "-Itest_exe@exe" "-I.." "-I." "-Jtest_exe@exe" -o test_exe@exe\main.f95.obj -c ..\main.f95
..\main.f95:2.6:
use static_hello
1
Fatal Error: Can't open module file 'static_hello.mod' for reading at (1): No such file or directory
[3/4] Static linking library static_hello.lib
ninja: build stopped: subcommand failed.
If I add the "-Istatic_hello@sta" option manually to test_exe@exe\main.f95.obj build rule in build.ninja, the build works. Hmmm... it actually works only "usually". It seems that there should also be some kind of dependency so that the static library module would always get built first. Now the build fails, if the main is built first (which is understandable, because it requires the mod file, and that is produced by the later build). But that may be a separate issue.
I am using meson from the latest master commit (e6a868e), running on Windows 10, and using GNU Fortran (tdm64-1) 4.9.2.
Thanks,
-Marko
The text was updated successfully, but these errors were encountered:
Hello,
I started experimenting with Fortran builds and I tried to create a static library used from the main program. The compilation of main program fails, because it cannot find the mod file(s) of the static library. I assume this is because the compilation command does not define the static library directory as include directory (-I option with gfortran).
(Note that I may be completely wrong in my assumptions, because I am just starting with both Fortran and meson.)
I have the the following files all in the same directory:
meson.build:
main.f95
static_hello.f95
Output that shows the error:
If I add the "-Istatic_hello@sta" option manually to test_exe@exe\main.f95.obj build rule in build.ninja, the build works. Hmmm... it actually works only "usually". It seems that there should also be some kind of dependency so that the static library module would always get built first. Now the build fails, if the main is built first (which is understandable, because it requires the mod file, and that is produced by the later build). But that may be a separate issue.
I am using meson from the latest master commit (e6a868e), running on Windows 10, and using GNU Fortran (tdm64-1) 4.9.2.
Thanks,
-Marko
The text was updated successfully, but these errors were encountered: