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 在windows 10 下, update 指令无效 #1232

Closed
1-erick-zhang opened this issue Feb 4, 2021 · 19 comments
Closed

XMake 在windows 10 下, update 指令无效 #1232

1-erick-zhang opened this issue Feb 4, 2021 · 19 comments

Comments

@1-erick-zhang
Copy link

描述问题

windows 10 下 xmake update 无效, xmake 忽略了update 指令.
xmake_update

期待的结果

希望能快点修复此bug

错误信息

C:\Users\User>xmake update
error: file(C:\Users\User\xmake.lua): file not found!

相关环境

  • xmake版本:2.5.1
  • xmake运行平台:Windows 10 专业版 Insider Preview 2004
  • xmake目标平台:无

其他信息

这个问题不存在于 deepin 20.1 社区版
xmake_update_in_deepin

xmake 忽略了 update 指令, 而是直接寻找 xmake.lua 文件.

其它情况

如果目录下有 xmake.lua 就会显示下面的信息:
xmake_other

@waruqi
Copy link
Member

waruqi commented Feb 4, 2021

请到非工程目录下执行update

这个问题 dev上已修复,见 #1219

@waruqi waruqi closed this as completed Feb 4, 2021
@1-erick-zhang
Copy link
Author

windows 下我就在非工程目录

@1-erick-zhang
Copy link
Author

C:\Users\User :

x

@waruqi
Copy link
Member

waruqi commented Feb 4, 2021

从releases里面下载 xmake-master.exe安装下再试试

@1-erick-zhang
Copy link
Author

我已经重装了.
XMake 在 任何目录下都可以卸载.
XMake 在 C:\WINDOWS\system32 可以正常更新.

重装前:
屏幕截图 2021-02-04 202802

重装后:
屏幕截图 2021-02-04 202927

@waruqi
Copy link
Member

waruqi commented Feb 4, 2021

我回头看下

@waruqi waruqi reopened this Feb 4, 2021
@waruqi
Copy link
Member

waruqi commented Feb 4, 2021

我这里正常 无法复现你的问题,你可以执行下 xmake update -vD 给我看下栈信息

@1-erick-zhang
Copy link
Author

pinging for the host(gitlab.com) ... 131 ms
pinging for the host(github.com) ... 148 ms
pinging for the host(gitee.com) ... 394 ms
error: @programdir\core\main.lua:290: @programdir\core\project\project.lua:1002: file(C:\Users\User\xmake.lua): file not found!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:787]: in function 'raise'
    [@programdir\core\project\project.lua:1002]: in function 'requires_str'
    [@programdir\core\project\project.lua:1020]: in function 'requireconfs_str'
    [@programdir\actions\require\impl\package.lua:372]: in function '_merge_requireinfo'
    [@programdir\actions\require\impl\package.lua:497]: in function '_load_package'
    [@programdir\actions\require\impl\package.lua:597]: in function '_load_packages'
    [@programdir\actions\require\impl\package.lua:934]: in function 'load_packages'
    [@programdir\actions\require\impl\package.lua:951]: in function 'install_packages'
    [@programdir\actions\require\impl\environment.lua:51]: in function 'enter'
    [@programdir\actions\update\main.lua:293]:
    [C]: in function 'load'
    [@programdir\core\base\task.lua:519]: in function 'run'
    [@programdir\core\main.lua:288]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:317]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:787: in function 'raise'
        @programdir\core\main.lua:290: in function 'cotask'
        @programdir\core\base\scheduler.lua:317: in function <@programdir\core\base\scheduler.lua:315>

@waruqi
Copy link
Member

waruqi commented Feb 5, 2021

你这跑的还是老版本 master版本没生效 你看下path 是不是装了两个版本 一个32bits的 一个64bits的 分别装到不同目录了 然后path指向的还是老的版本

@1-erick-zhang
Copy link
Author

我用 Everything 搜索了, 只有一个 xmake.exe

@waruqi
Copy link
Member

waruqi commented Feb 5, 2021

[@programdir\actions\require\impl\package.lua:372]: in function '_merge_requireinfo'

你可以到自己安装目录下看下,对应位置的lua脚本,package:.lua 372 行 应该是个 return ,这里 master 上我已经修复过得,但是你这还是会调用到下面的 project.requireconfs_str() 里面去,明显还是老的脚本。

function _merge_requireinfo(requireinfo, requirepath)
-- only for project
if not os.isfile(os.projectfile()) then
return
end

这边测试用release里面的 xmake-master.win64.exe 安装后,我这是最新的

@1-erick-zhang
Copy link
Author

好吧, 明天我起来的时候再重新配置, 我这里晚上了

@1-erick-zhang
Copy link
Author

我下了源码, \actions\require\impl\package.lua:372 方法时这样的:

function _merge_requireinfo(requireinfo, requirepath)

    -- find requireconf from the given requirepath
    local requireconf_result = {}
    local requireconfs, requireconfs_extra = project.requireconfs_str()
    if requireconfs then
        for _, requireconf in ipairs(requireconfs) do
            if _match_requirepath(requirepath, requireconf) then
                local requireconf_extra = requireconfs_extra[requireconf]
                table.insert(requireconf_result, {requireconf = requireconf, requireconf_extra = requireconf_extra})
            end
        end
    end

    -- append requireconf_extra into requireinfo
    -- and the configs of add_requires have a higher priority than add_requireconfs.
    --
    -- e.g.
    -- add_requireconfs("*", {configs = {debug = false}})
    -- add_requires("foo", "bar", {configs = {debug = true}})
    --
    -- foo and bar will be debug mode
    --
    -- we can also override the configs of add_requires
    --
    -- e.g.
    -- add_requires("zlib 1.2.11")
    -- add_requireconfs("zlib", {override = true, version = "1.2.10"})
    --
    -- we override the version of zlib to 1.2.10
    --
    if #requireconf_result == 1 then
        local requireconf_extra = requireconf_result[1].requireconf_extra
        if requireconf_extra then
            -- preprocess requireconf_extra, (debug, override ..)
            local override = requireconf_extra.override
            requireconf_extra.override = nil
            if requireconf_extra.debug then
                requireconf_extra.configs = requireconf_extra.configs or {}
                requireconf_extra.configs.debug = true
                requireconf_extra.debug = nil
            end
            -- append or override configs and extra options
            for k, v in pairs(requireconf_extra.configs) do
                requireinfo.configs = requireinfo.configs or {}
                if override or requireinfo.configs[k] == nil then
                    requireinfo.configs[k] = v
                end
            end
            for k, v in pairs(requireconf_extra) do
                if k ~= "configs" then
                    if override or requireinfo[k] == nil then
                        requireinfo[k] = v
                    end
                end
            end
        end
    elseif #requireconf_result > 1 then
        local confs = {}
        for _, item in ipairs(requireconf_result) do
            table.insert(confs, item.requireconf)
        end
        raise("package(%s) will match multiple add_requireconfs(%s)!", requirepath, table.concat(confs, " "))
    end
end

x
版本 2.5.1

安装步骤:

x

之前使用 xmake-v2.5.1.win64.exe 下载的:

x

源码 xmake-2.5.1.zip:

x
链接: https://codeload.github.com/xmake-io/xmake/zip/v2.5.1

@waruqi
Copy link
Member

waruqi commented Feb 5, 2021

我下了源码, \actions\require\impl\package.lua:372 方法时这样的:

你这个还是老版本哈。。我是让你下载 master 版本测试,也就是 master 分支的最新提交版本(ci日常构建的版本,还没发版),不是 2.5.1线上版本。。

从releases里面下载 xmake-master.exe安装下再试试

https://github.com/xmake-io/xmake/releases/download/v2.5.1/xmake-master.win64.exe

image

dev分支的版本也可以,别弄错了

@1-erick-zhang
Copy link
Author

x
这样对了吧

@waruqi
Copy link
Member

waruqi commented Feb 5, 2021

对了 你在update一边试试呢 git能找到不

@1-erick-zhang
Copy link
Author

x

@waruqi
Copy link
Member

waruqi commented Feb 5, 2021

那可以了。已经更新了。。git 那个暂时不用管,首次装完git 可能有些case没立即绑定环境,所以后面的执行失败了,下次重新 update 就好了。。回头我可以改进下

@1-erick-zhang
Copy link
Author

谢谢了

@waruqi waruqi closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants