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. docker build failed: Cannot open include file: 'type_traits': No such file or directory
Forum Updated to NodeBB v4.3 + New Features

docker build failed: Cannot open include file: 'type_traits': No such file or directory

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 3 Posters 8.6k Views
  • 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.
  • U Offline
    U Offline
    user2301
    wrote on last edited by
    #1

    I am trying to build qt application inside docker. I have visual studio 2015 build tools and QT 5.11.2 installed docker image. When I try to docker build qt application, I get this error.

    C:\Qt\5.11.2\msvc2015_64\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
    

    When I checked for this file 'type_traits', inside docker it exists inside this path

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    

    Below is my docker file:
    Why the qt is not able to find the file even though it exists?

    FROM qt
    
    COPY ["./", "C:/app"]
    
    RUN $env:PATH ='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;' + $env:PATH;\
        [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
    
    RUN $env:PATH ='C:\Qt\5.11.2\msvc2015_64\bin;' + $env:PATH;\
       [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
    
    RUN $env:PATH ='C:\Qt\Tools\QtCreator\bin\jom.exe;' + $env:PATH;\
       [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
    
    RUN $env:PATH ='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;' + $env:PATH;\
        [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
    
    WORKDIR C:\\app
    RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
    
    RUN ["qmake", "app.pro", "-spec win32-msvc", "CONFIG+=debug", "CONFIG+=qml_debug"]  
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe qmake_all
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe  
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe install 
    RUN qmake app.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"  
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe qmake_all 
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe   
    RUN C:\Qt\Tools\QtCreator\bin\jom.exe install
    RUN mkdir dist\debug_build\app_dist
      
    RUN xcopy app_dist\dist_redist\*.* dist\debug_build\app_dist /E /Y >NUL
    
    CMD cmd
    
    JonBJ 1 Reply Last reply
    0
    • U user2301

      I am trying to build qt application inside docker. I have visual studio 2015 build tools and QT 5.11.2 installed docker image. When I try to docker build qt application, I get this error.

      C:\Qt\5.11.2\msvc2015_64\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
      

      When I checked for this file 'type_traits', inside docker it exists inside this path

      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
      

      Below is my docker file:
      Why the qt is not able to find the file even though it exists?

      FROM qt
      
      COPY ["./", "C:/app"]
      
      RUN $env:PATH ='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;' + $env:PATH;\
          [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
      
      RUN $env:PATH ='C:\Qt\5.11.2\msvc2015_64\bin;' + $env:PATH;\
         [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
      
      RUN $env:PATH ='C:\Qt\Tools\QtCreator\bin\jom.exe;' + $env:PATH;\
         [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
      
      RUN $env:PATH ='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;' + $env:PATH;\
          [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
      
      WORKDIR C:\\app
      RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
      
      RUN ["qmake", "app.pro", "-spec win32-msvc", "CONFIG+=debug", "CONFIG+=qml_debug"]  
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe qmake_all
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe  
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe install 
      RUN qmake app.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"  
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe qmake_all 
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe   
      RUN C:\Qt\Tools\QtCreator\bin\jom.exe install
      RUN mkdir dist\debug_build\app_dist
        
      RUN xcopy app_dist\dist_redist\*.* dist\debug_build\app_dist /E /Y >NUL
      
      CMD cmd
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @user2301
      In some shape or form, you need to verify that C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include (if that's where you say type_traits file is) is either on your INCLUDE environment variable, or possibly via /I command-line to the C++ compiler, when called from the qmake.

      If you find that the
      RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
      sets up the environment variables, you need to verify that these still exist when you execute the seemingly-separate
      RUN ["qmake", "app.pro", "-spec win32-msvc", "CONFIG+=debug", "CONFIG+=qml_debug"]
      line.

      I'm not sure whether this works, but maybe inserting a
      RUN ["cmd", "/c", "set"]
      between those two lines will tell you.

      U 1 Reply Last reply
      0
      • JonBJ JonB

        @user2301
        In some shape or form, you need to verify that C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include (if that's where you say type_traits file is) is either on your INCLUDE environment variable, or possibly via /I command-line to the C++ compiler, when called from the qmake.

        If you find that the
        RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
        sets up the environment variables, you need to verify that these still exist when you execute the seemingly-separate
        RUN ["qmake", "app.pro", "-spec win32-msvc", "CONFIG+=debug", "CONFIG+=qml_debug"]
        line.

        I'm not sure whether this works, but maybe inserting a
        RUN ["cmd", "/c", "set"]
        between those two lines will tell you.

        U Offline
        U Offline
        user2301
        wrote on last edited by user2301
        #3

        @JonB I could see these paths set in the enviornment variable Path= C:\Qt\5.11.2\msvc2015_64\bin; C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
        What other enviornment variables needs to be set?

        Step 7/9 : RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
         ---> Running in 15de2bb7daf3
        Removing intermediate container 15de2bb7daf3
         ---> dbed1a57e911
        Step 8/9 : RUN ["cmd", "/c", "set"]
         ---> Running in 17436be2f213
        ALLUSERSPROFILE=C:\ProgramData
        APPDATA=C:\Users\ContainerAdministrator\AppData\Roaming
        CommonProgramFiles=C:\Program Files\Common Files
        CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
        CommonProgramW6432=C:\Program Files\Common Files
        COMPUTERNAME=17436BE2F213
        ComSpec=C:\Windows\system32\cmd.exe
        JAVA_HOME=c:\jre1.8.0_91
        JENKINS_HOME=c:\jenkins
        LOCALAPPDATA=C:\Users\ContainerAdministrator\AppData\Local
        NUMBER_OF_PROCESSORS=2
        OS=Windows_NT
        Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\svn\bin;c:\jre1.8.0_91\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\Qt\5.11.2\msvc2015_64\bin;
        PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
        PROCESSOR_ARCHITECTURE=AMD64
        PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 63 Stepping 0, GenuineIntel
        PROCESSOR_LEVEL=6
        PROCESSOR_REVISION=3f00
        ProgramData=C:\ProgramData
        ProgramFiles=C:\Program Files
        ProgramFiles(x86)=C:\Program Files (x86)
        ProgramW6432=C:\Program Files
        PROMPT=$P$G
        PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
        PUBLIC=C:\Users\Public
        SystemDrive=C:
        SystemRoot=C:\Windows
        TEMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
        TMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
        USERDOMAIN=User Manager
        USERNAME=ContainerAdministrator
        USERPROFILE=C:\Users\ContainerAdministrator
        VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
        windir=C:\Windows
        
        JonBJ 1 Reply Last reply
        0
        • U user2301

          @JonB I could see these paths set in the enviornment variable Path= C:\Qt\5.11.2\msvc2015_64\bin; C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
          What other enviornment variables needs to be set?

          Step 7/9 : RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
           ---> Running in 15de2bb7daf3
          Removing intermediate container 15de2bb7daf3
           ---> dbed1a57e911
          Step 8/9 : RUN ["cmd", "/c", "set"]
           ---> Running in 17436be2f213
          ALLUSERSPROFILE=C:\ProgramData
          APPDATA=C:\Users\ContainerAdministrator\AppData\Roaming
          CommonProgramFiles=C:\Program Files\Common Files
          CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
          CommonProgramW6432=C:\Program Files\Common Files
          COMPUTERNAME=17436BE2F213
          ComSpec=C:\Windows\system32\cmd.exe
          JAVA_HOME=c:\jre1.8.0_91
          JENKINS_HOME=c:\jenkins
          LOCALAPPDATA=C:\Users\ContainerAdministrator\AppData\Local
          NUMBER_OF_PROCESSORS=2
          OS=Windows_NT
          Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\svn\bin;c:\jre1.8.0_91\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\Qt\5.11.2\msvc2015_64\bin;
          PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
          PROCESSOR_ARCHITECTURE=AMD64
          PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 63 Stepping 0, GenuineIntel
          PROCESSOR_LEVEL=6
          PROCESSOR_REVISION=3f00
          ProgramData=C:\ProgramData
          ProgramFiles=C:\Program Files
          ProgramFiles(x86)=C:\Program Files (x86)
          ProgramW6432=C:\Program Files
          PROMPT=$P$G
          PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
          PUBLIC=C:\Users\Public
          SystemDrive=C:
          SystemRoot=C:\Windows
          TEMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
          TMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
          USERDOMAIN=User Manager
          USERNAME=ContainerAdministrator
          USERPROFILE=C:\Users\ContainerAdministrator
          VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
          windir=C:\Windows
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @user2301
          No! You are showing an include directory being on your PATH environment variable! That is wrong, and useless. Such directories need to be on an INCLUDE environment variable. (And libraries on a LIBS environment variable.) You need to read up on which such variables are used where....

          U 1 Reply Last reply
          0
          • JonBJ JonB

            @user2301
            No! You are showing an include directory being on your PATH environment variable! That is wrong, and useless. Such directories need to be on an INCLUDE environment variable. (And libraries on a LIBS environment variable.) You need to read up on which such variables are used where....

            U Offline
            U Offline
            user2301
            wrote on last edited by
            #5

            @JonB Okay yeah got it. When I did docker exec on base image which contains visual studio tool and called vcvarsall.bat. It executed and I could see all the enviornment variables set by vcvarsall.bat

            But dont know why this is instruction not setting any enviornment variables,

            RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
            
            JonBJ 1 Reply Last reply
            0
            • U user2301

              @JonB Okay yeah got it. When I did docker exec on base image which contains visual studio tool and called vcvarsall.bat. It executed and I could see all the enviornment variables set by vcvarsall.bat

              But dont know why this is instruction not setting any enviornment variables,

              RUN ["C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat", "x86_amd64"]
              
              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @user2301
              That's what I was thinking would be the case, any why I told you to try a RUN ["cmd", "/c", "set"] after it to show what the actual state of environment variables is.

              In Windows/DOS (and in Linux too), environment variables set in a shell only last as long as that shell (and any processes it spawns). So if your RUN command spawns a new shell for each command and exits it each time, those variables won't have been set for a subsequent RUN ["qmake"]. (And if that's true, maybe it only works on your earlier PATH changes because RUN $env:PATH does something special with that leading $env?)

              So you need to look up how you're supposed to achieve this environment variable changing stuff from a Docker script or whatever.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tataeress
                wrote on last edited by
                #7

                i had the same problem in visual studio 2019 community with Qt 6.0.0
                after, searching every forum etc.. and trying the install of visual studio 2015 build tools x64 and visual studio redistrubutable 2015 x64 which didn't solve the problem too
                i tried updating windows sdk version from 10.0.18362.0 to 10.0.19041.0 which i though i should not at first cause it may work with the 6.0.1 qt version and 6.0.0 and then problem was SOLVED.
                i'm currently using visual studio community 4.8.03761 if that might help others
                so just check that you have window sdk version 10 updated ( EVEN IF YOU THINK YOU DONT EVEN NEED IT) and that your compiler is well chosen. ( i had mvsc2019_64 and work with LLVM etc.. version in build settings)
                hopefully this helps you guys.

                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