Skip to content

[WIP] xmake在mingw下无法编译#6813

Closed
Copilot wants to merge 1 commit intodevfrom
copilot/fix-6807
Closed

[WIP] xmake在mingw下无法编译#6813
Copilot wants to merge 1 commit intodevfrom
copilot/fix-6807

Conversation

Copy link

Copilot AI commented Sep 16, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Xmake 版本

3.0.2

操作系统版本和架构

win10 mingw64

描述问题

用xmake创建一个默认的qt.widgetapp, xmake编译的时候, 出现如下错误:

编译的时候出现如下错误:

[ 58%]: linking.release test_batchgendlg.exe
error: D:/GNU/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrec
ognised emulation mode: windows
Supported emulations: i386pep i386pe
collect2.exe: error: ld returned 1 exit status

期待的结果

希望能编译过.

工程配置

add_rules("mode.debug", "mode.release")

target("test_batchgendlg")
add_rules("qt.widgetapp")
add_headerfiles("src/.h")
add_files("src/
.cpp")
add_files("src/mainwindow.ui")
-- add files with Q_OBJECT meta (only for qt.moc)
add_files("src/mainwindow.h")

附加信息和错误日志

$ xmake -vD
[ 58%]: linking.release test_batchgendlg.exe
D:\GNU\msys2_64\mingw64\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\test_batchgendlg.exe build.objs\test_b
atchgendlg\mingw\x86_64\release\src\BatchGenDlg.cpp.obj build.objs\test_batchgendlg\mingw\x86_64\release\src\main.cpp.o
bj build.objs\test_batchgendlg\mingw\x86_64\release\src\mainwindow.cpp.obj build.objs\test_batchgendlg\mingw\x86_64\re
lease\gens\src\moc_mainwindow.cpp.obj -m64 -LD:\GNU\msys2_64\mingw64\lib -s -lQt5Gui -lQt5Widgets -lQt5Core -lqtmain -lm
ingw32 -lws2_32 -lgdi32 -lole32 -ladvapi32 -lshell32 -luser32 -liphlpapi -Wl,-mwindows
D:/GNU/msys2_64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognised
emulation mode: windows
Supported emulations: i386pep i386pe
collect2.exe: error: ld returned 1 exit status
error: @programdir\core\main.lua:272: @programdir\actions\build\main.lua:146: @programdir\modules\async\runjobs.lua:331:
@programdir\modules\private\action\build\link_objects.lua:55: @programdir\core\sandbox\modules\os.lua:378: execv(D:\GNU
\msys2_64\mingw64\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\test_batchgendlg.exe build.objs\test_batchge
ndlg\mingw\x86_64\release\src\BatchGenDlg.cpp.obj build.objs\test_batchgendlg\mingw\x86_64\release\src\main.cpp.obj bui
ld.objs\test_batchgendlg\mingw\x86_64\release\src\mainwindow.cpp.obj build.objs\test_batchgendlg\mingw\x86_64\release
gens\src\moc_mainwindow.cpp.obj -m64 -LD:\GNU\msys2_64\mingw64\lib -s -lQt5Gui -lQt5Widgets -lQt5Core -lqtmain -lmingw32
-lws2_32 -lgdi32 -lole32 -ladvapi32 -lshell32 -luser32 -liphlpapi -Wl,-mwindows) failed(1)
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:1075]:
[@programdir\core\sandbox\modules\os.lua:378]: in function 'execv'
[@programdir\modules\core\tools\gcc.lua:948]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:246]:
[@programdir\core\tool\linker.lua:233]: in function 'link'
[@programdir\modules\private\action\build\link_objects.lua:55]: in function 'callback'
[@programdir\modules\core\project\depend.lua:227]: in function 'on_changed'
[@programdir\modules\private\action\build\link_objects.lua:39]: in function '_do_link_target'
[@programdir\modules\private\action\build\link_objects.lua:69]: in function 'jobfunc'
[@programdir\modules\async\runjobs.lua:247]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:246]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
[@programdir\modules\async\runjobs.lua:230]: in function 'cotask'
[@programdir\core\base\scheduler.lua:406]:

stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:1075: in function 'base/os.raiselevel'
(...tail calls...)
@programdir\core\main.lua:272: in upvalue 'cotask'
@programdir\core\base\scheduler.lua:406: in function <@programdir\core\

Fixes #6807.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Author

Copilot AI commented Sep 16, 2025

@waruqi 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

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

Successfully merging this pull request may close these issues.

xmake在mingw下无法编译

2 participants