xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.15k stars 783 forks source link

链接不了.dll.a #5497

Closed yybbwc closed 2 months ago

yybbwc commented 2 months ago

Xmake 版本

2.9.4

操作系统版本和架构

win10 LTSC21H1

描述问题

add_deps链接不了.dll.a

期待的结果

add_deps能正常链接

工程配置

一大堆

附加信息和错误日志

D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llexilla: No such file or directory D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lscintilla: No such file or directory

Issues-translate-bot commented 2 months ago

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


Title: Cannot link to .dll.a

Xmake version

2.9.4

Operating system version and architecture

win10 LTSC21H1

Describe the problem

add_deps cannot link to .dll.a

Expected results

add_deps can be linked normally

Project configuration

A lot

Additional information and error logs

D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../. ./x86_64-w64-mingw32/bin/ld.exe: cannot find -llexilla: No such file or directory D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../. ./x86_64-w64-mingw32/bin/ld.exe: cannot find -lscintilla: No such file or directory

star-hengxing commented 2 months ago

给一下完整 xmake.lua 和 -vD 编译 log

Issues-translate-bot commented 2 months ago

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


Give me the complete xmake.lua and -vD compilation log

yybbwc commented 2 months ago
--~ add_rules("mode.debug", "mode.release")
set_languages("c11", "cxx20")
set_optimize("smallest")
set_warnings("all", "error")
--~ set_strip("all")
--~ set_toolchains("mingw")
--~ add_ldflags("-static")

add_ldflags("-static")
includes("lexilla/src/xmake.lua")
includes("scintilla/win32/xmake.lua")
includes("scite/win32/xmake.lua")
--~ includes("lexilla/src")
--~ includes("scintilla/win32")
--~ includes("scite/win32")

--~ includes("irrlicht")
--~ includes("sqlite3")
--~ includes("freetype")
--~ includes("event")
--~ includes("ocgcore")
--~ includes("gframe/lzma")
--~ includes("gframe/spmemvfs")
--~ includes("gframe")
target("lexilla")
  set_kind("shared")
--~   add_cflags("-x c++")
--~   add_defines("LUA_UCID")
  add_includedirs("../include")
  add_includedirs("../lexlib")
  add_includedirs("../../scintilla/include")
--~   add_includedirs("../../scintilla/include")
  add_files("../lexers/*.cxx")
  add_files("../lexlib/*.cxx")
  add_files("*.cxx")
--~   add_files("../access/*.cxx")
--~ -Wl,--kill-at
--~ add_ldflags("-Wl,--kill-at")
--~   add_files("*.rc")
--~   add_files("src/lapi.c")
--~   add_files("src/lauxlib.c")
--~   add_files("src/lbaselib.c")
--~   add_files("src/lcode.c")
--~   add_files("src/lcorolib.c")
--~   add_files("src/lctype.c")
--~   add_files("src/ldblib.c")
--~   add_files("src/ldebug.c")
--~   add_files("src/ldo.c")
--~   add_files("src/ldump.c")
--~   add_files("src/lfunc.c")
--~   add_files("src/lgc.c")
--~   add_files("src/linit.c")
--~   add_files("src/liolib.c")
--~   add_files("src/llex.c")
--~   add_files("src/lmathlib.c")
--~   add_files("src/lmem.c")
--~   add_files("src/loadlib.c")
--~   add_files("src/lobject.c")
--~   add_files("src/lopcodes.c")
--~   add_files("src/loslib.c")
--~   add_files("src/lparser.c")
--~   add_files("src/lstate.c")
--~   add_files("src/lstring.c")
--~   add_files("src/lstrlib.c")
--~   add_files("src/ltable.c")
--~   add_files("src/ltablib.c")
--~   add_files("src/ltm.c")
--~   add_files("src/lundump.c")
--~   add_files("src/lutf8lib.c")
--~   add_files("src/lvm.c")
--~   add_files("src/lzio.c")
target("scintilla")
  set_kind("shared")
--~   add_cflags("-x c++")
--~   add_defines("LUA_UCID")
  add_includedirs("../include")
  add_includedirs("../src")
--~   add_includedirs("../../scintilla/include")
--~   add_includedirs("../../scintilla/include")
  add_files("../src/*.cxx")
--~   add_files("../src/*.cxx")
  add_files("*.cxx")

--~   add_files("../call/*.cxx")
--~  -loleaut32 -ladvapi32 -lstdc++
 add_syslinks("gdi32", "user32", "imm32", "ole32", "oleaut32", "advapi32")
add_syslinks("uuid")
add_syslinks("stdc++")
target("scite")
  set_kind("binary")
--~   add_cflags("-x c++")
  add_defines([[LUA_USER_H="scite_lua_win.h"]])
  add_defines("UNICODE", "_UNICODE")
--~   add_defines("_UNICODE")
  add_includedirs("../../lexilla/include", "../../lexilla/access")
  add_includedirs("../lua/src")
  add_includedirs("../../scintilla/include")
--~   add_includedirs("../../lexilla/access")
  add_includedirs("../src")
--~   add_includedirs("../../scintilla/include")
--~   add_includedirs("../../scintilla/include")
  add_files("../lua/src/*.c")
  add_files("*.cxx")
  add_files("*.rc", {defines = "STATIC_BUILD"})
--~   add_files("*.rc")
  add_files("../src/*.cxx")
  add_files("../../scintilla/call/*.cxx")
  add_files("../../lexilla/access/*.cxx")
  add_deps("lexilla")
add_deps("scintilla")
--~ -luxtheme -lgdi32 -luser32 -limm32 -lole32 -luuid -loleaut32 -lshell32 -lcomdlg32 -lcomctl32 -ladvapi32
add_syslinks("gdi32", "user32", "imm32", "ole32", "oleaut32", "shell32", "comdlg32", "comctl32", "advapi32")
add_syslinks("uxtheme", "uuid")
yybbwc commented 2 months ago
D:\_t\_fmsy\msys2\home\wscite>xmake -vD
[ 99%]: linking.release scite.exe
D:\_t\_fmsy\strawberry-perl-5.38.2.2-64bit-PDL\c\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\scite.exe build\.objs\scite\mingw\x86_64\release\scite\win32\DirectorExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\GUIWin.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTEWin.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTEWinBar.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTEWinDlg.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\Strips.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\UniqueInstance.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\Cookie.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\Credits.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\EditorConfig.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportHTML.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportPDF.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportRTF.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportTEX.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportXML.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\FilePath.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\FileWorker.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\IFaceTable.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\JobQueue.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\LuaExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\MatchMarker.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\MultiplexExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\PathMatch.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\PropSetFile.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ScintillaWindow.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEBase.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEBuffers.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEIO.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEProps.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StringHelpers.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StringList.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StyleDefinition.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StyleWriter.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\Utf8_16.cxx.obj build\.objs\scite\mingw\x86_64\release\scintilla\call\ScintillaCall.cxx.obj build\.objs\scite\mingw\x86_64\release\lexilla\access\LexillaAccess.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lapi.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lauxlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lbaselib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lbitlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lcode.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lcorolib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lctype.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldblib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldebug.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldo.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldump.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lfunc.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lgc.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\linit.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\liolib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\llex.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lmathlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lmem.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\loadlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lobject.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lopcodes.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\loslib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lparser.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lstate.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lstring.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lstrlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ltable.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ltablib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ltm.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lundump.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lutf8lib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lvm.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lzio.c.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTERes.rc.obj -m64 -Lbuild\mingw\x86_64\release -Wl,-rpath=$ORIGIN -llexilla -lscintilla -lgdi32 -luser32 -limm32 -lole32 -loleaut32 -lshell32 -lcomdlg32 -lcomctl32 -ladvapi32 -luxtheme -luuid -static
D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llexilla: No such file or directory
D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lscintilla: No such file or directory
collect2.exe: error: ld returned 1 exit status
error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:325: @programdir\actions\build\kinds\binary.lua:53: @programdir\core\sandbox\modules\os.lua:378: execv(D:\_t\_fmsy\strawberry-perl-5.38.2.2-64bit-PDL\c\bin\x86_64-w64-mingw32-g++ @C:\Users\ADMINI~1\AppData\Local\Temp\.xmake\240822\_C42106D5DDA84E94A43E9003BFA27047.args.txt) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@programdir\core\sandbox\modules\os.lua:378]: in function 'execv'
    [@programdir\modules\core\tools\gcc.lua:583]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]:
    [@programdir\core\tool\linker.lua:222]: in function 'link'
    [@programdir\actions\build\kinds\binary.lua:53]: in function 'callback'
    [@programdir\modules\core\project\depend.lua:217]: in function 'on_changed'
    [@programdir\actions\build\kinds\binary.lua:41]: in function '_do_link_target'
    [@programdir\actions\build\kinds\binary.lua:83]:
    [@programdir\actions\build\kinds\binary.lua:110]: in function '_link_target'
    [@programdir\actions\build\kinds\binary.lua:138]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\async\runjobs.lua:223]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:406]:

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

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



D:\_t\_fmsy\msys2\home\wscite>xmake -vD
[ 99%]: linking.release know.exe
D:\_t\_fmsy\strawberry-perl-5.38.2.2-64bit-PDL\c\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\scite.exe build\.objs\scite\ mingw\x86_64\release\scite\win32\DirectorExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\GUIWin.cxx.obj build\.objs\scite\mingw\x86_64\release\ scite\win32\SciTEWin.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTEWinBar.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTEWinDlg. cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\Strips.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\win32\UniqueInstance.cxx.obj build\. objs\scite\mingw\x86_64\release\scite\src\Cookie.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\Credits.cxx.obj build\.objs\scite\mingw\ x86_64\release\scite\src\EditorConfig.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportHTML.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\ src\ExportPDF.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportRTF.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportTEX.cxx. obj build\.objs\scite\mingw\x86_64\release\scite\src\ExportXML.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\FilePath.cxx.obj build\.objs\ scite\mingw\x86_64\release\scite\src\FileWorker.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\IFaceTable.cxx.obj build\.objs\scite\mingw\x86_64\ release\scite\src\JobQueue.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\LuaExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ MatchMarker.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\MultiplexExtension.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\PathMatch.cxx.obj build \.objs\scite\mingw\x86_64\release\scite\src\PropSetFile.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\ScintillaWindow.cxx.obj build\.objs\scite\ mingw\x86_64\release\scite\src\SciTEBase.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEBuffers.cxx.obj build\.objs\scite\mingw\x86_64\release\ scite\src\SciTEIO.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\SciTEProps.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StringHelpers. cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StringList.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\StyleDefinition.cxx.obj build\. objs\scite\mingw\x86_64\release\scite\src\StyleWriter.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\src\Utf8_16.cxx.obj build\.objs\scite\mingw\ x86_64\release\scintilla\call\ScintillaCall.cxx.obj build\.objs\scite\mingw\x86_64\release\lexilla\access\LexillaAccess.cxx.obj build\.objs\scite\mingw\x86_64\release\scite\ lua\src\lapi.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lauxlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\ src\lbaselib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lbitlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ lcode.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lcorolib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lctype. c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldblib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldebug.c. obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldo.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ldump.c.obj build \.objs\scite\mingw\x86_64\release\scite\lua\src\lfunc.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lgc.c.obj build\. objs\scite\mingw\x86_64\release\scite\lua\src\linit.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\liolib.c.obj build\.objs\ scite\mingw\x86_64\release\scite\lua\src\llex.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lmathlib.c.obj build\.objs\scite\ mingw\x86_64\release\scite\lua\src\lmem.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\loadlib.c.obj build\.objs\scite\mingw\ x86_64\release\scite\lua\src\lobject.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lopcodes.c.obj build\.objs\scite\mingw\x86_64\ release\scite\lua\src\loslib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lparser.c.obj build\.objs\scite\mingw\x86_64\release\ scite\lua\src\lstate.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lstring.c.obj build\.objs\scite\mingw\x86_64\release\scite\ lua\src\lstrlib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ltable.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\ src\ltablib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ltm.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\ lundump.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lutf8lib.c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lvm. c.obj build\.objs\scite\mingw\x86_64\release\scite\lua\src\lzio.c.obj build\.objs\scite\mingw\x86_64\release\scite\win32\SciTERes.rc.obj - m64 -Lbuild\mingw\x86_64\release -Wl,-rpath=$ORIGIN -llexilla -lscintilla -lgdi32 -luser32 -limm32 -lole32 -loleaut32 -lshell32 -lcomdlg32 -lcomctl32 -ladvapi32 -luxtheme -luuid -static
D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../. ./x86_64-w64-mingw32/bin/ld.exe: cannot find -llexilla: No such file or directory
D:/_t/_fmsy/strawberry-perl-5.38.2.2-64bit-PDL/c/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../. ./x86_64-w64-mingw32/bin/ld.exe: cannot find -lscintilla: No such file or directory
collect2.exe: error: ld returned 1 exit status
error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:325: @programdir\actions\build\kinds\binary. lua:53: @programdir\core\sandbox\modules\os.lua:378: execv(D:\_t\_fmsy\strawberry-perl-5.38.2.2-64bit-PDL\c\bin\x86_64-w64-mingw32- g++ @C:\Users\ADMINI~1\AppData\Local\Temp\.xmake\240822\_C42106D5DDA84E94A43E9003BFA27047.args.txt) failed(1)
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:973]:
[@programdir\core\sandbox\modules\os.lua:378]: in function 'execv'
[@programdir\modules\core\tools\gcc.lua:583]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:275]:
[@programdir\core\tool\linker.lua:222]: in function 'link'
[@programdir\actions\build\kinds\binary.lua:53]: in function 'callback'
[@programdir\modules\core\project\depend.lua:217]: in function 'on_changed'
[@programdir\actions\build\kinds\binary.lua:41]: in function '_do_link_target'
[@programdir\actions\build\kinds\binary.lua:83]:
[@programdir\actions\build\kinds\binary.lua:110]: in function '_link_target'
[@programdir\actions\build\kinds\binary.lua:138]: in function 'jobfunc'
[@programdir\modules\async\runjobs.lua:241]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:275]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
[@programdir\modules\async\runjobs.lua:223]: in function 'cotask'
[@programdir\core\base\scheduler.lua:406]:

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

star-hengxing commented 2 months ago

无法复现

// src/lib.c
int f(int x) {}
// src/main.c
int f(int x);

int main(int argc, char** argv)
{
    f(argc);
}
target("lib")
    set_kind("shared")
    add_files("src/lib.c")

target("test")
    set_kind("binary")
    add_files("src/main.c")

    add_deps("lib")
$ xmake -rv
[ 37%]: cache compiling.release src\lib.c
C:\Users\star\scoop\apps\msys2\2024-07-27\mingw64\bin\x86_64-w64-mingw32-gcc -c -m64 -o build\.objs\lib\mingw\x86_64\release\src\lib.c.obj src\lib.c
[ 50%]: cache compiling.release src\main.c
C:\Users\star\scoop\apps\msys2\2024-07-27\mingw64\bin\x86_64-w64-mingw32-gcc -c -m64 -o build\.objs\test\mingw\x86_64\release\src\main.c.obj src\main.c
checking for C:\Users\star\scoop\apps\msys2\2024-07-27\mingw64\bin\x86_64-w64-mingw32-gcc ... ok
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
[ 62%]: linking.release liblib.dll
C:\Users\star\scoop\apps\msys2\2024-07-27\mingw64\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\liblib.dll build\.objs\lib\mingw\x86_64\release\src\lib.c.obj -shared -m64 -Wl,--out-implib,build\mingw\x86_64\release\liblib.dll.a
[ 87%]: linking.release test.exe
C:\Users\star\scoop\apps\msys2\2024-07-27\mingw64\bin\x86_64-w64-mingw32-g++ -o build\mingw\x86_64\release\test.exe build\.objs\test\mingw\x86_64\release\src\main.c.obj -m64 -Lbuild\mingw\x86_64\release -llib
[100%]: build ok, spent 0.641s
yybbwc commented 2 months ago

主要是我这里的shared生成的.a文件在名字里带了.dll。如果这.a文件不带.dll这几个字符,就可以正常链接了。

Issues-translate-bot commented 2 months ago

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


The main reason is that the .a file generated by shared here has .dll in its name. If this .a file does not contain the characters .dll, it can be linked normally.

star-hengxing commented 2 months ago

主要是我这里的shared生成的.a文件在名字里带了.dll。如果这.a文件不带.dll这几个字符,就可以正常链接了。

我这里一样也有 -Wl,--out-implib,build\mingw\x86_64\release\liblib.dll.a

Issues-translate-bot commented 2 months ago

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


Mainly because the .a file generated by shared here has .dll in its name. If this .a file does not contain the characters .dll, it can be linked normally.

I also have -Wl,--out-implib,build\mingw\x86_64\release\liblib.dll.a here

yybbwc commented 2 months ago

那我再想想。编译好难……

Issues-translate-bot commented 2 months ago

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


Then I'll think about it. Compiling is so difficult...

waruqi commented 2 months ago

为啥就不能搞个正经 msys2 + mingw 环境呢,非得去用 /strawberry-perl-5.38.2.2-64bit-PDL 里面的 mingw 。。这种不趟坑才怪。

yybbwc commented 2 months ago

为啥就不能搞个正经 msys2 + mingw 环境呢,非得去用 /strawberry-perl-5.38.2.2-64bit-PDL 里面的 mingw 。。这种不趟坑才怪。

我之前是用win8.1系统,最近几天才升win10。 之前下了msys2,然后安装不上,说我系统不支持…… 现在用win10了,我没反应过来,以为自己还在用win8.1……

waruqi commented 2 months ago

用 msys2 + mingw 。这些问题自然就解了。

Issues-translate-bot commented 2 months ago

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


Why can't we create a serious msys2 + mingw environment? We have to use mingw in /strawberry-perl-5.38.2.2-64bit-PDL. . It would be strange not to go through this trap.

I used to use win8.1 system before, but I upgraded to win10 in the past few days. I downloaded msys2 before, but then it couldn't be installed, saying that my system doesn't support it... Now I'm using win10, but I didn't realize it and thought I was still using win8.1...

Issues-translate-bot commented 2 months ago

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


Use msys2 + mingw. These problems will be solved naturally.

yybbwc commented 2 months ago

用 msys2 + mingw 。这些问题自然就解了。

用了,然后现在编译成功了

Issues-translate-bot commented 2 months ago

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


Use msys2 + mingw. These problems will be solved naturally.

Used it, and now the compilation is successful