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

\n clangd error on module name #4

Open
Arthapz opened this issue Jul 16, 2024 · 3 comments
Open

\n clangd error on module name #4

Arthapz opened this issue Jul 16, 2024 · 3 comments

Comments

@Arthapz
Copy link

Arthapz commented Jul 16, 2024

but the logs are full of errors like

[ERROR][2024-07-15 16:03:31] .../vim/lsp/rpc.lua:770    "rpc"   "/opt/llvm-git/bin/clangd"  "stderr"    "E[16:03:31.557] Scanning modules dependencies for build/../modules/stormkit/Core/Utils/Stacktrac
e.mpp failed: error: unable to handle compilation, expected exactly one compiler job in '/opt/llvm-git/bin/clang -c -Qunused-arguments -m64 -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wpe
dantic -Wextra -ffp-model=fast -O3 -mfma -mfpu=neon -mavx -mavx2 -msse -msse2 -msse3 -mssse3 -msse4.2 -stdlib=libc++ -cxx-isystem/opt/llvm-git/include/c++/v1 -Ibuild/.gens/include -I/home/arthapz/Repos
/StormKit/include -D_GLIBCXX_DEBUG -DSTORMKIT_BUILD -DSTORMKIT_BUILD_DEBUG -DSTORMKIT_ASSERT=1 -DSTORMKIT_STATIC -DBOOST_STACKTRACE_USE_ADDR2LINE -DBOOST_STACKTRACE_LINK -isystem /home/arthapz/.xmake/p
ackages/g/glm/1.0.1/e8b755c3b7d04ec88316715dbafe4cb6/include -isystem /home/arthapz/Repos/StormKit/build/.packages/f/frozen/latest/9a1f279102e34dbe91527197132695fd/include -isystem /home/arthapz/.xmake
/packages/u/unordered_dense/v4.4.0/9226fe6ee99949838863899207aec25e/include -isystem /home/arthapz/.xmake/packages/m/magic_enum/v0.9.5/c9d129e2b37f49a5897d1ef2a130e7c3/include -isystem /home/arthapz/.x
make/packages/t/tl_function_ref/v1.0.0/db82eb7eb9e64a40a64595c6319b711b/include -isystem /home/arthapz/.xmake/packages/b/boost/1.84.0/1be587ae28144669827487e346d4bc81/include -isystem /home/arthapz/.xm
ake/packages/l/libbacktrace/v1.0/5ff2e6e6560147f597b99dfa2bbea685/include -Wno-experimental-header-units -fcolor-diagnostics -fexperimental-library -fstrict-aliasing -Wstrict-aliasing -Wno-missing-fiel
d-initializers -Wno-include-angled-in-module-purview -Wno-unknown-attributes -Wno-deprecated-declarations -ggdb3 -Wno-language-extension-token -fmodule-file=std=build/.gens/stormkit-core/linux/x86_64/d
ebug/rules/bmi/cache/modules/500a1880/std.pcm -fmodule-file=stormkit.Core:Parallelism.ThreadUtils=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Parallelism
.ThreadUtils.pcm --precompile -- build/../modules/stormkit/Core/Utils/Stacktrace.mpp'\n\nI[16:03:31.557] Recorded module unit path build/../modules/stormkit/Core/Utils/Stacktrace.mpp doesn't declare mo
dule stormkit.Core:Utils.Stacktrace\n"
@Arthapz For the first error, it says the module unit doesn't declare that module. Maybe it will helpful to check that. I noticed that there is a \n in the error message. So maybe it is related to the new line character.

llvm/llvm-project#66462 (comment)

so i searched a little but didn't found why i get this \n
for example

[ERROR][2024-07-16 15:48:06] .../vim/lsp/rpc.lua:770    "rpc"   "/opt/llvm-git/bin/clangd"  "stderr"    "I[15:48:06.472] Recorded module unit path /home/arthapz/Repos/StormKit/modules/stormkit/Core/Uti
ls/App.mpp doesn't declare module stormkit.Core:Utils.App\n"

the mapper file contain

stormkit.Engine:Core /home/arthapz/Repos/StormKit/modules/stormkit/Engine/Core.mpp
stormkit.Core:Utils.App /home/arthapz/Repos/StormKit/modules/stormkit/Core/Utils/App.mpp
stormkit.Core:Utils.Math /home/arthapz/Repos/StormKit/modules/stormkit/Core/Utils/Math.mpp

the compile_commands.json contain

{
  "directory": "/home/arthapz/Repos/StormKit",
  "arguments": ["/opt/llvm-git/bin/clang", "-c", "-Qunused-arguments", "-m64", "-g", "-fvisibility=hidden", "-fvisibility-inlines-hidden", "-Wall", "-Wpedantic", "-Wextra", "-ffp-model=fast", "-O3", "-mfma", "-mfpu=neon", "-mavx", "-mavx2", "-msse", "-msse2", "-msse3", "-mssse3", "-msse4.2", "-std=c++26", "-stdlib=libc++", "-cxx-isystem/opt/llvm-git/include/c++/v1", "-Ibuild/.gens/include", "-I/home/arthapz/Repos/StormKit/include", "-D_GLIBCXX_DEBUG", "-DSTORMKIT_BUILD", "-DSTORMKIT_BUILD_DEBUG", "-DSTORMKIT_ASSERT=1", "-DSTORMKIT_STATIC", "-DBOOST_STACKTRACE_USE_ADDR2LINE", "-DBOOST_STACKTRACE_LINK", "-isystem", "/home/arthapz/.xmake/packages/g/glm/1.0.1/e8b755c3b7d04ec88316715dbafe4cb6/include", "-isystem", "/home/arthapz/Repos/StormKit/build/.packages/f/frozen/latest/9a1f279102e34dbe91527197132695fd/include", "-isystem", "/home/arthapz/.xmake/packages/u/unordered_dense/v4.4.0/9226fe6ee99949838863899207aec25e/include", "-isystem", "/home/arthapz/.xmake/packages/m/magic_enum/v0.9.5/c9d129e2b37f49a5897d1ef2a130e7c3/include", "-isystem", "/home/arthapz/.xmake/packages/t/tl_function_ref/v1.0.0/db82eb7eb9e64a40a64595c6319b711b/include", "-isystem", "/home/arthapz/.xmake/packages/b/boost/1.84.0/1be587ae28144669827487e346d4bc81/include", "-isystem", "/home/arthapz/.xmake/packages/l/libbacktrace/v1.0/5ff2e6e6560147f597b99dfa2bbea685/include", "-Wno-experimental-header-units", "-fcolor-diagnostics", "-fexperimental-library", "-fstrict-aliasing", "-Wstrict-aliasing", "-Wno-missing-field-initializers", "-Wno-include-angled-in-module-purview", "-Wno-unknown-attributes", "-Wno-deprecated-declarations", "-ggdb3", "-Wno-language-extension-token", "-fmodule-file=std=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/std.pcm", "-fmodule-file=stormkit.Core:Utils.Numerics=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Utils.Numerics.pcm", "-fmodule-file=stormkit.Core:Coroutines=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Coroutines.pcm", "-fmodule-file=stormkit.Core:Meta.Concepts=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Meta.Concepts.pcm", "-fmodule-file=stormkit.Core:Meta.Traits=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Meta.Traits.pcm", "-fmodule-file=stormkit.Core:TypeSafe.AsCast=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-TypeSafe.AsCast.pcm", "-fmodule-file=stormkit.Core:TypeSafe.Boolean=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-TypeSafe.Boolean.pcm", "-fmodule-file=stormkit.Core:TypeSafe.Borrowed=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-TypeSafe.Borrowed.pcm", "-fmodule-file=stormkit.Core:Utils.Assert=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Utils.Assert.pcm", "-fmodule-file=stormkit.Core:Utils.Descriptors=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Utils.Descriptors.pcm", "-fmodule-file=stormkit.Core:Utils.Stacktrace=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Utils.Stacktrace.pcm", "-fmodule-file=stormkit.Core:Parallelism.ThreadUtils=build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Parallelism.ThreadUtils.pcm", "-x", "c++-module", "--precompile", "-o", "build/.gens/stormkit-core/linux/x86_64/debug/rules/bmi/cache/modules/500a1880/stormkit.Core-Utils.App.pcm", "modules/stormkit/Core/Utils/App.mpp"],
  "file": "modules/stormkit/Core/Utils/App.mpp"
},

and the file contain

module;

#include <stormkit/Core/PlatformMacro.hpp>

#include <stormkit/Core/MemoryMacro.hpp>

export module stormkit.Core:Utils.App;

import std;

import :Utils.Numerics;

export namespace stormkit::core {
    class STORMKIT_API App {
      public:
        App() noexcept          = default;
        virtual ~App() noexcept = default;

        App(App&&) noexcept                    = delete;
        auto operator=(App&&) noexcept -> App& = delete;

        App(const App&) noexcept                    = delete;
        auto operator=(const App&) noexcept -> App& = delete;

        virtual auto run(std::span<const std::string_view> args) -> Int = 0;
    };
} // namespace stormkit::core
@ChuanqiXu9
Copy link
Owner

The log looks odd to me. I don't remember I saw \n in my logs.

I think maybe you can debug it. The codes for modules map is at:

llvm::StringRef Contents = Buffer.get()->getBuffer();
llvm::SmallVector<StringRef, 32> Lines;
std::string Separator =
#ifdef _WIN32
"\r\n";
#else
"\n";
#endif
Contents.split(Lines, Separator);
for (auto Line : Lines) {
// Skip comments if any.
if (Line.starts_with("#"))
continue;
auto [ReadModuleName, ModuleUnitPath] = Line.split(' ');
ReadModuleName = ReadModuleName.trim();
ModuleUnitPath = ModuleUnitPath.trim();
if (ReadModuleName.empty() || ModuleUnitPath.empty())
continue;
llvm::SmallString<256> ModuleSourcePath;
if (!llvm::sys::path::is_absolute(ModuleUnitPath)) {
ModuleSourcePath = ModuleMapPath;
llvm::sys::path::remove_filename(ModuleSourcePath);
llvm::sys::path::append(ModuleSourcePath, ModuleUnitPath);
} else
ModuleSourcePath = ModuleUnitPath;
if (!llvm::sys::fs::exists(ModuleSourcePath)) {
log("Recorded module unit path {0} for module {1} not existed.",
ModuleSourcePath, ReadModuleName);
continue;
}
if (!verifyModuleUnit(ModuleSourcePath, ReadModuleName)) {
log("Recorded module unit path {0} doesn't declare module {1}",
ModuleSourcePath, ReadModuleName);
continue;
}
ModuleNameSourcesCache.insert_or_assign(ReadModuleName,
(std::string)ModuleSourcePath);
}
. It is relatively easy and independent. I believe you can understand what is it doing.

And also you can provide a reduced example so that I can try to reproduce it in my environments.

@ChuanqiXu9
Copy link
Owner

And it is odd that why your message say:

Recorded module unit path build/../modules/stormkit/Core/Utils/Stacktrace.mpp doesn't declare mo
dule stormkit.Core:Utils.Stacktrace\n"

but Stacktrace.mpp and module name stormkit.Core:Utils.Stacktrace doesnt' show up in your module map file.

@Arthapz
Copy link
Author

Arthapz commented Jul 17, 2024

And it is odd that why your message say:


Recorded module unit path build/../modules/stormkit/Core/Utils/Stacktrace.mpp doesn't declare mo

dule stormkit.Core:Utils.Stacktrace\n"

but Stacktrace.mpp and module name stormkit.Core:Utils.Stacktrace doesnt' show up in your module map file.

Yeah i didn't post the whole map because it's very big and used Utils.App as exemple instead of Stacktrace

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