clangd / clangd

clangd language server
https://clangd.llvm.org
Apache License 2.0
1.51k stars 63 forks source link

std_config conflict #797

Open ghost opened 3 years ago

ghost commented 3 years ago

Let's say i have two modules which import the same header from stdlib (array)

export module module_one;
import<array>;
import<iostream>;
export void module_one_func() { std::cout << "module_one_func" << std::endl; }
export module module_two;
export import module_one;
import<array>;
import<iostream>;
export void module_two_func() { std::cout << "module_two_func" << std::endl; }

This code works and when i launch

/usr/bin/clang -std=c++20 -stdlib=libc++ -g -fmodules-ts -c -Xclang -emit-module-interface -fprebuilt-module-path=./PCM -fimplicit-modules -fimplicit-module-maps /home/alice/Programming/issue-reproduce/module_two.cpp -fsyntax-only -resource-dir=/usr/lib/clang/12.0.0

command from command line it doesn't show any warnings. But vscode extension and clangd (clangd --check=module_two.cpp --log=verbose) give me a strange error:

Module 'std_config' is defined in both '/home/alice/.cache/clang/ModuleCache/Z2TTFLURESKI/std_config-5743FB4UA0N1.pcm' and '/home/alice/.cache/clang/ModuleCache/SUVYYHB7U5KJ/std_config-5743FB4UA0N1.pcm'clang(module_file_conflict)

Also i've found similar issue : https://windowsquestions.com/2021/04/05/modules-with-clangd-configuration/ Logs log.log

System information Clangd version: 12.0.0 clangd extension version:0.1.11 Operating system:Linux (Manjaro)

mnesarco commented 1 year ago

I have the similar problem with clang-15

fatal error: module 'std_config' is defined in 
both '/home/xxx/.cache/clang/ModuleCache/307IGPE8YCJFE/std_config-1LRZ8JTHCNMTQ.pcm' 
and '/home/xxx/.cache/clang/ModuleCache/1J5DHBDSQ4I0A/std_config-1LRZ8JTHCNMTQ.pcm'

I have deleted /home/xxx/.cache/clang/ModuleCache but they are generated both again during build.