xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
684 stars 398 forks source link

Xmake install boost failed #1297

Closed fonqL closed 2 years ago

fonqL commented 2 years ago

Xmake 版本

2.6.7

操作系统版本和架构

Win10 21H2

描述问题

下载后xmake传给bootstrap.bat和b2.exe的参数很奇怪 而且也安装失败 下载前确实指定了mingw工具链

PS E:\CLionProjects\untitled> xmake -vDw
checking for mingw directory ... D:\MinGW
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... D:\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
git rev-parse HEAD
finding boost from xmake ..
checking for xmake::boost ... no
finding boost from vcpkg ..
checkinfo: vcpkg root directory not found, maybe you need set $VCPKG_ROOT!
finding boost from conan ..
finding boost from pkgconfig ..
checkinfo: cannot runv(pkg-config.exe --version), No such file or directory
checking for pkg-config ... no
checkinfo: cannot runv(pkgconf.exe --version), No such file or directory
checking for pkgconf ... no
finding boost from system ..
checking for boost ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> boost 1.78.0 [vs_runtime:"MT", toolchains:"mingw"]
please input: y (y/n/m)

但是调用bootstrap和b2时没有指定gcc参数?:

checking for x86_64-w64-mingw32-g++ ... D:\MinGW\bin\x86_64-w64-mingw32-g++
checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++
bootstrap.bat --prefix=E:\cpppkg\b\boost\1.78.0\e3a00ed03b2c4624aae48b2f481b4acf --libdir=E:\cpppkg\b\boost\1.78.0\e3a00ed03b2c4624aae48b2f481b4acf\lib --without-icu
Building Boost.Build engine
LOCALAPPDATA=C:\Users\fofo\AppData\Local
Found with vswhere D:\Microsoft Visual Studio\2022\Community
Found with vswhere D:\Microsoft Visual Studio\2022\Community
Call_If_Exists "D:\Microsoft Visual Studio\2022\Community\Common7\Tools\..\..\VC\Auxiliary\Build\vcvarsall.bat"  AMD64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.2.0
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
###
### Using 'vc143' toolset.
###

而且调用b2时甚至地址位数和架构都搞错了?

E:\xpkg_cache\packages\2206\b\boost\1.78.0\source\tools\build\src\engine>copy /b .\b2.exe .\bjam.exe
        1 file(s) copied.

Generating Boost.Build configuration in project-config.jam for msvc...

Bootstrapping is done. To build, run:

    .\b2

To adjust configuration, edit 'project-config.jam'.
Further information:

    - Command line help:
    .\b2 --help

    - Getting started guide:
    http://boost.org/more/getting_started/windows.html

    - Boost.Build documentation:
    http://www.boost.org/build/

./b2 headers
Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : x86 [1]

[1] msvc-14.3
...found 2 targets...
./b2 --prefix=E:\cpppkg\b\boost\1.78.0\e3a00ed03b2c4624aae48b2f481b4acf --libdir=E:\cpppkg\b\boost\1.78.0\e3a00ed03b2c4624aae48b2f481b4acf\lib -d2 -j4 --hash --layout=tagged-1.66 --user-config=user-config.jam -sNO_LZMA=1 -sNO_ZSTD=1 install threading=multi debug-symbols=off link=static address-model=64 runtime-link=static cxxflags=-std:c++14 --with-filesystem
Performing configuration checks

    - default address-model    : 32-bit [1]
    - default architecture     : arm [1]

我不理解 也试过xrepo install -p windows -a x64 --toolchain=mingw boost,结果和上面一样

之后去xmake 下载缓存目录里手动安装成功: .\bootstrap.bat gcc .\b2 install --prefix=xxxx成功,在b2执行时参数正确,为64bit x86 且工具链是gcc11

这是bug吗?或者我该怎么用xmake指定构建boost的参数?

期待的结果

成功安装boost

工程配置

add_rules("mode.debug", "mode.release") set_toolchains("mingw") add_requires("boost") target("untitled") set_kind("binary") add_files("src/*.cpp") add_packages("boost")

附加信息和错误日志

out.txt

因为之后报错太多在vscode里弹出太多cpp文件于是ctrl+C了,所以不是整个的安装过程,如果需要的话明天我再跑一遍完整的过程

waruqi commented 2 years ago

目前 boost 包仅支持 windows/msvc 工具链。。不要去走 --toolchain= 随意切到其他工具链,如果要支持 mingw 。。请到 xmake-repo 仓库提 pr 改进下 boost 包,放开 on_install 平台限制,增加 mingw 平台,然后针对性修复处理 mingw 相关编译问题。

https://github.com/xmake-io/xmake-repo/blob/7532c7e48d432072ed50a43ec6816bbebd06aaa0/packages/b/boost/xmake.lua#L120

fonqL commented 2 years ago

请问哪里可以查阅支持的工具链呢?只能在包的xmake.lua源代码里看吗?

waruqi commented 2 years ago

readme

fonqL commented 2 years ago

抱歉没找到单个包的readme,只找到整个项目的readme,文档我也找过了也没找到哪里查看支持的工具链,还是说其实windows上所有包都不支持用mingw构建

waruqi commented 2 years ago

xmake 的 toolchain 当然到 xmake 的 readme 找,包里怎么可能找到

或者 xmake show -l toolchains

waruqi commented 2 years ago

,还是说其实windows上所有包都不支持用mingw构建

分 windows 和 mingw 两个平台,具体哪些包支持 mingw,可以从仓库 on_install 里找平台,或者到 xrepo.xmake.io 查看

waruqi commented 2 years ago

mingw 我加上了,更新仓库再试下 https://github.com/xmake-io/xmake-repo/pull/1299

xrepo update-repo
xrepo install -p mingw boost
fonqL commented 2 years ago

感谢,现在安装十分顺利