Skip to content
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

<module>-Swift.h: fatal error: module '<module>' not found #1448

Closed
vakhidbetrakhmadov opened this issue Oct 29, 2024 · 4 comments
Closed

<module>-Swift.h: fatal error: module '<module>' not found #1448

vakhidbetrakhmadov opened this issue Oct 29, 2024 · 4 comments

Comments

@vakhidbetrakhmadov
Copy link

Hello,

I am trying to compile a mixed_language_library target that depends on a swift_library target that exports Objective-C APIs.

I am getting the following error: <module>-Swift.h: fatal error: module '<module>' not found.

I have created a minimal repro example: mixed-language-cannot-find-module-repro.

To observe the error run: bazelisk build -s --sandbox_debug --platforms=@build_bazel_apple_support//platforms:ios_sim_arm64 //examples/apple/mixed_language_cannot_find_module_repro:Consumer.

@vakhidbetrakhmadov
Copy link
Author

#1174 might be the same issue

@vakhidbetrakhmadov
Copy link
Author

As far as i understand, generated <module>-Swift.h files always use @import <module>, and in order for an @import <module> to work there must be a corresponding -fmodule-map-file=path_to_<module>.modulemap flag being passed when compiling a .m file that imports <module>-Swift.h , which currently doesn't happen.

Previously i used apple_framework,and it worked if my understanding is correct because -F<framework_search_dir> containing <module>.framework containing module.modulemap was passed when compiling a .m that imports <module>-Swift.h.

@vakhidbetrakhmadov
Copy link
Author

vakhidbetrakhmadov commented Oct 29, 2024

If i copy the failed compile command from the logs, add -fmodule-map-file=path_to_<module>.modulemap and run, it succeeds.

@vakhidbetrakhmadov
Copy link
Author

Using --features=swift.propagate_generated_module_map fixes the issue.
Thanks to @brentleyjones for suggestion 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants