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's mingw experience needs to be improved on windows #3960

Closed
calebkiage opened this issue Jul 12, 2023 · 5 comments
Closed

Xmake's mingw experience needs to be improved on windows #3960

calebkiage opened this issue Jul 12, 2023 · 5 comments

Comments

@calebkiage
Copy link
Contributor

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

Sometimes it's useful to use xmake with mingw on windows e.g. because of compiler static analysis, but it seems like some of xmake's assumptions don't play well with MinGW on windows. As an example, the extraction logic assumes that Windows can't have a working tar program which is not true if the user has a MinGW environment. Another example is the package.tools.autoconf doesn't seem to work. It fails with the error:

./configure --disable-samples --disable-tests --enable-shared --disable-static --with-data-packaging=dll --prefix=C:/Users/myuser/AppData/Local/.xmake/packages/i/icu4c/73.1/9700b014573e4b039db80987a96fbca5 --host=x86_64-w64-mingw32
error: @programdir\core\sandbox\modules\os.lua:374: cannot execv(./configure --disable-samples --disable-tests --enable-shared --disable-static --with-data-packaging=dll --prefix=C:/Users/myuser/AppData/Local/.xmake/packages/i/icu4c/73.1/9700b014573e4b039db80987a96fbca5 --host=x86_64-w64-mingw32), No such file or directory

Describe the solution you'd like

Since mingw works on all OSes, maybe the way to go here is to not assume that unix tools are unavailable in windows hosts.

Describe alternatives you've considered

I've worked around the extraction issue by using a windows shell with MinGW in the path environment and it extracts the tgz archive correctly. I've also worked around the autoconf tools issue by calling the scripts through env:

local env = assert(find_tool("env"), "env is not found. is MinGW in the PATH?").program
os.execv(env, {"sh", "./configure", ...})

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Jul 13, 2023

try pass {shell = true}, xmake will call sh/bash to run it automatically.

    os.vrunv("./configure", argv, {shell = true})

see

os.vrunv("./configure", argv, {shell = true, envs = envs})

@calebkiage
Copy link
Contributor Author

That didn't work. I still got the same error. I'm using msys ucrt64 environment

@waruqi
Copy link
Member

waruqi commented Jul 13, 2023

what's your subhost? let me see your output of xmake l os.subhost.

or you can debug here

if subhost == "msys" or subhost == "cygwin" then

@calebkiage
Copy link
Contributor Author

Subhost is windows. Host is also windows. Both in the msys shell and windows shell with mingw in the path. I'm on xmake 2.7.8 in mingw and 2.7.9 on windows.

@waruqi
Copy link
Member

waruqi commented Jul 13, 2023

I have merged it. thanks.

@waruqi waruqi closed this as completed Jul 13, 2023
@waruqi waruqi added this to the v2.8.2 milestone Jul 13, 2023
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