Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMAKE_PREFIX_PATH does not work as expected
Forum Updated to NodeBB v4.3 + New Features

CMAKE_PREFIX_PATH does not work as expected

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 3 Posters 20.2k Views 2 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.
  • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

    @JoeCFD I tried that and didn't work. I'm doing a cross-compilation for WebAssembly on Ubuntu.

    JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #9

    @Ahmed-Yarub-Hani-Al-Nuaimi show me your CMakeLists.txt
    show me the output of
    echo $PATH
    echo $LD_LIBRARY_PATH

    1 Reply Last reply
    0
    • Ahmed Yarub Hani Al NuaimiA Offline
      Ahmed Yarub Hani Al NuaimiA Offline
      Ahmed Yarub Hani Al Nuaimi
      wrote on last edited by
      #10

      Here you go:
      https://github.com/ahmedyarub/basic_qml/blob/master/CMakeLists.txt

      1 Reply Last reply
      0
      • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

        @JoeCFD said in CMAKE_PREFIX_PATH does not work as expected:

        LD_LIBRARY_PATH

        export PATH=~/Qt/5.15.0/wasm_32/bin/:$PATH
        which  qmake
        ~/Qt/5.15.0/wasm_32/bin//qmake
        export LD_LIBRARY_PATH=~/Qt/5.15.0/wasm_32/lib/
        

        Still had the error.
        It does mention here https://doc.qt.io/qt-5.15/cmake-get-started.html clearly:

        Set your CMAKE_PREFIX_PATH environment variable to the Qt 5 installation prefix. This is the recommended way.
        

        Still, I could not find anybody who could get it working using this variable on Linux!

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #11

        @Ahmed-Yarub-Hani-Al-Nuaimi Try to use full path of ~/Qt/5.15.0/wasm_32 to set PATH and LD_LIBRARY_PATH

        Ahmed Yarub Hani Al NuaimiA 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          @Ahmed-Yarub-Hani-Al-Nuaimi Try to use full path of ~/Qt/5.15.0/wasm_32 to set PATH and LD_LIBRARY_PATH

          Ahmed Yarub Hani Al NuaimiA Offline
          Ahmed Yarub Hani Al NuaimiA Offline
          Ahmed Yarub Hani Al Nuaimi
          wrote on last edited by
          #12

          @JoeCFD
          echo $PATH
          /home/fifothekid/Downloads/cmake-3.18.0-Linux-x86_64/bin:/home/fifothekid/Qt/5.15.0/wasm_32/bin/:/home/fifothekid/.wasmer/bin:/home/fifothekid/.wasienv/bin:/home/fifothekid/Documents/emsdk:/home/fifothekid/Documents/emsdk/upstream/emscripten:/home/fifothekid/Documents/emsdk/node/12.18.1_64bit/bin:/home/fifothekid/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/fifothekid/.wasmer/globals/wapm_packages/.bin

          echo $LD_LIBRARY_PATH
          /home/fifothekid/Qt/5.15.0/wasm_32/lib/

          and then tried /home/fifothekid/Qt/5.15.0/wasm_32

          JoeCFDJ 1 Reply Last reply
          0
          • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

            @JoeCFD
            echo $PATH
            /home/fifothekid/Downloads/cmake-3.18.0-Linux-x86_64/bin:/home/fifothekid/Qt/5.15.0/wasm_32/bin/:/home/fifothekid/.wasmer/bin:/home/fifothekid/.wasienv/bin:/home/fifothekid/Documents/emsdk:/home/fifothekid/Documents/emsdk/upstream/emscripten:/home/fifothekid/Documents/emsdk/node/12.18.1_64bit/bin:/home/fifothekid/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/fifothekid/.wasmer/globals/wapm_packages/.bin

            echo $LD_LIBRARY_PATH
            /home/fifothekid/Qt/5.15.0/wasm_32/lib/

            and then tried /home/fifothekid/Qt/5.15.0/wasm_32

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #13

            @Ahmed-Yarub-Hani-Al-Nuaimi type
            which qmake

            this is the only line in my cmake file to find Qt 5
            find_package(Qt5 REQUIRED Core Gui Widgets Svg Xml Network DBus OpenGL Multimedia WebEngineWidgets)

            1 Reply Last reply
            0
            • Ahmed Yarub Hani Al NuaimiA Offline
              Ahmed Yarub Hani Al NuaimiA Offline
              Ahmed Yarub Hani Al Nuaimi
              wrote on last edited by
              #14

              which qmake
              /home/fifothekid/Qt/5.15.0/wasm_32/bin//qmake

              JoeCFDJ 1 Reply Last reply
              0
              • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

                which qmake
                /home/fifothekid/Qt/5.15.0/wasm_32/bin//qmake

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #15

                @Ahmed-Yarub-Hani-Al-Nuaimi
                I tried this
                cmake_minimum_required(VERSION 3.10)
                option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
                project(basic_qml)

                set(CMAKE_AUTOMOC ON)
                set(CMAKE_AUTORCC ON)

                set(CMAKE_CXX_STANDARD 17)

                set (Qt5_FOUND false)

                find_package(Qt5 COMPONENTS Core
                Gui
                Svg
                Xml
                Qml
                Quick
                QuickControls2 REQUIRED)

                if(Qt5_FOUND)
                message("QT5 framework found")
                else(Qt5_FOUND)
                message(FATAL_ERROR "No QT5 framework found")
                endif(Qt5_FOUND)

                ==========================================================

                the output:
                -- The C compiler identification is GNU 7.5.0
                -- The CXX compiler identification is GNU 7.5.0
                -- Check for working C compiler: /usr/bin/cc
                -- Check for working C compiler: /usr/bin/cc -- works
                -- Detecting C compiler ABI info
                -- Detecting C compiler ABI info - done
                -- Detecting C compile features
                -- Detecting C compile features - done
                -- Check for working CXX compiler: /usr/bin/c++
                -- Check for working CXX compiler: /usr/bin/c++ -- works
                -- Detecting CXX compiler ABI info
                -- Detecting CXX compiler ABI info - done
                -- Detecting CXX compile features
                -- Detecting CXX compile features - done
                QT5 framework found
                -- Configuring done
                -- Generating done
                -- Build files have been written to:

                1 Reply Last reply
                0
                • Ahmed Yarub Hani Al NuaimiA Offline
                  Ahmed Yarub Hani Al NuaimiA Offline
                  Ahmed Yarub Hani Al Nuaimi
                  wrote on last edited by
                  #16

                  Are you cross-compiling for wasm32?

                  JoeCFDJ 1 Reply Last reply
                  0
                  • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

                    Are you cross-compiling for wasm32?

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by
                    #17

                    @Ahmed-Yarub-Hani-Al-Nuaimi this is only on linux ubuntu

                    1 Reply Last reply
                    0
                    • Ahmed Yarub Hani Al NuaimiA Offline
                      Ahmed Yarub Hani Al NuaimiA Offline
                      Ahmed Yarub Hani Al Nuaimi
                      wrote on last edited by
                      #18

                      I know. It does work if you are building for Ubuntu on Ubuntu. It's cross-compilation that doesn't work. According to official documentations, setting CMAKE_PREFIX_PATH should be enough, but it's not.
                      I had the same problem compiling for Android on Ubuntu and Windows, for iOS on MacOS, and for WebAssembly on Ubuntu.

                      JoeCFDJ 1 Reply Last reply
                      0
                      • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

                        I know. It does work if you are building for Ubuntu on Ubuntu. It's cross-compilation that doesn't work. According to official documentations, setting CMAKE_PREFIX_PATH should be enough, but it's not.
                        I had the same problem compiling for Android on Ubuntu and Windows, for iOS on MacOS, and for WebAssembly on Ubuntu.

                        JoeCFDJ Offline
                        JoeCFDJ Offline
                        JoeCFD
                        wrote on last edited by JoeCFD
                        #19

                        @Ahmed-Yarub-Hani-Al-Nuaimi
                        cmake -DCMAKE_PREFIX_PATH=$QT_DIR/lib/cmake ..
                        -- The C compiler identification is GNU 7.5.0
                        -- The CXX compiler identification is GNU 7.5.0
                        -- Check for working C compiler: /usr/bin/cc
                        -- Check for working C compiler: /usr/bin/cc -- works
                        -- Detecting C compiler ABI info
                        -- Detecting C compiler ABI info - done
                        -- Detecting C compile features
                        -- Detecting C compile features - done
                        -- Check for working CXX compiler: /usr/bin/c++
                        -- Check for working CXX compiler: /usr/bin/c++ -- works
                        -- Detecting CXX compiler ABI info
                        -- Detecting CXX compiler ABI info - done
                        -- Detecting CXX compile features
                        -- Detecting CXX compile features - done
                        QT5 framework found
                        -- Configuring done
                        -- Generating done
                        -- Build files have been written to:

                        works as well without PATH and LIB settings. But this does not set qmake path. It is safe to set path and lib manually. Sure it is not needed if you install qt under root.

                        1 Reply Last reply
                        0
                        • Ahmed Yarub Hani Al NuaimiA Offline
                          Ahmed Yarub Hani Al NuaimiA Offline
                          Ahmed Yarub Hani Al Nuaimi
                          wrote on last edited by
                          #20

                          Can you try compiling for wasm32?

                          JoeCFDJ 1 Reply Last reply
                          0
                          • Ahmed Yarub Hani Al NuaimiA Ahmed Yarub Hani Al Nuaimi

                            Can you try compiling for wasm32?

                            JoeCFDJ Offline
                            JoeCFDJ Offline
                            JoeCFD
                            wrote on last edited by
                            #21

                            @Ahmed-Yarub-Hani-Al-Nuaimi I only confirmed that Qt 5 can be found. If it can be found, you will be able to compile it.

                            1 Reply Last reply
                            0

                            • Login

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