Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. The "static linking" instructions for Linux are ambiguous
Forum Updated to NodeBB v4.3 + New Features

The "static linking" instructions for Linux are ambiguous

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
11 Posts 6 Posters 1.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jj2m
    wrote on 9 May 2022, 10:40 last edited by
    #1

    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.

    1. 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?

    2. 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?

    3. 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/Qts 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.

    J 1 Reply Last reply 9 May 2022, 11:47
    0
    • J jj2m
      9 May 2022, 10:40

      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.

      1. 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?

      2. 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?

      3. 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/Qts 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.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 9 May 2022, 11:47 last edited by
      #2

      @jj2m

      1. 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!)
      2. 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
      3. 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
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • J Offline
        J Offline
        jj2m
        wrote on 9 May 2022, 13:12 last edited by
        #3

        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?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 May 2022, 18:25 last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • J Offline
            J Offline
            jj2m
            wrote on 9 May 2022, 21:47 last edited by jj2m 5 Sept 2022, 21:52
            #5

            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)? I do have a compiler - gcc is installed.

            J 1 Reply Last reply 10 May 2022, 01:22
            0
            • J jj2m
              9 May 2022, 21:47

              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)? I do have a compiler - gcc is installed.

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 10 May 2022, 01:22 last edited by
              #6

              @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."

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              J 1 Reply Last reply 10 May 2022, 08:24
              1
              • C Offline
                C Offline
                Cambo
                wrote on 10 May 2022, 08:15 last edited by Cambo 5 Oct 2022, 08:17
                #7

                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>.dll

                Also 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

                J 1 Reply Last reply 10 May 2022, 08:18
                0
                • C Cambo
                  10 May 2022, 08:15

                  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>.dll

                  Also 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

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 10 May 2022, 08:18 last edited by
                  #8

                  @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.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J JKSH
                    10 May 2022, 01:22

                    @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."

                    J Offline
                    J Offline
                    jj2m
                    wrote on 10 May 2022, 08:24 last edited by
                    #9

                    @JKSH I should have mentioned it, but that link is irrelevant. If you click through you can see that it just lists various x11 related libraries, nothing about cmake or ninja or anything else.

                    J 1 Reply Last reply 10 May 2022, 08:27
                    0
                    • J jj2m
                      10 May 2022, 08:24

                      @JKSH I should have mentioned it, but that link is irrelevant. If you click through you can see that it just lists various x11 related libraries, nothing about cmake or ninja or anything else.

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 10 May 2022, 08:27 last edited by
                      #10

                      @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.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mchinand
                        wrote on 11 May 2022, 13:06 last edited by
                        #11

                        Have you seen this page for building Qt from git?

                        1 Reply Last reply
                        0

                        7/11

                        10 May 2022, 08:15

                        • Login

                        • Login or register to search.
                        7 out of 11
                        • First post
                          7/11
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved