Not all lib files got statically built
-
I have a fresh download of Qt 5.9.1, and I downloaded the sources too. I haven't done anything to Qt before I followed the steps from the help pages that simply say:
-go to the source folder
-run /configure -static -prefix /path/to/Qt
-then make
and that should give me statically built libraries. After doing all that I started up my project in qtCreator, added CONFIG += static and QMAKE_LFLAGS += -static -Wl,-verbose to get a static build of my program.The linker couldn't find stuff like libQt5Designer.a, libQt5Gui.a and so on. I went back to my Qt installation folder and saw that only some of the libraries have had their static counterparts built. After that I saw somewhere that running
./configure -developer-build -opensource -nomake examples -nomake tests -static -prefix /path/to/Qt and making them might help, but static libraries are still missing.How do I build them?
-
Hi,
Don't use the -developer-build option unless you are hacking on Qt itself.
Maybe a silly question but did you add your custom Qt build to the
Build and Run
panel in Qt Creator's option ? Did you create a kit for it ? Are you using that kit ? -
@SGaist
So should I build Qt statically again, only this time with these configure options:
./configure -static -prefix /path/to/QtAlso, I haven't fiddled with kits or anything. I had Qt 5.7 on my system, so I decided to freshly download 5.9 and build it from source. QtCreator itself detected and switched to 5.9 for building. I'm no Qt expert, but I think that the kit might not be the problem since I'm missing actual static libraries.
Could have this something to do with the fact that I set up the -prefix /path/to/Qt, the same path 5.9 was downloaded?
-
Also I need to add, once I noticed that some static libraries are missing, and before changing anything to the configuration I ran make again just in case and it reported that all targets have been made and that there is no work to be done. Could it be that not all libraries were in the list of targets in the make file? Is there some configuration option just to generate the libraries?
-
I did a make clean, configured it like this
./configure -nomake examples -nomake tests -make libs -static -prefix /mnt/data/Qt5.9.1-staticand this time I did a make install, and well enough all the libraries are in /mnt/data/Qt5.9.1-static/lib. Also, this time I manually chose the kit at the prefix location to be my qt builder.
But now I have another problem. The Designer plugin isn't among the statically built plugins. Last time I solved the problem of missing libs by installing Qt since it appears they were scattered through the directories, but I don't know what to do about this problem.
-
Are you using Qt Creator to write your application ?
-
@SGaist Yes I am.
I'm considering to mark the topic as solved because I figured out why it only SEEMED that not all libraries are being statically compiled, it's because :
- The first time I built them I set the prefix to the same folder an already installed Qt was, making them scattered across the various subdirectories
- When I set the -prefix flag the next time to another location I forgot to run the make install step
So after fixing those two mistakes I had my statically built Qt up and running. As for the Designer plugin not being statically built that's not a problem anymore because I actually didn't need it. My current problems are far out of the reach the original topic, so if need be Ill open another thread at a later time.
Thanks for the help anyways.