Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix_libc++_cannot_find_stdmodule#7074

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SnowinterCat wants to merge3 commits intoxmake-io:dev
base:dev
Choose a base branch
Loading
fromSnowinterCat:dev
Open
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
try_two_methods
  • Loading branch information
SnowinterCat authored andSnowinterCat committedNov 29, 2025
commit4d1579d05f0b59be3f70a258603e34da4131373a

Some comments aren't visible on the classic Files Changed page.

41 changes: 29 additions & 12 deletionsxmake/rules/c++/modules/clang/support.lua
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,25 +255,42 @@ function parse_link_files(filepath)
end

function get_stdmodules(target)

local cpplib = get_cpplibrary_name(target)
if cpplib then
if cpplib == "c++" then
-- libc++ module is found by parsing libc++.modules.json
local modules_json_path = _get_std_module_manifest_path(target)
if modules_json_path then
local modules_json = json.decode(io.readfile(modules_json_path))
if modules_json and modules_json.modules and #modules_json.modules > 0 then
local std_module_directory = path.directory(modules_json.modules[1]["source-path"])
if not path.is_absolute(std_module_directory) then
local clang_dir = path.directory(parse_link_files(get_clang_path(target)))
std_module_directory = path.join(clang_dir, std_module_directory)
end
if os.isdir(std_module_directory) then
return {path.normalize(path.join(std_module_directory, "std.cppm")), path.normalize(path.join(std_module_directory, "std.compat.cppm"))}
end
if not modules_json_path then
wprint("libc++.modules.json not found! maybe try to add --sdk=<PATH/TO/LLVM> or install libc++")
return
end
local modules_json = json.decode(io.readfile(modules_json_path))
if not (modules_json and modules_json.modules and #modules_json.modules > 0) then
wprint("libc++.modules.json is invalid! path: %s", path.normalize(modules_json_path))
return
end
local std_module_directory = path.directory(modules_json.modules[1]["source-path"])
-- check absolute path first
if path.is_absolute(std_module_directory) then
if os.isdir(std_module_directory) then
return {path.normalize(path.join(std_module_directory, "std.cppm")), path.normalize(path.join(std_module_directory, "std.compat.cppm"))}
else
wprint("std module directory not found: %s which defined in %s", path.normalize(std_module_directory), path.normalize(modules_json_path))
return
end
end
-- otherwise try to resolve relative path
local try_std_module_directory
-- first try the directory relative to libc++.modules.json
try_std_module_directory = path.join(path.directory(modules_json_path), std_module_directory)
if os.isdir(try_std_module_directory) then
return {path.normalize(path.join(try_std_module_directory, "std.cppm")), path.normalize(path.join(try_std_module_directory, "std.compat.cppm"))}
end
-- then try the directory relative to clang bin directory
try_std_module_directory = path.join(path.directory(parse_link_files(get_clang_path(target))), std_module_directory)
if os.isdir(try_std_module_directory) then
return {path.normalize(path.join(try_std_module_directory, "std.cppm")), path.normalize(path.join(try_std_module_directory, "std.compat.cppm"))}
end
elseif cpplib == "stdc++" then
-- dont be greedy and don't enable stdc++ std module support for llvm < 19
local clang_version = get_clang_version(target)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp