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

conan更新到2之后,报错提示无效参数 #3633

Closed
heheda123123 opened this issue Apr 15, 2023 · 9 comments
Closed

conan更新到2之后,报错提示无效参数 #3633

heheda123123 opened this issue Apr 15, 2023 · 9 comments
Labels
Milestone

Comments

@heheda123123
Copy link
Contributor

heheda123123 commented Apr 15, 2023

Xmake 版本

2.7.8

操作系统版本和架构

windows 11

描述问题

conan版本 2.0.4

main.cpp

#include <fmt/core.h>

int main() {
  fmt::print("Hello, world!\n");
}

xmake.lua

add_rules("mode.debug", "mode.release")
add_requires("conan::fmt/9.1.0", {alias="fmt"})

target("testwin")
    set_kind("binary")
    add_files("src/*.cpp")
    add_packages("fmt")

编译

(base) PS C:\Users\Administrator\temp\test_cpp\testwin> xmake
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2019
note: install or modify (m) these packages (pass -y to skip confirm)?
in conan:
  -> conan::fmt/9.1.0 latest [vs_runtime:"MT"]
please input: y (y/n/m)
y
  => install conan::fmt/9.1.0 latest .. failed

usage: conan export [-h] [-f FORMAT] [-v [V]] [--name NAME]
                    [--version VERSION] [--user USER] [--channel CHANNEL]
                    [-r REMOTE | -nr] [-l LOCKFILE]
                    [--lockfile-out LOCKFILE_OUT] [--lockfile-partial]
                    [--build-require]
                    path
conan export: error: unrecognized arguments: bincrafters/testing
ERROR: Exiting with code: 2
if you want to get more verbose errors, please see:
  -> C:\Users\Administrator\temp\test_cpp\testwin\build\.packages\c\conan_fmt\9.1.0\latest\cache\installdir.failed\logs\install.txt
error: install failed!

期待的结果

支持conan 2之后的版本。或者对不支持的conan版本进行提示

工程配置

No response

附加信息和错误日志

No response

@heheda123123 heheda123123 changed the title conan更新到2之后,参数失效了 conan更新到2之后,报错提示无效参数 Apr 15, 2023
@heheda123123
Copy link
Contributor Author

不过试了下把conan降级为1.59.0,会报另外的错,设置的编译器参数不对

(base) PS C:\Users\Administrator\temp\test_cpp\testwin> xrepo install conan::fmt/9.1.0
note: install or modify (m) these packages (pass -y to skip confirm)?
in conan:
  -> conan::fmt/9.1.0 latest [vs_runtime:"MT"]
please input: y (y/n/m)
y
  => install conan::fmt/9.1.0 latest .. failed

ERROR: Invalid setting 'MT' is not a valid 'settings.compiler.runtime' value.
Possible values are ['static', 'dynamic']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
if you want to get more verbose errors, please see:
  -> C:\Users\ADMINI~1\AppData\Local\Temp\.xmake\230415\xrepo\working\build\.packages\c\conan_fmt\9.1.0\latest\cache\installdir.failed\logs\install.txt
error: install failed!
error: execv(xmake require -j 8 --extra={system=false} conan::fmt/9.1.0) failed(-1)
(base) PS C:\Users\Administrator\temp\test_cpp\testwin>

@heheda123123
Copy link
Contributor Author

报错是因为他编译器的命名变了

(base) PS C:\Users\Administrator\temp\test_cpp\testwin> xmake -v -D
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
finding mysql-connector-c/6.1.11 from conan ..
checking for conan::mysql-connector-c/6.1.11 ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in conan:
  -> conan::mysql-connector-c/6.1.11 latest [vs_runtime:"MT"]
please input: y (y/n/m)
y
installing mysql-connector-c/6.1.11 from conan ..
checking for conan ... ok
generate C:\Users\Administrator\temp\test_cpp\testwin\build\.conan\mysql-connector-c\6.1.11\conanfile.txt ..
conan install . --build=missing -s os=Windows -s arch=x86_64 -s build_type=Release -s compiler=msvc -s compiler.version=16 -s compiler.runtime=MT
ERROR: The provided compiler.cppstd=14 requires at least msvc>=190 but version 16 provided

@waruqi
Copy link
Member

waruqi commented Apr 15, 2023

新版本 conan 似乎做了很多改动,得重新适配。

@waruqi waruqi added this to the v2.7.9 milestone Apr 15, 2023
@waruqi
Copy link
Member

waruqi commented Apr 15, 2023

报错是因为他编译器的命名变了

(base) PS C:\Users\Administrator\temp\test_cpp\testwin> xmake -v -D
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
finding mysql-connector-c/6.1.11 from conan ..
checking for conan::mysql-connector-c/6.1.11 ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in conan:
  -> conan::mysql-connector-c/6.1.11 latest [vs_runtime:"MT"]
please input: y (y/n/m)
y
installing mysql-connector-c/6.1.11 from conan ..
checking for conan ... ok
generate C:\Users\Administrator\temp\test_cpp\testwin\build\.conan\mysql-connector-c\6.1.11\conanfile.txt ..
conan install . --build=missing -s os=Windows -s arch=x86_64 -s build_type=Release -s compiler=msvc -s compiler.version=16 -s compiler.runtime=MT
ERROR: The provided compiler.cppstd=14 requires at least msvc>=190 but version 16 provided

这是由于之前有人报错才改了编译器名。。#3583

似乎新版本 conan 改成了新的 msvc 名字,编译器版本格式也变了。。

https://github.com/conan-io/conan/blob/353c63b16c31c90d370305b5cbb5dc175cf8a443/conan/tools/microsoft/visual.py#L13

我暂时先回退到之前的编译器命名了,你先试试。并且限制目前仅支持 conan 1.x

xmake update -s dev

@heheda123123
Copy link
Contributor Author

xmake update -s dev 之后, 把conan回退到 1.59.0 就可以了

@waruqi
Copy link
Member

waruqi commented Apr 16, 2023

回头我会对 conan 2.x 做兼容,暂时先用 conan 1.x

@waruqi
Copy link
Member

waruqi commented Apr 18, 2023

由于 conan 2 不再支持 custom generator,所以现有的 1.x 集成方式已经无法继续使用,我已经将此问题反馈给 conan 那边

conan2 的下一个版本 2.0.5 会重新支持全局 custom generator,因此需要等待他们实现并发布下一个版本后,这边才能继续后面的工作

具体 conan 那边进展可以跟进下 conan-io/conan#13709 (comment)

@waruqi
Copy link
Member

waruqi commented Apr 19, 2023

conan那边已经快支持上了,速度好快 conan-io/conan#13718

@waruqi
Copy link
Member

waruqi commented May 2, 2023

我初步支持了,但需要 conan 2.0.5 。。如果要提前体验,可以安装 conan 最新 commit 版本。。

$ git clone https://github.com/conan-io/conan.git
$ cd conan
$ sudo pip install -e .

然后更新 xmake

$ xmake update -s dev

#3703

@waruqi waruqi closed this as completed May 4, 2023
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

2 participants