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

msys2/mingw setenv and os.exec issue #3628

Closed
waruqi opened this issue Apr 13, 2023 · 5 comments
Closed

msys2/mingw setenv and os.exec issue #3628

waruqi opened this issue Apr 13, 2023 · 5 comments
Labels
Milestone

Comments

@waruqi
Copy link
Member

waruqi commented Apr 13, 2023

Xmake Version

2.7.8

Operating System Version and Architecture

windows/msys/mingw64

Describe Bug

I'm having a problem where when I run os.exec("python --version") on msys2/mingw64, CreateProcess will preferentially look for python from the /mingw64/bin directory and run it, even though I've set it to the path I specified via os.setenv.

Perhaps because xmake is installed to /mingw64/bin/xmake, CreateProcess always gives the highest priority to finding the process from /mingw64/bin (if it exists), rather than from the $PATH environment variable.

I don't know how to fix it. It affects xmake's installation of packages under mingw.

image

Maybe I can only modify the install script to install the xmake executable in another path and then wrap it with the /mingw64/bin/xmake shell script.

Expected Behavior

it works

Project Configuration

No response

Additional Information and Error Logs

No response

@waruqi waruqi added the bug label Apr 13, 2023
@waruqi waruqi added this to the v2.7.9 milestone Apr 13, 2023
@waruqi waruqi closed this as completed Apr 13, 2023
@waruqi
Copy link
Member Author

waruqi commented Aug 23, 2023

fix os.exec() call incorrect program from /mingw64/bin. e.g. python, ..

because xmake is installed to /mingw64/bin/xmake,
os.exec/CreateProcess always gives the highest priority to finding the process from /mingw64/bin (if it exists),
rather than from the $PATH environment variable.

we install the xmake executable into a separate directory to ensure
that os.exec() does not look for additional executables.

@waruqi
Copy link
Member Author

waruqi commented Jan 26, 2024

maybe #4658

@StableAgOH
Copy link

maybe #4658

So can xmake.exe go back to ${MINGW_PREFIX}/bin now? Its current location is a bit inconvenient. (

@waruqi
Copy link
Member Author

waruqi commented Apr 4, 2024

I'm not sure if this is the cause of it yet, I need to do more testing to verify it and if it has indeed been fixed I can restore it.

waruqi added a commit that referenced this issue May 14, 2024
@waruqi
Copy link
Member Author

waruqi commented May 14, 2024

maybe #4658

So can xmake.exe go back to ${MINGW_PREFIX}/bin now? Its current location is a bit inconvenient. (

I tried it, it still does not work, so I cannot revert it.

the current PATH

PATH=C:\Users\wangrunqing\AppData\Local\.xmake\packages\p\python\3.11.8\c78c5a743ed7468ba683cd8a5ff50255\
bin;C:\Users\wangrunqing\AppData\Local\.xmake\packages\p\python\3.11.8\c78c5a743ed7468ba683cd8a5ff50
255\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\Windows\System32;C:\W
indows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_p
erl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl

when I call os.exec("python --version"), it still return incorrect python.

Python 3.10.11
/mingw64/bin
    - python 3.10.11
    - xmake.exe

we should get python 3.11.8

C:\Users\wangrunqing\AppData\Local\.xmake\packages\p\python\3.11.8\c78c5a743ed7468ba683cd8a5ff50255\
bin

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