-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Automatic Inference of MinGW
SDK Directory
#977
Comments
Ok, I will consider improving find_mingw()
Can you let me see your the content of $GCC_BIN_PATH and $GCC_LIB_PATH? mingwsdk should be the root directory of the bin/lib directory. e.g.
|
Ok, thanks. BTW, GCC_BIN_PATH these environment variables, are you custom variables, or mingw sdk-specific variables, there are still some standard specifications? Are there any related reference documents? |
It might depend on the |
and which mingw distribution did you install? I will look at it. If it is msys2/mingw, maybe we can infer it from /mingw64 and /mingw32.
If a registry key is set, we can detect it from the registry, of course, find it directly from %PATH%, which is also a way to consider. |
No, I mean to scan the string of Once you find it, only remove the No need for registry keys. |
BTW, we can run |
I know what you mean, but I mean, if there are registry keys available, I prefer to use the registry first, because it is more reliable than searching from the %PATH% string. Of course, if not, we can continue to try to find it from the %PATH% string. |
Since The only thing I saw all of them expect, is the user to add It is better not to use registry. Keep your |
But users may also change the directory name of mingwsdk, for example: /xxx/yyy, we may not be able to find it reliably from the %PATH% string. Of course, if there is a general MinGW_HOME_FOLDER, it is of course the best. If every user will go to set it. |
Advanced use can always do things manually, and then use I think this is pretty robust and user friendly. It means in most nominal cases using |
By the way, I think a RegEx to capture the Test Cases: UpdateBetter and more robust will be |
I have improved it, you can update to the dev version and try it again. 5fb2bcc xmake update dev |
Please download installer.exe to install dev version on github ci (https://github.com/xmake-io/xmake/actions/runs/288765711)
You can also run |
Does it work? |
The update fails on my machine (I don't have system wide GIT). |
you can download install package from action ci. |
It doesn't work:
My RegEx can extract the Path to This is the version I got from your link:
|
can you add xmake f -p mingw -Dv -c |
I manually deleted
Same result. |
Can you let me see your %PATH%? I will look at it. |
Here is a link to it: https://pastebin.ubuntu.com/p/WFwKtxwDpM/ |
ok, I have improved it. You can wait some time, then re-download install package from https://github.com/xmake-io/xmake/actions/runs/292952854 |
What was the issue? Why not use my RegEx? It should be robust to all cases. |
I have fixed the case sensitivity problem. Lua does not support regular expressions, only Lua pattern matching. But it's enough. Dose it work now? |
While the inference worked:
The compilation itself didn't:
|
OK. It seems to work as expected. |
It seems the issue us back.
I run and get:
Why doesn't it infer |
I did not change it, you can debug this patch. xmake/xmake/modules/detect/sdks/find_mingw.lua Lines 48 to 59 in 5e4fd84
|
I don't know how to debug this. Is there any more information I can add? This is what I get:
|
edit your installed xmake/xmake/modules/detect/sdks/find_mingw.lua in Add some print logs to debug it. for _, p in ipairs(path.splitenv(pathenv)) do
print(p, os.isdir(p)) ---> debug log
if p:find(string.ipattern("mingw[%w%-%_%+]*[\\/]bin")) and path.filename(p) == "bin" and os.isdir(p) then
print("found", p) --> debug log
sdkdir = path.directory(p)
break
end
end |
Bu as I wrote above, even if I set the folder path explicitly with As I wrote on Gitter, I'm on a computer without Visual Studio installed. |
This is what I get after adding your debug commands:
|
Can you let me see your all mingw bin files list in D:\Applications\MinGW\bin |
There you go:
It is the current distribution form https://github.com/StephanTLavavej/mingw-distro (Version |
x86_64-w64-mingw32-gcc and all bin files with x86_64-w64-mingw32- not found xmake/xmake/modules/detect/sdks/find_mingw.lua Lines 83 to 93 in 85283fa
|
Well, They are not needed. Why did you put them in the list of required? As I wrote, I can easily create the project with |
@waruqi Some MinGW distributions don't have x86_64-w64-mingw32-gcc.exe and have gcc.exe instead, I've worked with some in the past. XMake should probably fallback on them |
I have improved it, try it again. |
Could you tag a release? |
Not yet. There are still many issues and features that need to be dealt with. You need to wait for a while.
what tests? |
The tests for those file names. Do you have a unit test before release. |
for supporting llvm-mingw and mingw on msys, mingw on macos. On msys, gcc.exe may not be mingw gcc, and llvm-mingw provides other arch support. The unit test of the tool chain is too heavyweight, and it is impossible to test all tool chains and all cases on ci. And currently, basic tests have been done on the msys/mingw and macos/mingw tool chains on ci. |
OK, so it went too far. On Windows, without MSYS2 no need to check those. |
I did not delete it, because I have never supported gcc.exe for mingw in the previous version |
I can assure you that version |
same code in v2.3.8 xmake/xmake/modules/detect/sdks/find_mingw.lua Lines 83 to 100 in 965bccf
|
I think things are not well tested and hence things break up without your awareness at all.
As you can see, it works (The error has to do with the So maybe there are more issues and the code you pointed to isn't the one affecting this. I think you need to recheck the changes. |
I fixed the
Now you see you have made changes since By the way, using the flag |
here.
-- find tool path
+ if not opt.cross then
toolpath = find_file(toolname, bindirs)
if toolpath then
return path.directory(toolpath), ""
end
end
+ end
-- attempt to use the bin directory
local bindir = opt.bindir or path.join(sdkdir, "bin")
+ if os.isdir(bindir) and not opt.cross then
return bindir
+ end Although this change affects mingw, I think this is the correct change. In addition, the patch submitted in dev should have fixed your problem yesterday, there is no need to modify anything.
|
I have removed it. |
Is this fixed in the latest release? |
Please see the previous reply.
|
I want to wait when it is on the official release. |
XMake 2.5.8 was released two weeks ago (so after this change was made) and thus has this fix. |
The code in:
xmake/xmake/modules/detect/sdks/find_mingw.lua
Lines 30 to 43 in c1f1db8
Supports only
macOS
andLinux
.On top of this, it doesn't check for existence, it only sets directories (Which might not exist).
I suggest the following assuming
MinGW
platform was defined (-p mingw
):GCC_BIN_PATH
orGCC_LIB_PATH
.minGwSdk = GCC_BIN_PATH/..
orminGwSdk = GCC_LIB_PATH/..
with priority for the BIN folder.minGwSdk
. If it doesn't exist return an error.Step (4) is in case the existence isn't in a later step in the program.
The text was updated successfully, but these errors were encountered: