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. Dynamic OpenGL and Qt5.7.0 build from source on Windows 7 problem (most related to QtWebEngine)
Forum Updated to NodeBB v4.3 + New Features

Dynamic OpenGL and Qt5.7.0 build from source on Windows 7 problem (most related to QtWebEngine)

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.1k Views 1 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.
  • L Offline
    L Offline
    lilyofvalley
    wrote on 13 Sept 2016, 04:19 last edited by
    #1

    The purpose to build Qt from source is to use desktop OpenGL.
    So if anyone can point out what I did wrong during dynamically setting OpenGL source (default ANGLE, I want to make it using desktop OpenGL), it will be very helpful ;) Using Qt pre-built installation package is much easier.

    1. I add QT_OPENGL as a new environment variable to Windows environment variables, set it to be "desktop", restart, does not work. Did I set it correctly or there is something else I need to do?
    2. In the program,
    #include <MyGLWidget.h>
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        app.setAttribute(Qt::AA_UseDesktopOpenGL);
    
        MyGLWidget win;
        win.resize(640, 480);
        win.show();
        return app.exec();
    }
    

    I have read that we should set application attribute before instantiating QApplication, so I feel the code might be wrong. But I don't know how to do it correctly...(http://doc.qt.io/qt-5/windows-requirements.html)

    Build Qt5.7.0 from source on Windows 7:
    I have tried several times and met different problems, most of them point to QtWebEngine. Then I use "-skip qtwebengine", new problem appears.
    I will describe them in order.
    Installed Perl (ActivePerl), Python(3.5.2), Windows SDK, DirectX SDK.
    All the compiling use "VS2013 x64 Cross Tools Command Prompt":

    1. configure -debug-and-release -opensource -platform win32-msvc2013 -opengl desktop, the jom.exe -j 10. With this configuration, it compiles very slow in QtWebEngine, takes about 3 hours and stopped when link QtWebEngineCored.dll, with error "out of memory". I see others got this "out of memory" before and solved by using "VS2013 x64 Cross Tools Command Prompt". But in my case, I am already using this command prompt. BTW, building the 3rd Party softwares in QtWebEngine is really slow, takes about 2 hours.
    2. configure -debug-and-release -opensource -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests -skip qtwebengine. The makefile does not report error while building, but after it finished, I checked the Qt5.7.0\qtbase\include, the are files in QtOpenGL, but empty in QtQuick, QtSvg, ... But I also need QtQuickView and other things.
      (I use similar configure command in linux (configure -opensource -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests -skip qtwebengine), it builds perfectly, with all header files I need in the include file)

    After building it for 4 days, I am now dizzy. Any ideas I can try next?
    I really need Qt with desktop OpenGL on Windows.

    J 1 Reply Last reply 13 Sept 2016, 04:26
    0
    • L lilyofvalley
      13 Sept 2016, 04:19

      The purpose to build Qt from source is to use desktop OpenGL.
      So if anyone can point out what I did wrong during dynamically setting OpenGL source (default ANGLE, I want to make it using desktop OpenGL), it will be very helpful ;) Using Qt pre-built installation package is much easier.

      1. I add QT_OPENGL as a new environment variable to Windows environment variables, set it to be "desktop", restart, does not work. Did I set it correctly or there is something else I need to do?
      2. In the program,
      #include <MyGLWidget.h>
      #include <QApplication>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          app.setAttribute(Qt::AA_UseDesktopOpenGL);
      
          MyGLWidget win;
          win.resize(640, 480);
          win.show();
          return app.exec();
      }
      

      I have read that we should set application attribute before instantiating QApplication, so I feel the code might be wrong. But I don't know how to do it correctly...(http://doc.qt.io/qt-5/windows-requirements.html)

      Build Qt5.7.0 from source on Windows 7:
      I have tried several times and met different problems, most of them point to QtWebEngine. Then I use "-skip qtwebengine", new problem appears.
      I will describe them in order.
      Installed Perl (ActivePerl), Python(3.5.2), Windows SDK, DirectX SDK.
      All the compiling use "VS2013 x64 Cross Tools Command Prompt":

      1. configure -debug-and-release -opensource -platform win32-msvc2013 -opengl desktop, the jom.exe -j 10. With this configuration, it compiles very slow in QtWebEngine, takes about 3 hours and stopped when link QtWebEngineCored.dll, with error "out of memory". I see others got this "out of memory" before and solved by using "VS2013 x64 Cross Tools Command Prompt". But in my case, I am already using this command prompt. BTW, building the 3rd Party softwares in QtWebEngine is really slow, takes about 2 hours.
      2. configure -debug-and-release -opensource -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests -skip qtwebengine. The makefile does not report error while building, but after it finished, I checked the Qt5.7.0\qtbase\include, the are files in QtOpenGL, but empty in QtQuick, QtSvg, ... But I also need QtQuickView and other things.
        (I use similar configure command in linux (configure -opensource -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests -skip qtwebengine), it builds perfectly, with all header files I need in the include file)

      After building it for 4 days, I am now dizzy. Any ideas I can try next?
      I really need Qt with desktop OpenGL on Windows.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 13 Sept 2016, 04:26 last edited by
      #2

      @lilyofvalley said in Dynamic OpenGL and Qt5.7.0 build from source on Windows 7 problem (most related to QtWebEngine):

      QtQuick, QtSvg

      QtQuick, QtSvg are in their own modules not inside qtbase.
      Also if something is not built you should check the output of your configure call to see whether those parts are disabled due to missing dependencies.

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

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lilyofvalley
        wrote on 13 Sept 2016, 05:28 last edited by
        #3

        I think after a successful build and install, the head files of QtQuick and QtSvg should be copied to qtbase\include\QtQuick and qtbase\include\QtSvg, also qtbase\lib, then other program will be able to find them through $$QTDIR \include and $$QTDIR \lib.
        Under linux, it did that.
        Under windows, should I manually copy them to the qtbase\include file?

        J 1 Reply Last reply 13 Sept 2016, 08:18
        0
        • L lilyofvalley
          13 Sept 2016, 05:28

          I think after a successful build and install, the head files of QtQuick and QtSvg should be copied to qtbase\include\QtQuick and qtbase\include\QtSvg, also qtbase\lib, then other program will be able to find them through $$QTDIR \include and $$QTDIR \lib.
          Under linux, it did that.
          Under windows, should I manually copy them to the qtbase\include file?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 13 Sept 2016, 08:18 last edited by
          #4

          @lilyofvalley No, you should not copy anything.
          Did you check the output of the configure call as I suggested before?

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

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 13 Sept 2016, 09:49 last edited by
            #5

            As documented - choosing the OpenGL implementation at runtime needs to be done before you instantiate the application object i.e.:

            QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
            QApplication app(argc, argv);
            

            As for building Qt - If you don't build web engine and only use desktop OpenGL you don't need Perl or DirectX SDK. You don't need to specify platform if you set up the environment right (run vcvarsall.bat). It's also a good idea to use a prefix build - gives you much smaller and cleaner directory at the end and puts everything where it needs to be (i.e. includes and libs). QtQuick and QtSvg are separate modules so the includes won't be in qtbase. They will be in qtdeclarative and qtsvg. Use the prefix build to gather all modules, like the official prebuilt package does.

            This is how I usually build it (takes ~30 minutes on my machine):

            //assume Qt source is in C:\Qt\src
            //assume you build in C:\Qt\build
            //assume you install to C:\Qt\msvc2013_64
            
            SET PATH=%PATH%;C:\Programs\Python27;C:\Programs\jom; //adjust the paths to your needs
            "C:\Programs\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 //change amd64 to x86 if you build for 32bit
            cd C:\Qt
            mkdir build
            mkdir msvc2013_64
            cd build
            ..\src\configure -prefix %CD%\..\msvc2013_64 -debug-and-release -mp -opensource -confirm-license -nomake examples -nomake tests -opengl desktop -skip webengine
            //configures...
            jom -j8
            //builds for about 30 minutes
            nmake install
            //copies what's needed to the output directory
            cd ..
            rmdir /q /s build
            
            L 1 Reply Last reply 13 Sept 2016, 20:18
            1
            • C Chris Kawa
              13 Sept 2016, 09:49

              As documented - choosing the OpenGL implementation at runtime needs to be done before you instantiate the application object i.e.:

              QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
              QApplication app(argc, argv);
              

              As for building Qt - If you don't build web engine and only use desktop OpenGL you don't need Perl or DirectX SDK. You don't need to specify platform if you set up the environment right (run vcvarsall.bat). It's also a good idea to use a prefix build - gives you much smaller and cleaner directory at the end and puts everything where it needs to be (i.e. includes and libs). QtQuick and QtSvg are separate modules so the includes won't be in qtbase. They will be in qtdeclarative and qtsvg. Use the prefix build to gather all modules, like the official prebuilt package does.

              This is how I usually build it (takes ~30 minutes on my machine):

              //assume Qt source is in C:\Qt\src
              //assume you build in C:\Qt\build
              //assume you install to C:\Qt\msvc2013_64
              
              SET PATH=%PATH%;C:\Programs\Python27;C:\Programs\jom; //adjust the paths to your needs
              "C:\Programs\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 //change amd64 to x86 if you build for 32bit
              cd C:\Qt
              mkdir build
              mkdir msvc2013_64
              cd build
              ..\src\configure -prefix %CD%\..\msvc2013_64 -debug-and-release -mp -opensource -confirm-license -nomake examples -nomake tests -opengl desktop -skip webengine
              //configures...
              jom -j8
              //builds for about 30 minutes
              nmake install
              //copies what's needed to the output directory
              cd ..
              rmdir /q /s build
              
              L Offline
              L Offline
              lilyofvalley
              wrote on 13 Sept 2016, 20:18 last edited by
              #6

              @Chris-Kawa Thank you so much for the detailed explanation. Help me understand how the build works. I am able to compile now and got the desirable result!

              1 Reply Last reply
              0

              1/6

              13 Sept 2016, 04:19

              • Login

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