QtCreator 4.7.0 and LD_LIBRARY_PATH
My name's Mauro and I write you from Italy.
I have just updated QtCreator to the latest stable version 4.7.0.
My project is based on CMake I use the Qt 5.6.3 placed in /opt/Qt-5.6.3.
When I try to compile my project /opt/Qt-5.6.3/bin/uic fails because miss a symbol.
the LD_LIBRARY_PATH environment variable is assigned to the path of QtCreator by QtCreator itself.
If I assign LD_LIBRARY_PATH to empty value "", QtCreator works well and /opt/Qt-5.6.3/bin/uic does not crash.
Why QtCreator sets LD_LIBRARY_PATH to its own local lib folder?
Where I can change this configuration?
Hi, Qt Creator sets LD_LIBRARY_PATH according to what kit is installed, you can check in Build Settings, Manage Kits (for example. in my Qt Creator the kit is "Desktop Qt 5.11.1 GCC 64-bit").
The reason it does that is to allow your Qt app to load its .so (dll) files correctly for the selected kit when you Run your app from Qt Creator. On Windows Qt Creator also does this, it adds the directories where the .dll files are to the PATH and then launches your app.
Perhaps your Qt Creator does not have Qt 5.6.3 installed? If so, that could explain why your 5.6.3 app fails.
Could you try starting creator with the creator.sh file located in same folder as the Creator executable
and see if the crashing issue remains ?
That .sh file is useful when you have multiple Qt Creators installed on your system, and LD_LIBRARY_PATH contains entries to one of them, then qtcreator.sh prefixes those entries with the correct ones.
oh we must have posted at same time as i didn't see your post with the
explanation of why Creator does it.
And good info for the .sh file. was not sure what is does but the description in the top
sounds liked fixing LD_LIBRARY_PATH isses. But now i understand whats its actually for . thank you.
@mrjj Actually my post yesterday is a bit confusing, because I wrote about what happens when launching a Qt program from inside Qt Creator and the problems with wrong .dll/so-files for that program (and not for Qt Creator itself).
But @maurofaresoftware-it speaks about failure when compiling, so it could be some entry in his LD_LIBRARY_PATH that disturbs the 4.7.0. Qt Creator from functioning 100%, like another (older) installation of Qt Creator in /opt somewhere. That's why your suggestion of using qtcreator.sh is a good one :-)
That was also my feeling with uic failing but i was not sure how to go about
debugging it. and i recalled the .sh file and though it might set something in there
but turns out normally it was not used but kinda sounded like expected to be used with
LD_LIBRARY_PATH conflicts but it was unclear to me what it actually did but
i assumed it to be safe to try :)