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

Feature: Notify Qt installation for QtCreator autodetection #448

Open
lucky62 opened this issue Nov 12, 2021 · 15 comments
Open

Feature: Notify Qt installation for QtCreator autodetection #448

lucky62 opened this issue Nov 12, 2021 · 15 comments
Labels
enhancement New feature or request no-issue-activity question Further information is requested

Comments

@lucky62
Copy link

lucky62 commented Nov 12, 2021

Hello,
I installed Qt and tools using aqtinstall - Exactly mingw810 both 32bit and 64bit.
I started the QtCreator but no Qt versions were autodetected.
So I added manually both versions (by browsing and selecting qmake).

Now QtCreator is reporting the problem: No compiler can produce code for this Qt version.
So it means that also tools are not autodetected and must be added manually.

So question - why the autodetection of Qt versions and Tools is not working?
They are installed on wrong place?

My directory structure (all aqtinstall defaults):
image

@ddalcino
Copy link
Contributor

Autodetection of Qt versions and tools is not something that aqt attempts to accomplish. For the most part, aqt simply downloads archives from the Qt repo and unzips them; it does nothing to tell QtCreator where to find Qt installations or compilers. I think you might be looking for the official Qt graphical installer; it is intended for this kind of thing.

If you don't want to use the official installer, you should be able to add kits for mingw manually manually.

If you feel strongly that aqt should be able to add kits to QtCreator automatically, and you know how to make aqt do it, I'm sure that @miurahr would welcome a PR. This sounds like a useful feature. I think this might be related to #332.

@lucky62
Copy link
Author

lucky62 commented Nov 14, 2021

Thanks for response. I need to clarify my point of view.
I was not asking to modify aqt to be able to change the QtCreator configuration.

Qt Creator has its own autodetection. I was just asking why Qt Versions and Tools are not detected.

In the QtCreator Tools->Options->Kits->Compilers - when I clicked on the button Re-detect, then only C-Lang compiler is detected (probably because it is inside of the QtCreator folder):

QtCreatorAutoDetection

I don't know, how the QtCreator autodetection is working, But probably it will be enough to place the downloaded parts to the right place... Or to set some environment variables.. (PATH?)...

Anybody knows how the QtCreator autodetection works?

@ddalcino
Copy link
Contributor

Anybody knows how the QtCreator autodetection works?

No, this sounds outside the scope of aqtinstall, and I think you'll have better luck asking at the Qt forums.

aqt installs everything directly to the output directory that you specify. If you run aqt install-tool windows desktop <mingw> --outputdir ./Qt, it will unzip the mingw archives directly in ./Qt. Any paths beyond that are encoded directly into the archive, and aqt will not modify them. aqt does not decide whether or not to place anything in a Tools folder or a 5.15.2 folder.

If it's at all helpful, I have a local Qt installation installed with the official installer, and the directory structure looks like this:

Qt
|-5.12.10
| |-mingw73_32
|-Tools
  |-mingw730_32
  |-QtCreator
  |-QtInstallerFramework

In QtCreator, the auto-detect locates the Qt/Tools/mingw730_32/bin/g++.exe compiler automatically, and it is not in my PATH variable. It also automatically detects several other compilers; some of these are in my PATH and some are not. It is not clear to me how it is detecting these.

@miurahr
Copy link
Owner

miurahr commented Nov 15, 2021

@lucky62 Please see a qtscript(installscirpt.qs) inside meta.7z package (for example 6.2.1 mingw) .

If you want to realize auto-detection, you should do something similar with the script does.

You can find a part

            if (installer.value("SDKToolBinary") == "")
                return;

            component.addOperation("Execute",
                                   ["@SDKToolBinary@", "addQt",
                                    "--id", component.name,
                                    "--name", "Qt %{Qt:Version} MinGW 64-bit",
                                    "--type", "Qt4ProjectManager.QtVersion.Desktop",
                                    "--qmake", qmakeBinary,
                                    "UNDOEXECUTE",
                                    "@SDKToolBinary@", "rmQt", "--id", component.name]);

            var kitName = component.name + "_kit";
            component.addOperation("Execute",
                                   ["@SDKToolBinary@", "addKit",
                                    "--id", kitName,
                                    "--name", "Desktop Qt %{Qt:Version} MinGW 64-bit",
                                    "--Ctoolchain", "@MINGW810_TCID@" + ".gcc",
                                    "--Cxxtoolchain", "@MINGW810_TCID@" + ".g++",
                                    "--qt", component.name,
                                    "--debuggerid", "@MINGW810_DBGID@",
                                    "--devicetype", "Desktop",
                                    "UNDOEXECUTE",
                                    "@SDKToolBinary@", "rmKit", "--id", kitName]);

This tells QtCreator about the new installation of gcc and component.

@lucky62
Copy link
Author

lucky62 commented Nov 15, 2021

@miurahr this is not the "auto-detection" - this is the "auto-configuration" and some SDK Tool is required for this.

Auto-Detection is directly in the QtCreator. I was looking inside the source code which procedure is called when Re-detect button is pressed - but the code is not very clear to me...

@ddalcino
Copy link
Contributor

... and some SDK Tool is required for this.

The SDK Tool should be at Qt/Tools/QtCreator/bin/sdktool.exe on Windows; I'm not sure where it is on other platforms.

@miurahr
Copy link
Owner

miurahr commented Dec 4, 2021

@lucky62 "auto-configuration" can be a feature request for aqtinstall but if you want to improve QtCreator "auto-detection" as you mentioned, it is not an issue of aqtinstall, isn't it?

@miurahr miurahr added the question Further information is requested label Dec 4, 2021
@lucky62
Copy link
Author

lucky62 commented Dec 10, 2021

I agree. This is a feature request for aqtinstall. Not a bug.
It will be very nice if aqtinstall will do something similar as official install script mentioned in your post before.

@miurahr miurahr added the enhancement New feature or request label Dec 11, 2021
@miurahr miurahr changed the title Q: QtCreator autodetection - why it is not working? Feature: Notify Qt installation for QtCreator autodetection Dec 11, 2021
@ddalcino
Copy link
Contributor

@lucky62 Please see a qtscript(installscirpt.qs) inside meta.7z package (for example 6.2.1 mingw) .

If you want to realize auto-detection, you should do something similar with the script does.

I think it would be easy for us to download and unzip the appropriate meta.7z archive that contains installscript.qs. I have no idea how we could run the installscript.qs file. To implement this feature properly, running that file is necessary.

The only alternative that I see is to re-implement every installscript.qs file, in Python, for every version of Qt, every architecture, and every platform. I think it's possible to do this, and there may be shortcuts to reduce the amount of work required, so that you don't need to reimplement every permutation of version/arch/platform. Additionally, I think you would need to test this code exhaustively (run the installer on every permutation of version/arch/platform in ci), and I don't think that's sustainable.

If we can prove that the installscript.qs files are not substantially different from each other for each permutation of version/arch/platform, maybe it would be sustainable to reimplement it in Python without exhaustive testing.

Does anyone know how to run a QScript file (.qs) independently of the Qt installer? Does a "NodeJS/QS" exist somewhere?

@miurahr
Copy link
Owner

miurahr commented Dec 19, 2021

Does anyone know how to run a QScript file (.qs) independently of the Qt installer? Does a "NodeJS/QS" exist somewhere?

installscript.qs calls functions provided by QtIFW, such as binary patching, I think it is not possible to run indenendently of the Qt installer.

@ddalcino
Copy link
Contributor

If it’s impossible to run the installscript.qs independently of QtIFW, then the alternative is to rewrite every installscript.qs in Python. IMHO, that approach is unsustainable. I don’t think it’s a good idea to try to implement this feature.

@miurahr
Copy link
Owner

miurahr commented Jan 11, 2022

IMHO, that approach is unsustainable. I don’t think it’s a good idea to try to implement this feature.

I'm also think it is not sustainable, but experimental #474 illustrate how it can be implemented(not tested)
@lucky62 may be interested in making this working.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@miurahr
Copy link
Owner

miurahr commented Feb 11, 2022

#474 may be work for you, @lucky62 Could you try?

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no-issue-activity question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants