xmake-io / xmake

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

使用xmake f -p mingw 无法编译第三方库, cmake报错 #4048

Closed xubury closed 1 year ago

xubury commented 1 year ago

Xmake 版本

v2.8.1+dev.732d60063

操作系统版本和架构

Windows 10 19045.3208

描述问题

使用xmake f -p mingw 无法编译第三方库, cmake报错

期待的结果

add_requires能够正常编译第三方库

工程配置

add_rules("mode.debug", "mode.release") add_rules("plugin.compile_commands.autoupdate") add_requires("glfw")

target("hello") set_kind("binary") add_files("src/*.cpp") set_languages("c++17") add_packages("glfw")

附加信息和错误日志

$ xmake f -p mingw -c -vD
checking for architecture ... x86_64
checking for mingw directory ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
git rev-parse HEAD
checking for cmake ... no
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checking for Microsoft C/C++ Compiler (x64) version ... 19.28.29915
checking for cmake ... no
checking for cmake ... no
checking for cmake ... ok
checking for xmake-repo::opengl ... opengl
finding glfw from xmake ..
checking for xmake::glfw ... no
finding glfw from vcpkg ..
finding glfw from conan ..
checking for glfw ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> glfw 3.3.8
please input: y (y/n/m)
y
checking for ping ... ok
pinging for the host(github.com) ... 66 ms
checking for 7z ... C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z
C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z x -y 3.3.8.tar.gz -oC:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_21EAC003CACC4F50866CE820EA14C6A0.tar

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 803789 bytes (785 KiB)

Extracting archive: 3.3.8.tar.gz
--
Path = 3.3.8.tar.gz
Type = gzip
Headers Size = 10

Everything is Ok

Size:       4464640
Compressed: 803789
C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z x -y C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_21EAC003CACC4F50866CE820EA14C6A0.tar\3.3.8.tar -osource.tmp

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 4464640 bytes (4360 KiB)

Extracting archive: C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_21EAC003CACC4F50866CE820EA14C6A0.tar\3.3.8.tar
--
Path = C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_21EAC003CACC4F50866CE820EA14C6A0.tar\3.3.8.tar
Type = tar
Physical Size = 4464640
Headers Size = 93184
Code Page = UTF-8

Everything is Ok

Folders: 15
Files: 158
Size:       4329660
Compressed: 4464640
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the c compiler (cc) ... x86_64-w64-mingw32-gcc
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the assember (as) ... x86_64-w64-mingw32-gcc
checking for C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\ar ... ok
checking for the static library archiver (ar) ... ar
checking for C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\ranlib ... ok
checking for unknown toolkind ranlib (ranlib) ... ranlib
checkinfo: @programdir\core\sandbox\modules\os.lua:273: cannot runv(x86_64-w64-mingw32-windres -i C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_42AB38C64A3D49108AAD46D26D332470.rc -o C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_AB270B8685104E708E874D01B72228E0.o), No such file or directory
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [@programdir\core\sandbox\modules\os.lua:273]: in function 'runv'
    [@programdir\modules\detect\tools\find_windres.lua:48]: in function '_check'
    [@programdir\modules\detect\tools\find_windres.lua:69]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]:
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:68]: in function '_do_check'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:91]: in function '_check'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:245]: in function '_find'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:314]:
    [@programdir\modules\lib\detect\find_tool.lua:31]: in function '_find_from_modules'
    [@programdir\modules\lib\detect\find_tool.lua:42]: in function '_find_tool'
    [@programdir\modules\lib\detect\find_tool.lua:88]:
    [@programdir\core\tool\toolchain.lua:470]: in function '_checktool'
    [@programdir\core\tool\toolchain.lua:210]: in function 'tool'
    [@programdir\core\tool\toolchain.lua:740]:
    [@programdir\core\package\package.lua:1049]: in function 'index'
    [@programdir\core\package\package.lua:1027]: in function 'build_getenv'
    [@programdir\modules\package\tools\cmake.lua:426]: in function '_get_configs_for_mingw'
    [@programdir\modules\package\tools\cmake.lua:697]: in function '_get_configs'
    [@programdir\modules\package\tools\cmake.lua:980]: in function 'install'
    [....xmake\repositories\xmake-repo\packages\g\glfw\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:364]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:328]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\private\async\runjobs.lua:218]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:404]:

checking for x86_64-w64-mingw32-windres ... no
checking for the windows resource compiler (mrc: x86_64-w64-mingw32-windres) ... no
checking for C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\windres ... ok
checking for the windows resource compiler (mrc) ... windres
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the linker (ld) ... x86_64-w64-mingw32-g++
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the shared library linker (sh) ... x86_64-w64-mingw32-g++
checking for cmake ... ok
cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmake\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ranlib.exe -DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_OSX_SYSROOT= -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ar.exe -DCMAKE_C_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_RC_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/windres.exe -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-g++.exe -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_EXE_LINKER_FLAGS=-m64 -DCMAKE_FIND_ROOT_PATH=C:\Users\buryxu\scoop\apps\msys2\current\mingw64 C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "C:/Users/buryxu/AppData/Local/.xmake/cache/packages/2308/g/glfw/3.3.8/source/build_580b60fd/CMakeFiles/CMakeOutput.log".
error: @programdir\core\sandbox\modules\os.lua:378: execv(cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmake\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ranlib.exe -DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_OSX_SYSROOT= -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ar.exe -DCMAKE_C_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_RC_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/windres.exe -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-g++.exe -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_EXE_LINKER_FLAGS=-m64 -DCMAKE_FIND_ROOT_PATH=C:\Users\buryxu\scoop\apps\msys2\current\mingw64 C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [@programdir\modules\package\tools\cmake.lua:994]: in function 'install'
    [....xmake\repositories\xmake-repo\packages\g\glfw\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:364]:

  => install glfw 3.3.8 .. failed
error: @programdir\modules\private\async\runjobs.lua:256: ...\modules\private\action\require\impl\actions\install.lua:469: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [...\modules\private\action\require\impl\actions\install.lua:469]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:328]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:913: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\modules\private\async\runjobs.lua:256: in field 'catch'
        @programdir\core\sandbox\modules\try.lua:123: in global 'try'
        @programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
waruqi commented 1 year ago

看下有没有装 x86_64-w64-mingw32-windres,装在什么位置

Issues-translate-bot commented 1 year ago

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


Title: Using xmake f -p mingw cannot compile the third-party library, cmake reports an error

Issues-translate-bot commented 1 year ago

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


Check if x86_64-w64-mingw32-windres is installed, and where is it installed

xubury commented 1 year ago

看下有没有装 x86_64-w64-mingw32-windres,装在什么位置

C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\下有windres.exe 但没有x86_64-w64-mingw32-windres.exe,我重命名了一下还是报错

$ xmake f -p mingw -c -vD
checking for architecture ... x86_64
checking for mingw directory ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
git rev-parse HEAD
checking for cmake ... no
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checking for Microsoft C/C++ Compiler (x64) version ... 19.28.29915
checking for cmake ... no
checking for cmake ... no
checking for cmake ... ok
checking for xmake-repo::opengl ... opengl
finding glfw from xmake ..
checking for xmake::glfw ... no
finding glfw from vcpkg ..
finding glfw from conan ..
checking for glfw ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> glfw 3.3.8
please input: y (y/n/m)
y
checking for ping ... ok
pinging for the host(github.com) ... 66 ms
checking for 7z ... C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z
C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z x -y 3.3.8.tar.gz -oC:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_A2241336CED64C008E03EB6455A74980.tar

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 803789 bytes (785 KiB)

Extracting archive: 3.3.8.tar.gz
--
Path = 3.3.8.tar.gz
Type = gzip
Headers Size = 10

Everything is Ok

Size:       4464640
Compressed: 803789
C:\Users\buryxu\scoop\apps\xmake\current\winenv\bin\7z x -y C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_A2241336CED64C008E03EB6455A74980.tar\3.3.8.tar -osource.tmp

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 4464640 bytes (4360 KiB)

Extracting archive: C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_A2241336CED64C008E03EB6455A74980.tar\3.3.8.tar
--
Path = C:\Users\buryxu\AppData\Local\Temp\.xmake\230807\_A2241336CED64C008E03EB6455A74980.tar\3.3.8.tar
Type = tar
Physical Size = 4464640
Headers Size = 93184
Code Page = UTF-8

Everything is Ok

Folders: 15
Files: 158
Size:       4329660
Compressed: 4464640
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the c compiler (cc) ... x86_64-w64-mingw32-gcc
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the assember (as) ... x86_64-w64-mingw32-gcc
checking for C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\ar ... ok
checking for the static library archiver (ar) ... ar
checking for C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\ranlib ... ok
checking for unknown toolkind ranlib (ranlib) ... ranlib
checking for x86_64-w64-mingw32-windres ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-windres
checking for the windows resource compiler (mrc) ... x86_64-w64-mingw32-windres
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the linker (ld) ... x86_64-w64-mingw32-g++
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\current\mingw64\bin\x86_64-w64-mingw32-g++
checking for the shared library linker (sh) ... x86_64-w64-mingw32-g++
checking for cmake ... ok
cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmake\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ar.exe -DCMAKE_EXE_LINKER_FLAGS=-m64 -DCMAKE_OSX_SYSROOT= -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_FLAGS=-m64 -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ranlib.exe -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_RC_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-windres.exe -DCMAKE_FIND_ROOT_PATH=C:\Users\buryxu\scoop\apps\msys2\current\mingw64 -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_C_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "C:/Users/buryxu/AppData/Local/.xmake/cache/packages/2308/g/glfw/3.3.8/source/build_580b60fd/CMakeFiles/CMakeOutput.log".
error: @programdir\core\sandbox\modules\os.lua:378: execv(cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmake\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ar.exe -DCMAKE_EXE_LINKER_FLAGS=-m64 -DCMAKE_OSX_SYSROOT= -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_FLAGS=-m64 -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/ranlib.exe -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_RC_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-windres.exe -DCMAKE_FIND_ROOT_PATH=C:\Users\buryxu\scoop\apps\msys2\current\mingw64 -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_C_COMPILER=C:/Users/buryxu/scoop/apps/msys2/current/mingw64/bin/x86_64-w64-mingw32-gcc.exe C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [@programdir\modules\package\tools\cmake.lua:994]: in function 'install'
    [....xmake\repositories\xmake-repo\packages\g\glfw\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:364]:

  => install glfw 3.3.8 .. failed
error: @programdir\modules\private\async\runjobs.lua:256: ...\modules\private\action\require\impl\actions\install.lua:469: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [...\modules\private\action\require\impl\actions\install.lua:469]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:328]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:913: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\modules\private\async\runjobs.lua:256: in field 'catch'
        @programdir\core\sandbox\modules\try.lua:123: in global 'try'
        @programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
waruqi commented 1 year ago

要 mingw 编译包,走 msys2 里面跑,很多包依赖 make,autoconf pkg-config ,bash , perl 各种工具,原生直接挂 mingw 。。跑不起来的。。你装修 msys2 ,然后用 msys2 里面的 mingw 。。

Issues-translate-bot commented 1 year ago

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


To compile packages with mingw, run in msys2. Many packages rely on make, autoconf pkg-config, bash, perl and other tools, and directly link to mingw natively. . Can't run. . You decorate msys2 , and then use mingw inside msys2 . .

xubury commented 1 year ago

我在msys2里的mingw跑,会找不到cmake,但我已经装了mingw里的cmake包,然后要求安装cmake,最后报错。。

$ xmake f -p mingw
checking for architecture ... x86_64
checking for mingw directory ... C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64
checking for Microsoft Visual Studio (x86_64) version ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> cmake 3.26.4 [from:glfw]
  -> glfw 3.3.8
please input: y (y/n/m)
y
  => install cmake 3.26.4 .. failed

runv(cmake --version) failed(-1073741515)
if you want to get more verbose errors, please see:
  -> C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\c\cmake\3.26.4\installdir.failed\logs\install.txt
error: install failed!
error: @programdir\core\sandbox\modules\os.lua:331: exec(cmake --version) failed(-1073741515)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:897]:
    [@programdir\core\sandbox\modules\os.lua:331]:
    [@programdir\core\sandbox\modules\os.lua:276]: in function 'vrun'
    [...xmake\repositories\xmake-repo\packages\c\cmake\xmake.lua:114]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...dir\modules\private\action\require\impl\actions\test.lua:41]:
    [...\modules\private\action\require\impl\actions\install.lua:347]:

  => install cmake 3.26.4 .. failed
error: @programdir\modules\private\async\runjobs.lua:256: ...\modules\private\action\require\impl\ac
tions\install.lua:410: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:897]:
    [...\modules\private\action\require\impl\actions\install.lua:410]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:268]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:897: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\modules\private\async\runjobs.lua:256: in field 'catch'
        @programdir\core\sandbox\modules\try.lua:123: in global 'try'
        @programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:39
7>
xubury commented 1 year ago

上面这个cmake报错好像是我openssl出问题了,重装一下没事了,但是glfw编译的错误还在

$ xmake f -p mingw -c -vD
checking for architecture ... x86_64
checking for mingw directory ... C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
git rev-parse HEAD
checking for cmake ... no
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\Hos
tX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checking for Microsoft C/C++ Compiler (x64) version ... 19.28.29915
checking for cmake ... no
checking for cmake ... no
checking for cmake ... ok
checking for xmake-repo::opengl ... opengl
finding glfw from xmake ..
checking for xmake::glfw ... no
finding glfw from vcpkg ..
finding glfw from conan ..
checking for glfw ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> glfw 3.3.8
please input: y (y/n/m)
y
checking for ping ... ok
pinging for the host(github.com) ... 66 ms
checkinfo: cannot runv(7z --help), No such file or directory
checking for 7z ... no
checkinfo: cannot runv(7za --help), No such file or directory
checking for 7za ... no
checkinfo: sh: 7z: No such file or directory

checking for sh 7z ... no
gzip -d -f C:\Users\buryxu\scoop\apps\msys2\2022-12-16\tmp\.xmake\230807\_4DF3485A2BC44F5084176D21FE3150B0.tar\3.3.8.tar.g
z
tar -xf C:\Users\buryxu\scoop\apps\msys2\2022-12-16\tmp\.xmake\230807\_4DF3485A2BC44F5084176D21FE3150B0.tar\3.3.8.tar
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the c compiler (cc) ... x86_64-w64-mingw32-gcc
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\x86_64-w64-mingw32-g++
checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++
checking for x86_64-w64-mingw32-gcc ... C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\x86_64-w64-mingw32-gcc
checking for the assember (as) ... x86_64-w64-mingw32-gcc
checking for C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\ar ... ok
checking for the static library archiver (ar) ... ar
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\x86_64-w64-mingw32-g++
checking for the linker (ld) ... x86_64-w64-mingw32-g++
checking for C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\ranlib ... ok
checking for unknown toolkind ranlib (ranlib) ... ranlib
checkinfo: @programdir\core\sandbox\modules\os.lua:269: cannot runv(x86_64-w64-mingw32-windres -i C:\Users\buryxu\scoop\ap
ps\msys2\2022-12-16\tmp\.xmake\230807\_392F67D1B83A46508DA4E366554B1870.rc -o C:\Users\buryxu\scoop\apps\msys2\2022-12-16\
tmp\.xmake\230807\_FA8AEFE12F1A46508C42DC63A5BFFEC0.o), No such file or directory
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [@programdir\core\sandbox\modules\os.lua:269]: in function 'runv'
    [@programdir\modules\detect\tools\find_windres.lua:48]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]:
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:68]: in function '_do_check'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:91]: in function '_check'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:240]: in function '_find'
    [...\core\sandbox\modules\import\lib\detect\find_program.lua:308]:
    [@programdir\modules\lib\detect\find_tool.lua:33]: in function '_find_from_modules'
    [@programdir\modules\lib\detect\find_tool.lua:48]: in function '_find_tool'
    [@programdir\modules\lib\detect\find_tool.lua:100]:
    [@programdir\core\tool\toolchain.lua:452]: in function '_checktool'
    [@programdir\core\tool\toolchain.lua:210]: in function 'tool'
    [@programdir\core\tool\toolchain.lua:722]:
    [@programdir\core\package\package.lua:1041]: in function 'index'
    [@programdir\core\package\package.lua:1019]: in function 'build_getenv'
    [@programdir\modules\package\tools\cmake.lua:445]: in function '_get_configs_for_mingw'
    [@programdir\modules\package\tools\cmake.lua:689]: in function '_get_configs'
    [@programdir\modules\package\tools\cmake.lua:972]: in function 'install'
    [....xmake\repositories\xmake-repo\packages\g\glfw\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:323]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:287]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\private\async\runjobs.lua:218]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:404]:

checking for x86_64-w64-mingw32-windres ... no
checking for the windows resource compiler (mrc: x86_64-w64-mingw32-windres) ... no
checking for C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\windres ... ok
checking for the windows resource compiler (mrc) ... windres
checking for x86_64-w64-mingw32-g++ ... C:\Users\buryxu\scoop\apps\msys2\2022-12-16\mingw64\bin\x86_64-w64-mingw32-g++
checking for the shared library linker (sh) ... x86_64-w64-mingw32-g++
checking for cmake ... ok
cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIB
S=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmake\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -
DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_RC_COMPILER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64
/bin/windres.exe -DCMAKE_LINKER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mingw32-g++.exe -DCMAKE
_FIND_ROOT_PATH=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64 -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_ASM_
FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_C_COMPILER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mi
ngw32-gcc.exe -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/ranlib.exe -DCMAKE_SYSTEM_NAME=Window
s -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/ar.exe -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMA
KE_STATIC_LINKER_FLAGS= -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE_EXE_LINKER_FLAGS=-m64 -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -D
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_OSX_SYSROOT= -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoo
p/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/2022-
12-16/mingw64/bin/x86_64-w64-mingw32-gcc.exe C:\Users\buryxu\AppData\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.
You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
error: @programdir\core\sandbox\modules\os.lua:374: execv(cmake -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_
EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=C:\Users\buryxu\AppData\Local\.xmak
e\packages\g\glfw\3.3.8\580b60fd05d941e2abb98f9baa25683e -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "MSYS Makefiles" -DCMAKE_RC_CO
MPILER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/windres.exe -DCMAKE_LINKER=C:/Users/buryxu/scoop/apps/msys2
/2022-12-16/mingw64/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_FIND_ROOT_PATH=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/ming
w64 -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_C_COMPILER=C:/Users/bu
ryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_RANLIB=C:/Users/buryxu/scoop/apps/msys2/20
22-12-16/mingw64/bin/ranlib.exe -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_AR=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64
/bin/ar.exe -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_SHARED_LINKER_FLAGS=-m64 -DCMAKE
_EXE_LINKER_FLAGS=-m64 -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_OSX_SYSROOT= -DCM
AKE_C_FLAGS=-m64 -DCMAKE_CXX_COMPILER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mingw32-g++.exe -
DCMAKE_ASM_COMPILER=C:/Users/buryxu/scoop/apps/msys2/2022-12-16/mingw64/bin/x86_64-w64-mingw32-gcc.exe C:\Users\buryxu\App
Data\Local\.xmake\cache\packages\2308\g\glfw\3.3.8\source) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [@programdir\core\sandbox\modules\os.lua:374]:
    [@programdir\core\sandbox\modules\os.lua:287]: in function 'vrunv'
    [@programdir\modules\package\tools\cmake.lua:986]: in function 'install'
    [....xmake\repositories\xmake-repo\packages\g\glfw\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:125]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:323]:

  => install glfw 3.3.8 .. failed
error: @programdir\modules\private\async\runjobs.lua:256: ...\modules\private\action\require\impl\actions\install.lua:428:
 install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:913]:
    [...\modules\private\action\require\impl\actions\install.lua:428]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:287]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\private\async\runjobs.lua:232]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:913: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\modules\private\async\runjobs.lua:256: in field 'catch'
        @programdir\core\sandbox\modules\try.lua:123: in global 'try'
        @programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
xubury commented 1 year ago

编译的时候默认使用"MSYS Makefiles",如何切换成"MinGW Makefiles"呢?应该是这里出了问题

Issues-translate-bot commented 1 year ago

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


When compiling, "MSYS Makefiles" is used by default, how to switch to "MinGW Makefiles"? There must be something wrong here

waruqi commented 1 year ago

编译的时候默认使用"MSYS Makefiles",如何切换成"MinGW Makefiles"呢?应该是这里出了问题

跟着应该没关系,你 msys2 下 make 装了么

Issues-translate-bot commented 1 year ago

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


When compiling, "MSYS Makefiles" is used by default, how to switch to "MinGW Makefiles"? There must be something wrong here

It should be okay to follow, have you installed make under msys2?

xubury commented 1 year ago

编译的时候默认使用"MSYS Makefiles",如何切换成"MinGW Makefiles"呢?应该是这里出了问题

跟着应该没关系,你 msys2 下 make 装了么

还真没装。。我以为会用mingw32-make

Issues-translate-bot commented 1 year ago

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


When compiling, "MSYS Makefiles" is used by default, how to switch to "MinGW Makefiles"? There must be something wrong here

It should be okay to follow, have you installed make under msys2

Really did not pretend. . I thought it would use mingw32-make