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

xmake conan package build doesn't support customize build profile via -s:b #5568

Closed
shaqtsui opened this issue Sep 4, 2024 · 4 comments
Closed
Labels
Milestone

Comments

@shaqtsui
Copy link
Contributor

shaqtsui commented Sep 4, 2024

Xmake Version

2.9.4

Operating System Version and Architecture

windows10

Describe Bug

conan package settings only apply to host profile (-s or -s:h) but not build profile(-s:b)which lead to below error:

conan install . -g XmakeGenerator --profile:build=profile_build.txt --profile:host=profile_host.txt --build=missing -s compiler.cppstd=20

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows

Profile build:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows

...


ninja/1.10.2: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
ninja/1.11.1: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
zlib/1.3.1: Checking 1 compatible configurations
zlib/1.3.1: Main binary package '8b7e35f91e516e42ed736c6dd52a9263da3a5dad' missing. Using compatible package 'ed44dacde2751b398e4bf9441ff992a70c913c00': compiler.version=193
gn/cci.20210429: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
crashpad/cci.20220219: Compatible package ID 7648639888dcad8fa74c6d432ef22fd20bddca0c equal to the default package ID: Skipping it.
crashpad/cci.20220219: Checking 7 compatible configurations
crashpad/cci.20220219: Compatible configurations not found in cache, checking servers
crashpad/cci.20220219: '49b79dfbec0a45c7b86904568a2fd1118d98379c': compiler.cppstd=14
crashpad/cci.20220219: 'd2363b4f403b685dc11c5e29de8995103d89d9bf': compiler.cppstd=17
crashpad/cci.20220219: 'de3bd5e4e1625b5ec3f5b63ebaf95320a50809a1': compiler.cppstd=23
crashpad/cci.20220219: '4026f5404b08163a7fd541416bd802f1705859f4': compiler.cppstd=14, compiler.version=193
crashpad/cci.20220219: 'c0be63d8c0a358668eb84ad82adf42e655b4e6d2': compiler.cppstd=17, compiler.version=193
crashpad/cci.20220219: '1f57f8b023658dc0aea134fbedd0f818daae1fea': compiler.version=193
crashpad/cci.20220219: 'db6e484fc955c5f82ab7fd460948f0e2a7053774': compiler.cppstd=23, compiler.version=193
Requirements
    crashpad/cci.20220219#952df026f66cca2dfe6eca4d6daf4c20:7648639888dcad8fa74c6d432ef22fd20bddca0c - Build
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:ed44dacde2751b398e4bf9441ff992a70c913c00#dcc3f88f58ee38792cc62a872cf77763 - Cache
Build requirements
    gn/cci.20210429#066e7db8b18cfad93df06371eeb10e7b:e87e09fb175a1b4a35981cd53c3cf142cb86410f - Invalid
    ninja/1.10.2#e57e57c06536f91f14a0aac59baa8b0b:e87e09fb175a1b4a35981cd53c3cf142cb86410f - Build
    ninja/1.11.1
ERROR: There are invalid packages:
gn/cci.20210429: Cannot build for this configuration: Current cppstd (14) is lower than the required C++ standard (17).

Expected Behavior

customize conan build profile

Project Configuration

add_requires("conan::crashpad/cci.20220219", { alias = "crashpad", debug = is_mode("debug") , configs = { settings = "compiler.cppstd=20"}})

target "crashpad_ex"
add_defines("NOMINMAX")
add_packages("crashpad")
if is_plat("windows") then
	 add_links("AdvAPI32")
end
add_files "src/*.cxx"

Additional Information and Error Logs

PS D:\Projects\crashpad_ex> xmake f -m debug
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.41.34120
updating repositories .. ok
note: install or modify (m) these packages (pass -y to skip confirm)?
in conan:
  -> conan::crashpad/cci.20220219 latest [toolchains:"llvm", debug:y, runtimes:"MDd", settings:"compiler.cppstd=20"]
please input: y (y/n/m)

  => install conan::crashpad/cci.20220219 latest .. failed

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
if you want to get more verbose errors, please see:
  -> D:\Projects\crashpad_ex\build\.packages\c\conan_crashpad\cci.20220219\latest\cache\installdir.failed\logs\install.txt
error: install failed!
PS D:\Projects\crashpad_ex> xmake f -vyD -m debug
checking for platform ... windows
checking for architecture ... x64
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.41.34120
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
checkinfo: cannot runv(nim.exe --version), No such file or directory
checking for nim ... no
checkinfo: cannot runv(nim.exe --version), No such file or directory
checking for nim ... no
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Program Files\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
finding crashpad/cci.20220219 from conan ..
checking for conan::crashpad/cci.20220219 ... no
installing crashpad/cci.20220219 from conan ..
checking for conan ... ok
conan config install "C:\\Program Files\\xmake\\scripts\\conan"
Copying file xmake_generator.py to C:\Users\shaq\.conan2\extensions\generators
generate D:\Projects\crashpad_ex\build\.conan\crashpad\cci.20220219\conanfile.txt ..
conan install . -g XmakeGenerator --profile:build=profile_build.txt --profile:host=profile_host.txt --build=missing -s compiler.cppstd=20

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows

Profile build:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows


======== Computing dependency graph ========
Graph root
    conanfile.txt: D:\Projects\crashpad_ex\build\.conan\crashpad\cci.20220219\conanfile.txt
Requirements
    crashpad/cci.20220219#952df026f66cca2dfe6eca4d6daf4c20 - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache
Build requirements
    gn/cci.20210429#066e7db8b18cfad93df06371eeb10e7b - Cache
    ninja/1.10.2#e57e57c06536f91f14a0aac59baa8b0b - Cache
    ninja/1.11.1#184939c044ea197cc4d0c37714f0f13b - Cache
Resolved version ranges
    zlib/[>=1.2.12 <2]: zlib/1.3.1

======== Computing necessary packages ========
ninja/1.10.2: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
ninja/1.11.1: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
zlib/1.3.1: Checking 1 compatible configurations
zlib/1.3.1: Main binary package '8b7e35f91e516e42ed736c6dd52a9263da3a5dad' missing. Using compatible package 'ed44dacde2751b398e4bf9441ff992a70c913c00': compiler.version=193
gn/cci.20210429: Compatible package ID e87e09fb175a1b4a35981cd53c3cf142cb86410f equal to the default package ID: Skipping it.
crashpad/cci.20220219: Compatible package ID 7648639888dcad8fa74c6d432ef22fd20bddca0c equal to the default package ID: Skipping it.
crashpad/cci.20220219: Checking 7 compatible configurations
crashpad/cci.20220219: Compatible configurations not found in cache, checking servers
crashpad/cci.20220219: '49b79dfbec0a45c7b86904568a2fd1118d98379c': compiler.cppstd=14
crashpad/cci.20220219: 'd2363b4f403b685dc11c5e29de8995103d89d9bf': compiler.cppstd=17
crashpad/cci.20220219: 'de3bd5e4e1625b5ec3f5b63ebaf95320a50809a1': compiler.cppstd=23
crashpad/cci.20220219: '4026f5404b08163a7fd541416bd802f1705859f4': compiler.cppstd=14, compiler.version=193
crashpad/cci.20220219: 'c0be63d8c0a358668eb84ad82adf42e655b4e6d2': compiler.cppstd=17, compiler.version=193
crashpad/cci.20220219: '1f57f8b023658dc0aea134fbedd0f818daae1fea': compiler.version=193
crashpad/cci.20220219: 'db6e484fc955c5f82ab7fd460948f0e2a7053774': compiler.cppstd=23, compiler.version=193
Requirements
    crashpad/cci.20220219#952df026f66cca2dfe6eca4d6daf4c20:7648639888dcad8fa74c6d432ef22fd20bddca0c - Build
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:ed44dacde2751b398e4bf9441ff992a70c913c00#dcc3f88f58ee38792cc62a872cf77763 - Cache
Build requirements
    gn/cci.20210429#066e7db8b18cfad93df06371eeb10e7b:e87e09fb175a1b4a35981cd53c3cf142cb86410f - Invalid
    ninja/1.10.2#e57e57c06536f91f14a0aac59baa8b0b:e87e09fb175a1b4a35981cd53c3cf142cb86410f - Build
    ninja/1.11.1
ERROR: There are invalid packages:
gn/cci.20210429: Cannot build for this configuration: Current cppstd (14) is lower than the required C++ standard (17).
error: @programdir\core\sandbox\modules\os.lua:378: execv(conan install . -g XmakeGenerator --profile:build=profile_build.txt --profile:host=profile_host.txt --build=missing -s compiler.cppstd=20) failed(6)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [...dir\modules\package\manager\conan\v2\install_package.lua:337]:
    [...ramdir\modules\package\manager\conan\install_package.lua:41]:
    [@programdir\modules\package\manager\install_package.lua:111]:
    [@programdir\core\package\package.lua:2844]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:379]:

  => install conan::crashpad/cci.20220219 latest .. failed

@programdir\core\sandbox\modules\os.lua:378: execv(conan install . -g XmakeGenerator --profile:build=profile_build.txt --profile:host=profile_host.txt --build=missing -s compiler.cppstd=20) failed(6)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [...dir\modules\package\manager\conan\v2\install_package.lua:337]:
    [...ramdir\modules\package\manager\conan\install_package.lua:41]:
    [@programdir\modules\package\manager\install_package.lua:111]:
    [@programdir\core\package\package.lua:2844]: in function 'script'
    [...\modules\private\action\require\impl\actions\install.lua:379]:
if you want to get more verbose errors, please see:
  -> D:\Projects\crashpad_ex\build\.packages\c\conan_crashpad\cci.20220219\latest\cache\installdir.failed\logs\install.txt
error: @programdir\core\main.lua:329: @programdir\modules\async\runjobs.lua:325: ...\modules\private\action\require\impl\actions\install.lua:506: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [...\modules\private\action\require\impl\actions\install.lua:506]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:370]:
    [...modules\private\action\require\impl\install_packages.lua:491]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:973: in function 'base/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>
@shaqtsui shaqtsui added the bug label Sep 4, 2024
@waruqi
Copy link
Member

waruqi commented Sep 4, 2024

按理应该设置了,你可以调下这里

local version = _conan_get_compiler_version("cl", {envs = msvc:runenvs()})

--profile:build=profile_build.txt
Profile build:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows

@shaqtsui
Copy link
Contributor Author

shaqtsui commented Sep 4, 2024

profile:print("compiler.cppstd=14")

这个地方 hard code 了

for _, setting in ipairs(configs.settings) do

这个地方只让配置 host profile (-s) 不支持 buid profile (-s:b)

所以无法改动 build profile

@Issues-translate-bot
Copy link

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


profile:print("compiler.cppstd=14")

This place is hard coded

for _, setting in ipairs(configs.settings) do

This place only allows configuration of host profile (-s) and does not support buid profile (-s:b)

So the build profile cannot be changed

@waruqi
Copy link
Member

waruqi commented Sep 4, 2024

试下这个 patch ,再设置下 settings_build

#5569

@waruqi waruqi added this to the v2.9.5 milestone Sep 4, 2024
@waruqi waruqi closed this as completed Sep 5, 2024
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

3 participants