mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #171] Cannot use already existing installation of QT 5.10.1 #109
Labels
No labels
bug
enhancement
help wanted
help wanted
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/qmlnet#109
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bairog on GitHub (Oct 30, 2019).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/171
Hello.
On thet Requirements page we can see Qt 5.10+. So I've expected to be able to use QML .NET with already existing installation of QT.
I'm on Windows 10 1903 x64. I've installed QT 5.10.1 prebuilt components for MSVC 2017 64-bit via qt-opensource-windows-x86-5.10.1.exe.
Resulting installation folder is C:\Qt\Qt_5.10.1\5.10.1\msvc2017_64 (during installation process I was able to choose only C:\Qt\Qt_5.10.1 folder - all subfolders are selected automatically).
And of course that resulting folder contains all necessary subfolders - bin, plugins and qml.
I'm trying to run QML .Net example using my existing installation:
RuntimeManager.ConfigureRuntimeDirectory(@"C:\Qt\Qt_5.10.1\5.10.1\")But that results in error that
Looks like qt subfolder name is hardcoded inside RuntimeManager.Configure.cs
So how to deal with that situation?
How to properly use QML .NET with already existing installation of QT 5.10.1 (editing RuntimeManager.Configure.cs and recompile QML.Net.dll is not a good option)?
Thank you.
@pauldotknopf commented on GitHub (Oct 30, 2019):
Hmm, it looks like that
RuntimeManager.Configureneeds to poke around a bit more.The only thing that method does though is set some environment variables. You could set those yourself in
Program.Main. Really though, in production environments, this is how it should be done, considering most published applications embed the Qt framework privately in their own folder.@pauldotknopf commented on GitHub (Oct 30, 2019):
Also, if you use your own Qt runtime, make sure you compile the native bits for Qml.Net yourself and put them in your PATH somewhere.
@bairog commented on GitHub (Oct 30, 2019):
Oh, could you clarify this more, please. Maybe some documentation about this case.
@pauldotknopf commented on GitHub (Oct 30, 2019):
Allow me to clarify.
All Qt libs (when using private headers) must be compiled against the exact Qt version they are running against. So, you can't just use "Qml.Net.WindowsBinaries" with any Qt runtime. If you use your own Qt installation, you must only use the Qml.Net package, and compile the native libs that are in "Qml.Net.WindowsBinaries" yourself.
The build/installation is really simple. See here.
The "Qml.Net" package will find an invoke the native C-interop QmlNet.dll properly.
@bairog commented on GitHub (Oct 31, 2019):
What I've tried (on Windows 10 1903 x64):
RuntimeManager.DiscoverOrDownloadSuitableQtRuntimes();toRuntimeManager.ConfigureRuntimeDirectory(@"C:\Qt\Qt_5.10.1\5.10.1\");.RuntimeManager.ConfigureRuntimeDirectory(@"C:\Qt\Qt_5.10.1\5.10.1\");finished correctly. ButQQuickStyle.SetStyle("Material");results in exception:So what I am doing wrong?
@bairog commented on GitHub (Oct 31, 2019):
I've tried the same approach with Qt 5.11.0 on Debian 9-based Linux distrib.
On Step 2 I've succesfully compiled \output\libQmlNet.so via build.sh.
But again on Step 6 I've faced the same exceptions.
Looks like I'm going the wrong way :)
@pauldotknopf commented on GitHub (Nov 3, 2019):
Make sure you compile the native lib using the same exact version as the NuGet library. Checkout the write tag in the git repo.
@bairog commented on GitHub (Nov 5, 2019):
Oh, that was my mistake. I used latest version of native lib instead of release 0.10.1. Now it's working (both Windows and Linux).
Final instruction for using Qml .Net with existing QT installation (tested on Windows 10 1903 x64 with QT 5.10.1 and Debian 9 with QT 5.11.0):
On Linux: Simply run build.sh.
RuntimeManager.ConfigureRuntimeDirectory()you've changed hardcoded qt subdirectory name to msvc2017_64 or the one that you use.RuntimeManager.ConfigureRuntimeDirectory(Your_QT_directory);instead ofRuntimeManager.DiscoverOrDownloadSuitableQtRuntimes();