xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.87k stars 775 forks source link

C++ newly added module import not being found #5663

Open ilobilo opened 3 days ago

ilobilo commented 3 days ago

Xmake Version

2.9.5

Operating System Version and Architecture

Fedora KDE 40

Describe Bug

I have an issue when newly imported C++ modules are not being found (so adding import existing_module; to a source file). but if I do a clean rebuild with xmake clean --all and xmake build, no errors are thrown

Expected Behavior

finds the available modules

Project Configuration

compiles modules normally, nothing special

Additional Information and Error Logs

nope

waruqi commented 2 days ago

Can you provide an example? and logs?

ilobilo commented 2 days ago

let's say that the following compiles fine: main.cpp

import one;
import two;

int main()
{
    onefunc();
    twofunc();
    return 0;
}

one.cppm

export module one;
export void onefunc() { }

two.cppm

export module two;
export void twofunc() { }

now, if I modify two.cppm to this:

export module two;
import one;
export void twofunc() { onefunc(); }

I get an error about module one not being found. If I run xmake clean --all and xmake build, then it compiles. I believe Arthapz in the discord server said that this was a known issue.

error: two.cppm:2:8: fatal error: module 'one' not found
2 | import one;
| ~~~~~~~^~~~~~
1 error generated.