-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find dependency from parent directory when building exe #734
Comments
Thanks for your feedback @samharrison7 , it seems that this problem does exist. In A feasible solution is to parse the dependency source files first, and then parse those main programs. (See #737) |
Thanks for the quick response and fix @zoziha! I've just tested your patch on my code (including a much more complicated version of the minimum example I posted) and it compiles the exe without problems now. |
Hi @samharrison7 - this behaviour is currently part of the intended design of fpm. Modules that are not in the main |
Ah I did wonder whether it was a design thing. That seems a logical restriction and is probably a good motivation for me to do some src directory restructuring of my projects! |
Though I do wonder whether having a flag to override this restriction would be a useful addition for legacy projects where directory restructuring isn't possible/desirable? |
Yes, this is a good point, though it'll have to be an option in the manifest file instead of a flag. |
@LKedward ,if I'm not mistaken, #737 doesn't seem to change the original intention of the design you mentioned.
src/
a/
a_mod.f90
b_mod.f90
main.f90
---
# fpm.toml
[[executable]]
name = "main"
source-dir = "src"
main = "main.f90" The above demo can be compiled normally in the #737 patch because app/
a/
a_mod.f90
b_mod.f90
main.f90
---
# fpm.toml
[[executable]]
name = "main"
source-dir = "app"
main = "main.f90" The above demo cannot be compiled normally in the #737 patch because the <ERROR>*cmd_build*:target error:Unable to find source for module dependency: "b_mod" used by "./app/a/a_mod.f90" The reason is that (PS. These 2 rules are really worth documenting in the |
Description
I am trying to build an executable from a project with the following structure:
In the code,
a_mod
usesb_mod
, andmain
usesa_mod
. When I build just as a library, it works as expected. However, when I specify to build an executable frommain.f90
, the build fails with the error<ERROR>*cmd_build*:target error:Unable to find source for module dependency: "b_mod" used by "./src/a/a_mod.f90"
.The issue seems to occur when a module depends on a module that is in a parent directory (i.e.
a_mod
depending onb_mod
from its parent directory) and only when build an executable.I have placed a minimum viable example of the project structure that causes this issue in this repo: https://github.com/samharrison7/fpm-test-exe-issues
Expected Behaviour
I expected
fpm
to build the executable from this project structure.Version of fpm
0.6.0, alpha
Platform and Architecture
Ubuntu 20.04
Additional Information
No response
The text was updated successfully, but these errors were encountered: