[SOLVED] Windows build: Many classes cannot be found
-
Um, then it sounds like you didn't download the source for qtsvg before compiling Qt. How did you obtain the source?
I usually use the online installer and select "Source components" when building Qt manually. There's a checkbox for each add-on module, including qtsvg.
If you cloned the repo using git then if I remember correctly you need to get the add-ons separately, but I'm not sure. Here's the list of all Qt modules on git: Qt Project Git Repository. -
Btw. It's unrelated but when building from source it's nice to pass a prefix to the
configure
and runnmake install
after the build, e.g.configure -prefix %CD%\..\mybuild\ <all the options> nmake nmake install
This would copy all the necessary files to the prefix directory and structure them the way the precompiled builds are. You can then throw out the build directory with all the temporary files you don't need (like .obj and so forth). This reduces the size of the Qt directory significantly and it's easier to find all the modules. Maybe it's also related to your problem, as the qtsvg directory lives outside qtbase in the sources. Maybe it confuses the add-in?
-
I got the source from here: http://download.qt.io/official_releases/qt/5.4/5.4.1/single/qt-everywhere-opensource-src-5.4.1.zip
The source is complete, otherwise it wouldn't work by manually adding the include dirs ;-)
In ...\Qt5.4.1\qtsvg\ there is include\ and src\ with all the files..I'd want to build with -prefix and nmake install but I read somewhere that this isn't supported on windows, so I'll dig into that again first.
-
I'd want to build with -prefix and nmake install but I read somewhere that this isn't supported on windows
Yeah, I've seen that too but it's working ok for at least a couple of latest releases, so I think this might be the case of outdated information (the bigger the internet the more catching up it has to do ;) ).
-
Okay, that seemed to work. The headers are there.
But two problems occured:When I wanted to start a Qt application, I was getting an error that the platform plugin couldn't be loaded. So I tried to add all of these to PATH but it didn't work:
D:\Programming\Libraries\Qt5.4.1
D:\Programming\Libraries\Qt5.4.1\bin
D:\Programming\Libraries\Qt5.4.1\plugins
D:\Programming\Libraries\Qt5.4.1\plugins\platforms
D:\Programming\Libraries\Qt5.4.1\plugins\imageformats
I had to add an env. variable "QT_QPA_PLATFORM_PLUGIN_PATH=D:\Programming\Libraries\Qt5.4.1\plugins\platforms".
Why is that?The other problem is that assistant/designer/linguist.exe all cannot be started anymore because they crash immediately (module: MSVCR120.dll).
I have no idea at the moment what's going wrong...
// EDIT:
Crash callstack:
Qt5Core.dll!qBadAlloc() Line 2848
Qt5Core.dll!QByteArray::QByteArray(const char * data, int size) Line 1372
Qt5Core.dll!QLibraryPrivate::fromRawMetaData(const char * raw) Line 112
Qt5Core.dll!findPatternUnloaded(const QString & library, QLibraryPrivate * lib) Line 301
Qt5Core.dll!QLibraryPrivate::updatePluginState() Line 715
Qt5Core.dll!QFactoryLoader::update() Line 153
Qt5Core.dll!QFactoryLoader::QFactoryLoader(const char * iid, const QString & suffix, Qt::CaseSensitivity cs) Line 97
Qt5Gui.dll!`anonymous namespace'::Q_QGS_directLoader::innerFunction() Line 49
Qt5Gui.dll!QPlatformIntegrationFactory::create(const QString & platform, const QStringList & paramList, int & argc, char * * argv, const QString & platformPluginPath) Line 70
Qt5Gui.dll!init_platform(const QString & pluginArgument, const QString & platformPluginPath, const QString & platformThemeName, int & argc, char * * argv) Line 1010?!
-
First, after you built Qt with the prefix make sure you add it to the VS add-in correctly i.e. the prefix path, not the build path. Also, don't move your Qt build to another directory or rename it. If you did you'll have to patch the paths in Qt binaries using e.g. QtBinPatcher. Don't forget to change your solution and project Qt version too after that (right click on solution and change solution Qt version, right click on project and change Qt version in the Qt settings dialog).
Second - please, please!, don't pollute PATH or other environment variables. You'll thank me later when you decide to have two Qt versions side by side or have Qt app installed that uses some other version. The suggested method of deployment on Windows is copying Qt libraries to the app directory, as described here. This goes for the core Qt dlls as well as platform and other plugins. For your own sake and future sanity I strongly suggest to follow that path.
As for the crashing tools I'm not sure. Maybe some other env. variables you set are colliding? You can try to run any of the tools through profile mode in Dependency Walker and see if it crashes on loading any of the libs.
-
Oh, I renamed the directory after nmake install finished (from Qt5.4.1build to Qt5.4.1). That could be the problem. I'm rebuilding now from scratch.
But why are the binaries dependent on paths?!I am adding to PATH because it's the development machine :-P
Otherwise I would have to copy the binaries to every single application directory I'm developing, right? -
I'm rebuilding now from scratch.
No need to do that. Using the QtBinPatcher is a one-click solution to moving Qt.
But why are the binaries dependent on paths?!
It's a long story. In short qmake tracks which libraries were used to build Qt so that it can link to the right versions when you link your app using Qt. When you install Qt from an installer it does the patching for you but if you decide to build Qt yourself and then move it to another directory you need to patch it to fix the paths (which are embedded in qmake exec and in the .prl files in the lib directory among other places). The simplest is to build it with the desired directory set in prefix. This way you don't need any patching.
But don't worry. This is only development side. End users don't need any of this.I am adding to PATH because it's the development machine :-P
This is not an excuse. That's even worse if you ask me.
Otherwise I would have to copy the binaries to every single application directory I'm developing, right?
Right, but not everything. Just the dlls the app actually uses. You will need to do this anyway when deploying so I don't see a problem. Anyway, I'm guessing you're not developing a 100 apps at a time right?
-
I don't plan to have more than one version
This is a line from a bad Seagal movie I love to quote in this kind of situations :)
-
This post is deleted!