The "static linking" instructions for Linux are ambiguous
-
I've tried and failed to follow the static linking instructions a few times over the years, so I've installed a clean copy of Ubuntu 20.04 and am really trying to follow these instructions to the letter. The problem is, when I read them closely, they're very ambiguous. I was hoping someone could help me decipher them.
-
The page assumes you already have Qt downloaded. But what is "Qt" in this context? Should I clone the git repo? Download the online installer? Something else?
-
I'm supposed to cd into
/path/to/Qt
. What path does this refer to exactly? Once I have Qt "downloaded", however I do that, how can I figure out which path to cd into? -
The instructions then say to run
./configure
with the-prefix /path/to/Qt
option. This suggests that we should pass as-prefix
the path that we're currently in. Is that the case? Or are the two/path/to/Qt
s referenced in the instructions different paths? The reason is that the instructions say "we specify the prefix so that we do not overwrite the existing Qt installation", so I would have thought you'd specify a path to an empty directory or something.
-
-
- You want to build Qt, so yes you need Qt source code. Clone the repo and checkout the branch/tag you want to build (else you will build the development branch!)
- Well, you clone Qt source code in some repository, right? Then after cloning you will have a subfolder in that folder containing Qt source code - that is the path you need
- This seems like a wrong advice. Prefix is the path where you want to install your Qt build. You should select some other folder to not to mix source code and binaries.
Regarding 2.: you should rather do yout of source builds instead of building directly in source code tree:
mkdir qt_build cd qt_build /path/to/Qt/configure -prefix ~/qt_static make make install
-
Thanks for clarifying that for me. I get a few errors when I run ./configure. Again, I can think of a few things to try in order to fix this, but since this is the third or fourth time I've tried to do this and something always goes wrong, I'm trying to be very very cautious about doing anything not explicitly listed in the instructions.
The first error I get is:
CMake Warning at qtbase/cmake/QtAutoDetect.cmake:65 (message):
The officially supported CMake generator for building Qt is Ninja. You are
using: 'Unix Makefiles' instead. Thus, you might encounter issues. Use at
your own risk.The second is:
CMake Error at CMakeLists.txt:17 (project):
No CMAKE_CXX_COMPILER could be found.Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.I can think of a few solutions: (1) installing ninja (how can I do this in such a way that this configure script will see the install?) and (2) just setting CMAKE_CXX_COMPILER to /usr/bin/gcc. But what should I do?
-
Hi and welcome to devnet,
From what you wrote, you are using a "clean Ubuntu" which means that you likely have not installed the dependencies required to build Qt.
From the looks of it you are even missing the compiler.
You should start by installing them using your distribution's package manager.
-
@jj2m said in The "static linking" instructions for Linux are ambiguous:
Where can I find out what the dependencies to build Qt are (the obvious place to look is here, but it doesn't mention dependencies)?
The 2nd line of your link says, "Qt for X11 has some requirements that are given in more detail in the Qt for X11 Requirements document."
-
Hi,
don't mean to hijack this thread but it seems static linking of libraries cross platform is quite painful.
where do you find configure.exe on windows QT - i'm running 5.12.2 - can't find it.
I need a static linkage to the QT5.<blahblah>.dllAlso I need the appropriate command args to it cos ./configure -static <other params> is useless, at least give me a link to the reference, thanks in advance. I'm using gcc in mingw32
-
@Cambo said in The "static linking" instructions for Linux are ambiguous:
where do you find configure.exe on windows QT - i'm running 5.12.2 - can't find it
In qt source code archive. You need either to clone Qt Git repository or download Qt source code archive.
-
@jj2m said in The "static linking" instructions for Linux are ambiguous:
nothing about cmake or ninja or anything else
Maybe a misunderstanding here: dependencies usually mean libraries and that is what the link is about. For building you need cmake (for Qt6), make and compiler. ninja is optional.
-
Have you seen this page for building Qt from git?