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

clang module 编译出现错误 fatal error: 'mm_malloc.h' file not found #5091

Closed
jingyu9575 opened this issue May 11, 2024 · 8 comments
Closed
Labels
Milestone

Comments

@jingyu9575
Copy link

Xmake 版本

v2.9.1+HEAD.0c79f6162

操作系统版本和架构

Windows 11 version 23H2

描述问题

使用 clang 编译器和 C++ module 时,添加#include ,编译出现错误:fatal error: 'mm_malloc.h' file not found

#4575 中已将clang-scan-deps命令的clang改为绝对路径(增加了 envs = os.getenvs() 选项),但最新版本中rules/c++/modules/modules_support/clang/compiler_support.lua 的212行又没有了这个选项,导致问题再次出现。

测试发现添加 envs = os.getenvs(), force = true (防止缓存)可以暂时解决这个问题。

期待的结果

无错误

工程配置

xmake.lua

target("hello-core")
set_kind("binary")
add_files("src/*.cpp", "src/*.cppm")

src/main.cpp

import test;

#include <iostream>

int main() {
}

src/test.cppm

module;
export module test;

附加信息和错误日志

xmake f --toolchain=clang

checking for platform ... windows
checking for architecture ... x64

xmake -vD

[  0%]: <hello-core> generating.module.deps src\main.cpp
clang-scan-deps --format=p1689 -- clang -x c++ -c src\main.cpp -o build\.objs\hello-core\windows\x64\release\src\main.cpp.obj -Qunused-arguments -m64 -fexceptions -fcxx-exceptions
error: Error while scanning dependencies for src\main.cpp:
In file included from src\main.cpp:3:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/iostream:41:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/ostream:40:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/ios:44:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/bits/ios_base.h:41:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/bits/locale_classes.h:40:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/string:54:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/bits/basic_string.h:4097:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/ext/string_conversions.h:43:
In file included from D:/u0/MSYS2/mingw64/include/c++/13.2.0/cstdlib:79:
In file included from D:/u0/MSYS2/mingw64/include/stdlib.h:770:
D:/u0/MSYS2/mingw64/include/malloc.h:84:10: fatal error: 'mm_malloc.h' file not found

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:977: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:329: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:406: in function <@programdir\core\base\scheduler.lua:399>
@jingyu9575 jingyu9575 added the bug label May 11, 2024
@waruqi
Copy link
Member

waruqi commented May 13, 2024

先试下 #5090 (comment)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try it first #5090 (comment)

@jingyu9575
Copy link
Author

jingyu9575 commented May 13, 2024

先试下 #5090 (comment)

尝试添加 c++20,还是有相同问题:

图片

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try it first #5090 (comment)

Try adding c++20, still have the same problem:
Picture

waruqi added a commit that referenced this issue May 13, 2024
@waruqi
Copy link
Member

waruqi commented May 13, 2024

#4575 中已将clang-scan-deps命令的clang改为绝对路径(增加了 envs = os.getenvs() 选项),但最新版本中rules/c++/modules/modules_support/clang/compiler_support.lua 的212行又没有了这个选项,导致问题再次出现。

2148980 这个 patch 给 revert 了。

刚恢复了,再试试,xmake update -s dev

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


#4575 has changed the clang of the clang-scan-deps command to an absolute path (envs = os.getenvs() option added), but in the latest version Line 212 of rules/c++/modules/modules_support/clang/compiler_support.lua does not have this option, causing the problem to reappear.

2148980 This patch is revert.

Just restored, try again, xmake update -s dev

@waruqi waruqi added this to the v2.9.2 milestone May 13, 2024
@jingyu9575
Copy link
Author

解决了,谢谢!

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Solved, thank you!

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

No branches or pull requests

3 participants