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 编译出现错误 attempt to concatenate a nil value (local 'bmifile') #5090

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

Comments

@jingyu9575
Copy link

Xmake 版本

v2.9.1+HEAD.0c79f6162

操作系统版本和架构

Windows 11 version 23H2

描述问题

使用 clang 编译器和 C++ module 时,编译出现错误:attempt to concatenate a nil value (local 'bmifile')

期待的结果

无错误

工程配置

xmake.lua

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

src/main.cpp

import test;

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
[  0%]: <hello-core> generating.module.deps src\test.cppm
checking for clang-scan-deps ... ok
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
clang-scan-deps --format=p1689 -- clang -x c++ -c src\test.cppm -o build\.objs\hello-core\windows\x64\release\src\test.cppm.obj -Qunused-arguments -m64 -fexceptions -fcxx-exceptions
[ 57%]: <hello-core> compiling.module.release src\test.cppm
checking for flags (clang_module_output) ... ok
> clang "-fmodule-output=" "-Qunused-arguments" "-m64"
error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:322: ...mdir\rules\c++\modules\modules_support\clang\builder.lua:37: attempt to
concatenate a nil value (local 'bmifile')
stack traceback:
    [...mdir\rules\c++\modules\modules_support\clang\builder.lua:37]: in function '_compile_one_step'
    [...mdir\rules\c++\modules\modules_support\clang\builder.lua:259]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:238]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:973: 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
@Issues-translate-bot
Copy link

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


Title: clang module compilation error attempt to concatenate a nil value (local 'bmifile')

@waruqi
Copy link
Member

waruqi commented May 13, 2024

参考下现有 demo

需要 c++20 。你没配置

@Issues-translate-bot
Copy link

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


Refer to the existing demo

Requires c++20. You didn't configure it

@jingyu9575
Copy link
Author

谢谢!就是这个问题,需要set_languages("c++20")

@Issues-translate-bot
Copy link

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


Thanks! This is the problem, you need set_languages("c++20")

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