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

Implement a way to switch stl library for clang (and maybe gcc) #4477

Closed
Arthapz opened this issue Dec 7, 2023 · 29 comments · Fixed by #4660
Closed

Implement a way to switch stl library for clang (and maybe gcc) #4477

Arthapz opened this issue Dec 7, 2023 · 29 comments · Fixed by #4660

Comments

@Arthapz
Copy link
Member

Arthapz commented Dec 7, 2023

Is your feature request related to a problem? Please describe.

Currently to switch stl library for clang we need to hardcode some clang flags for targets and packages, it can cause some problems when a clang package is built with libstdc++ and the project target built with libc++

Describe the solution you'd like

i personnaly think it's better to add a global flag --cxxstl (which will be no-op on msvc, change stl library on clang and maybe gcc)
and it would be used to discriminate package (so for example we could install fmt library with libstdc++ AND libc++)

Describe alternatives you've considered

A toolchain or a policy

Additional context

the discussion of this feature begin here:
#4474

and here a first attempt to implement it with a policy
#4463

@waruqi
Copy link
Member

waruqi commented Dec 7, 2023

I think it's possible to configure it using a more generic abstract API like set_cxxstl("libc++"), but it shouldn't add compiler prefix, set_cxxstl("clang::libc++"). This is because stl libraries are not fully compiler-bound, e.g. stl in ndk does not distinguish between gcc/clang.

for example:

disable stl

set_cxxstl("none")

or

$ xmake f --cxxstl=none

it will not add any stl library.

gcc/clang

set_cxxstl("libc++")
set_cxxstl("libstdc++")

we need implement it in core.tools.gcc/clang

NDK

set_cxxstl("c++_static")
set_cxxstl("c++_shared")
set_cxxstl("gnustl_static")
set_cxxstl("gnustl_shared")
set_cxxstl("stlport_shared")
set_cxxstl("stlport_static")   

If we want to set it according to the compiler, we can do so:

target("test")
    on_config(function (target)
        if not target:is_plat("android") and target:has_tool("ld", "clang", "clangxx") then
            target:set("cxxstl", "libc++")  
        end
    end)

And we can use xmake f --cxxstl=libc++ now. And we can also set it for android ndk. xmake f -p android --cxxstl=c++_static. and we can also continune to use --ndk_cxxstl=. (In the future it may be marked as deprecated.)

package

add a bultin config cxxstl for package. and we can get it via package:config("cxxstl")

And we need pass --cxxstl to package.tools.* in on_install().

@Arthapz
Copy link
Member Author

Arthapz commented Dec 7, 2023

I like it, but maybe to keep consistency for android ndk we could do

-- libc++ shared 
-- clang: -stdlib=libc++
-- gcc: -nostdinc++ -nostdlib++ -I<libc++root>/include/c++/v1 -L<libc++root>/lib -lc++ -lc++abi
-- android: flags for c++_shared
set_cxxstl("libc++")

-- libc++ static
-- clang: -stdlib=libstdc++ -static-libstdc++
-- gcc: -nostdinc++ -nostdlib++ -I<libc++root>/include/c++/v1 -L<libc++root>/lib -static -lc++ -lc++abi
-- android: flags for c++_static
set_cxxstl("libc++_static")

-- libstdc++ shared
-- clang: -stdlib=libstdc++
-- gcc:
-- android: flags for gnustl_shared
set_cxxstl("libstdc++")

-- libstdc++ static
-- clang: -stdlib=libstdc++ -static-libstdc++
-- gcc: -static-libstdc++
-- android: flags for gnustl_static
set_cxxstl("libstdc++_static")

-- no stl
-- clang: -nostdlib++
-- gcc: -nostdinc++ -nostdlib++
-- msvc: /X
set_cxxstl("none")

-- android only
-- android: flags for stlport_shared
set_cxxstl("stlport")

-- android: flags for stlport_static
set_cxxstl("stlport_static")

for both regular platform / android

(and continue to support c++_* / gnustl_* but as deprecated values)

@SirLynix
Copy link
Member

SirLynix commented Dec 7, 2023

Thinking about it, it's not very different from the Visual Studio runtime, I wonder if those configs could be merged with set_runtimes, or set_runtimes deprecated for set_cxxstl

@Arthapz
Copy link
Member Author

Arthapz commented Dec 7, 2023

Thinking about it, it's not very different from the Visual Studio runtime, I wonder if those configs could be merged with set_runtimes, or set_runtimes deprecated for set_cxxstl

yeah and it could be use to switch all kind of runtimes, like libc

set_runtimes("muslc", "libc++")

@waruqi
Copy link
Member

waruqi commented Dec 7, 2023

Thinking about it, it's not very different from the Visual Studio runtime, I wonder if those configs could be merged with set_runtimes, or set_runtimes deprecated for set_cxxstl

yeah and it could be use to switch all kind of runtimes, like libc

set_runtimes("muslc", "libc++")

sure, you can try.

@shaqtsui
Copy link
Contributor

Can mege vs_runtime to this feature?
As I know the vs_runtime is almost about c std library.

@Arthapz
Copy link
Member Author

Arthapz commented Dec 22, 2023

Can mege vs_runtime to this feature?

As I know the vs_runtime is almost about c std library.

That's the idea, i'm working on it, but as it is the end of the year, i don't have a lot of time to implementing it (and i'm working on a module PR too)

@waruqi
Copy link
Member

waruqi commented Jan 24, 2024

I have supported it. #4630

Supported runtimes

  • msvc: MT, MD, MTd, MDd
  • gcc: stdc++_static, stdc++_shared
  • clang: c++_static, c++_shared, stdc++_static, stdc++_shared
  • ndk: c++_static, c++_shared, stdc++_static, stdc++_shared, stlport_static, stlport_shared, gnustl_static, gnustl_shared

New options and configs

  • xmake f --runtimes=
    • xmake f --runtimes=MTd
    • xmake f --runtimes=MT,c++_static
  • add_configs("runtimes") in package
  • package:runtimes(), package:has_runtime(), target:runtimes(), target:has_runtime()
    • For msvc: runtimes() -> MT, MD, MTd, MDd (only one, always return string)
    • For gcc: runtimes() -> stdc++_static, stdc++_shared
    • For clang: runtimes() -> c++_static, c++_shared, stdc++_static, stdc++_shared (maybe return table)
  • add_runtimes()
    • add_runtimes("MTd", "c++_static")
  • add_requires()
    • add_requires("xxx", {configs = {runtimes = "MT,c++_static"}})

Fully compatible with vs_runtime, but we added some deprecated warning tips

  • xmake f --vs_runtime/--ndk_cxxstl
  • add_configs("vs_runtime")
  • package:config("vs_runtime")
xmake update -s github:xmake-io/xmake#runtimes

@waruqi
Copy link
Member

waruqi commented Jan 26, 2024

I have merged it.

@waruqi waruqi closed this as completed Jan 26, 2024
@waruqi waruqi added this to the v2.8.7 milestone Jan 26, 2024
@SirLynix
Copy link
Member

SirLynix commented Jan 26, 2024

My CI just broke on the dev branch: https://github.com/NazaraEngine/NazaraEngine/actions/runs/7670670489/job/20907370128

which is a bit weird, it looks like a version issue

@Arthapz
Copy link
Member Author

Arthapz commented Jan 26, 2024

on Windows, set_runtimes for clang seems to have no effects

>>>> xmake f --toolchain=clang --runtimes=c++_shared
checking for platform ... windows
checking for architecture ... x64

>>>> xmake b -vD
checking for clang ... ✔
checking for the c++ compiler (cxx) ... clang
checking for flags (-fvisibility-inlines-hidden) ... ✔
> clang "-fvisibility-inlines-hidden" "-Qunused-arguments" "-m64"
checking for flags (-O3) ... ✔
> clang "-O3" "-Qunused-arguments" "-m64"
checking for flags (clang_ms_runtime_lib) ... ✔
> clang "-fms-runtime-lib=dll" "-Qunused-arguments" "-m64"
checking for flags (-DNDEBUG) ... ✔
> clang "-DNDEBUG" "-Qunused-arguments" "-m64"
[ 25%]: cache compiling.release src\main.cpp
clang -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -o build\.objs\test\windows\x64\release\src\main.cpp.obj src\main.cpp
checking for flags (-MMD -MF) ... ✔
> clang "-MMD" "-MF" "C:\Users\arthu\AppData\Local\Temp\.xmake\240126\_170EF090CE9643308EB0628110CD1430" "-Qunused-arguments" "-m64"
checking for flags (-fdiagnostics-color=always) ... ✔
> clang "-fdiagnostics-color=always" "-Qunused-arguments" "-m64"
checking for clang++ ... ✔
checking for flags (clang_ms_runtime_lib) ... ✔
> clang++ "-fms-runtime-lib=dll" "-Qunused-arguments"
[ 50%]: linking.release test.exe
clang++ -o build\windows\x64\release\test.exe build\.objs\test\windows\x64\release\src\main.cpp.obj -m64
checking for clang ... ✔
checking for the c compiler (cc) ... clang

build cache stats:
cache directory: build\.build_cache
cache hit rate: 0%
cache hit: 0
cache hit total time: 0.000s
cache miss: 1
cache miss total time: 0.000s
new cached files: 1
remote cache hit: 0
remote new cached files: 0
preprocess failed: 0
compile fallback count: 0
compile total time: 0.625s

[100%]: build ok, spent 1.609s

@SirLynix
Copy link
Member

My CI just broke on the dev branch: https://github.com/NazaraEngine/NazaraEngine/actions/runs/7670670489/job/20907370128

which is a bit weird, it looks like a version issue

It seems to have something with the hash changes, I can reproduce it locally

error: package(qt5gui/5.15.2:{"debug=true","runtimes=MD"}): conflict dependences with package(qt5gui/latest:{"debug=true","runtimes=MD"}) in nodeeditor!

the weird thing is that it happens only on Windows

@waruqi
Copy link
Member

waruqi commented Jan 27, 2024

_check_package_depconflicts
  - qt5core nodeeditor.qt5core
  - qt5gui nodeeditor.qt5gui
  - qt5widgets nodeeditor.qt5widgets
  - qt5gui nodeeditor.qt5widgets.qt5gui
error: package(qt5gui/5.15.2:{"debug=true","runtimes=MD"}): conflict dependences with package(qt5gui/latest:{"debug=true","runtimes=MD"}) in nodeeditor!

nodeeditor.qt5gui -> latest
nodeeditor.qt5widgets.qt5gui -> 5.15.2

https://github.com/xmake-io/xmake-repo/blob/6a92031e492b182be8cf4ab04f87ab257f2d68ef/packages/q/qt5widgets/xmake.lua#L6

version = package:version_str()

package:version_str() has been resolved as 5.15.2

@SirLynix
Copy link
Member

Yes but why does it happen only now? and why only on Windows? And why does qt5gui takes "latest" version?

@waruqi
Copy link
Member

waruqi commented Jan 27, 2024

requireinfo.configs.runtimes = #runtimes_current > 0 and table.concat(runtimes_current, ",") or nil

here, it will affect package cache key.

local package_cached = _memcache():get2("packages", packagekey)

waruqi added a commit that referenced this issue Jan 27, 2024
@waruqi
Copy link
Member

waruqi commented Jan 27, 2024

try it again.

@Arthapz
Copy link
Member Author

Arthapz commented Jan 27, 2024

some packages seems broken

> xrepo install -vD --configs='runtimes="c++_shared"' libjpeg-turbo  
error: ...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51: attempt to index a nil value
stack traceback:
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
⚠ warning: please use package:runtimes() or package:has_runtime() instead of package:config("vs_runtime")
❗ error: @programdir\core\main.lua:306: @programdir\core\sandbox\modules\os.lua:378: execv(C:\Users\arthu\xmake\xmake.exe require -v -D -j 26 --extra={system=false,configs={runtimes=\"c++_shared\"}} libjpeg-turbo)
 failed(-1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\modules\private\xrepo\action\install.lua:300]: in function '_install_packages'
    [@programdir\modules\private\xrepo\action\install.lua:307]:
    [@programdir\modules\private\xrepo\main.lua:196]:
    [@programdir\plugins\lua\main.lua:124]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]:
    [@programdir\core\base\task.lua:501]: in function 'run'
    [@programdir\core\main.lua:304]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

https://github.com/xmake-io/xmake-repo/blob/6a92031e492b182be8cf4ab04f87ab257f2d68ef/packages/l/libjpeg-turbo/xmake.lua#L51

@SirLynix
Copy link
Member

try it again.

It's working now, thanks!

@waruqi
Copy link
Member

waruqi commented Jan 28, 2024

some packages seems broken

> xrepo install -vD --configs='runtimes="c++_shared"' libjpeg-turbo  
error: ...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51: attempt to index a nil value
stack traceback:
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
⚠ warning: please use package:runtimes() or package:has_runtime() instead of package:config("vs_runtime")
❗ error: @programdir\core\main.lua:306: @programdir\core\sandbox\modules\os.lua:378: execv(C:\Users\arthu\xmake\xmake.exe require -v -D -j 26 --extra={system=false,configs={runtimes=\"c++_shared\"}} libjpeg-turbo)
 failed(-1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\modules\private\xrepo\action\install.lua:300]: in function '_install_packages'
    [@programdir\modules\private\xrepo\action\install.lua:307]:
    [@programdir\modules\private\xrepo\main.lua:196]:
    [@programdir\plugins\lua\main.lua:124]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]:
    [@programdir\core\base\task.lua:501]: in function 'run'
    [@programdir\core\main.lua:304]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

https://github.com/xmake-io/xmake-repo/blob/6a92031e492b182be8cf4ab04f87ab257f2d68ef/packages/l/libjpeg-turbo/xmake.lua#L51

try it again .4d8b4ad

@SirLynix
Copy link
Member

By the way, wouldn't this change be a great time to change the default runtime from MT to MD on Windows?

MD is the default runtime set by Visual Studio and is the less prone to having issues with DLL

@waruqi
Copy link
Member

waruqi commented Jan 28, 2024

By the way, wouldn't this change be a great time to change the default runtime from MT to MD on Windows?

MD is the default runtime set by Visual Studio and is the less prone to having issues with DLL

But it will break more things, especially buildhash

@waruqi
Copy link
Member

waruqi commented Jan 28, 2024

If we don't set any vs runtime flags, cl.exe uses MT by default, and if we switch to MD. xmake must set MD built-in by default, even if the user doesn't configure any flags for the target. this is going to break a lot of current projects, not just packages.

Also, if the user sets vs runtimes, xmake will need to determine which of the built-in MT runtimes to remove, which also adds complexity to the implementation and leads to more problems.

@Arthapz
Copy link
Member Author

Arthapz commented Jan 28, 2024

some packages seems broken

> xrepo install -vD --configs='runtimes="c++_shared"' libjpeg-turbo  
error: ...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51: attempt to index a nil value
stack traceback:
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
⚠ warning: please use package:runtimes() or package:has_runtime() instead of package:config("vs_runtime")
❗ error: @programdir\core\main.lua:306: @programdir\core\sandbox\modules\os.lua:378: execv(C:\Users\arthu\xmake\xmake.exe require -v -D -j 26 --extra={system=false,configs={runtimes=\"c++_shared\"}} libjpeg-turbo)
 failed(-1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\modules\private\xrepo\action\install.lua:300]: in function '_install_packages'
    [@programdir\modules\private\xrepo\action\install.lua:307]:
    [@programdir\modules\private\xrepo\main.lua:196]:
    [@programdir\plugins\lua\main.lua:124]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:280]:
    [@programdir\core\base\task.lua:501]: in function 'run'
    [@programdir\core\main.lua:304]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

https://github.com/xmake-io/xmake-repo/blob/6a92031e492b182be8cf4ab04f87ab257f2d68ef/packages/l/libjpeg-turbo/xmake.lua#L51

try it again .4d8b4ad

the error changed, but still failing

>xrepo install --yes -vD --toolchain=clang --configs='runtimes="c++_shared"' libjpeg-turbo  
error: @programdir\modules\package\tools\cmake.lua:369: attempt to concatenate a table value (local 'runtimes')
stack traceback:
    [@programdir\modules\package\tools\cmake.lua:369]: in function '_get_configs_for_windows'
    [@programdir\modules\package\tools\cmake.lua:709]: in function '_get_configs'
    [@programdir\modules\package\tools\cmake.lua:1015]: in function 'install'
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:61]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
⚠ warning: please use package:runtimes() or package:has_runtime() instead of package:config("vs_runtime")
❗ error: .\xmake\core\main.lua:306: .\xmake\core\sandbox\modules\os.lua:378: execv(C:\Users\arthu\xmake\xmake.exe require -y -v -D -j 26 --extra={system=false,configs={runtimes=\"c++_shared\"}} libjpeg-turbo) fail
ed(-1)
stack traceback:
    [C]: in function 'error'
    [.\xmake\core\base\os.lua:957]:
    [.\xmake\core\sandbox\modules\os.lua:378]:
    [.\xmake\modules\private\xrepo\action\install.lua:300]: in function '_install_packages'
    [.\xmake\modules\private\xrepo\action\install.lua:307]:
    [.\xmake\modules\private\xrepo\main.lua:196]:
    [.\xmake\plugins\lua\main.lua:124]:
    [C]: in function 'xpcall'
    [.\xmake\core\base\utils.lua:280]:
    [.\xmake\core\base\task.lua:501]: in function 'run'
    [.\xmake\core\main.lua:304]: in function 'cotask'
    [.\xmake\core\base\scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        .\xmake\core\base\os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        .\xmake\core\main.lua:306: in upvalue 'cotask'
        .\xmake\core\base\scheduler.lua:404: in function <.\xmake\core\base\scheduler.lua:397>

waruqi added a commit that referenced this issue Jan 28, 2024
@waruqi
Copy link
Member

waruqi commented Jan 28, 2024

try it again.

@Arthapz
Copy link
Member Author

Arthapz commented Jan 28, 2024

try it again.

error: ...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51: attempt to index a nil value
stack traceback:
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

@waruqi
Copy link
Member

waruqi commented Jan 29, 2024

try it again.

error: ...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51: attempt to index a nil value
stack traceback:
    [...positories\xmake-repo\packages\l\libjpeg-turbo\xmake.lua:51]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:369]:

  => install libjpeg-turbo 3.0.1 .. ❌
❗ error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

it works for me. https://github.com/xmake-io/xmake-repo/actions/runs/7689614933

and on my win machine.

@Arthapz
Copy link
Member Author

Arthapz commented Jan 29, 2024

machine.

Try with --toolchain=clang --runtimes=c++_shared on Windows

@waruqi
Copy link
Member

waruqi commented Jan 29, 2024

machine.

Try with --toolchain=clang --runtimes=c++_shared on Windows

Windows packages are always strongly bound to msvc, and xmake has never supported switching to another toolchain.

I have fixed this error, but even though I fixed this bug, the actual msvc is still used.

@Arthapz
Copy link
Member Author

Arthapz commented Jan 29, 2024

machine.

Try with --toolchain=clang --runtimes=c++_shared on Windows

Windows packages are always strongly bound to msvc, and xmake has never supported switching to another toolchain.

I have fixed this error, but even though I fixed this bug, the actual msvc is still used.

i always assumed it was working :D, the only issue i had was that clang compiled package were installing along side msvc one
but is fixed with this features request

even though I fixed this bug, the actual msvc is still used.

i think it's because the generator used is msbuild, on some other libraries i have clang that is used so it depend of the package

Arthapz pushed a commit to Arthapz/xmake that referenced this issue Jan 31, 2024
Arthapz pushed a commit to Arthapz/xmake that referenced this issue Jan 31, 2024
Arthapz pushed a commit to Arthapz/xmake that referenced this issue Feb 1, 2024
Arthapz pushed a commit to Arthapz/xmake that referenced this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment