godot: Cross compiling windows with ubuntu fails on etc2comp build

Master branch

sudo apt-get install mingw-w64

scons p=windows

It stopped working ~5-10 days ago.

thirdparty/etc2comp/EtcImage.cpp: In member function 'Etc::Image::EncodingStatus Etc::Image::Encode(Etc::Image::Format, Etc::ErrorMetric, float, unsigned int, unsigned int)':
thirdparty/etc2comp/EtcImage.cpp:259:64: error: invalid use of incomplete type 'class std::future<void>'
   std::future<void> *handle = new std::future<void>[a_uiMaxJobs];
                                                                ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:268:12: error: invalid use of incomplete type 'class std::future<void>'
    handle[i] = async(std::launch::async, &Image::RunFirstPass, this, i, uiNumThreadsNeeded);
            ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:268:91: error: invalid use of incomplete type 'class std::future<void>'
 ndle[i] = async(std::launch::async, &Image::RunFirstPass, this, i, uiNumThreadsNeeded);
                                                                                      ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:275:12: error: invalid use of incomplete type 'class std::future<void>'
    handle[i].get();
            ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:275:13: error: invalid use of incomplete type 'class std::future<void>'
    handle[i].get();
             ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:330:107: error: invalid use of incomplete type 'class std::future<unsigned int>'
 gned int> *handleToBlockEncoders = new std::future<unsigned int>[uiNumThreadsNeeded-1];
                                                                                      ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:334:30: error: invalid use of incomplete type 'class std::future<unsigned int>'
       handleToBlockEncoders[i] = async(std::launch::async, &Image::IterateThroughWorstBlocks, this, blocksToIterateThisPass, i, uiNumThreadsNeeded);
                              ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:334:147: error: invalid use of incomplete type 'class std::future<unsigned int>'
 mage::IterateThroughWorstBlocks, this, blocksToIterateThisPass, i, uiNumThreadsNeeded);
                                                                                      ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:340:50: error: invalid use of incomplete type 'class std::future<unsigned int>'
       uiIteratedBlocks += handleToBlockEncoders[i].get();
                                                  ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:340:51: error: invalid use of incomplete type 'class std::future<unsigned int>'
       uiIteratedBlocks += handleToBlockEncoders[i].get();
                                                   ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:343:15: warning: possible problem detected in invocation of delete [] operator: [-Wdelete-incomplete]
      delete[] handleToBlockEncoders;
               ^~~~~~~~~~~~~~~~~~~~~
thirdparty/etc2comp/EtcImage.cpp:330:33: warning: 'handleToBlockEncoders' has incomplete type
      std::future<unsigned int> *handleToBlockEncoders = new std::future<unsigned int>[uiNumThreadsNeeded-1];
                                 ^~~~~~~~~~~~~~~~~~~~~
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<unsigned int>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:343:15: note: neither the destructor nor the class-specific operator delete [] will be called, even if they are declared when the class is defined
      delete[] handleToBlockEncoders;
               ^~~~~~~~~~~~~~~~~~~~~
thirdparty/etc2comp/EtcImage.cpp:356:12: error: invalid use of incomplete type 'class std::future<void>'
    handle[i] = async(std::launch::async, &Image::SetEncodingBits, this, i, a_uiJobs);
            ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:356:84: error: invalid use of incomplete type 'class std::future<void>'
    handle[i] = async(std::launch::async, &Image::SetEncodingBits, this, i, a_uiJobs);
                                                                                    ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:362:12: error: invalid use of incomplete type 'class std::future<void>'
    handle[i].get();
            ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:362:13: error: invalid use of incomplete type 'class std::future<void>'
    handle[i].get();
             ^
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:369:12: warning: possible problem detected in invocation of delete [] operator: [-Wdelete-incomplete]
   delete[] handle;
            ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:259:22: warning: 'handle' has incomplete type
   std::future<void> *handle = new std::future<void>[a_uiMaxJobs];
                      ^~~~~~
In file included from thirdparty/etc2comp/EtcImage.cpp:40:0:
/usr/lib/gcc/i686-w64-mingw32/6.2-win32/include/c++/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~
thirdparty/etc2comp/EtcImage.cpp:369:12: note: neither the destructor nor the class-specific operator delete [] will be called, even if they are declared when the class is defined
   delete[] handle;
            ^~~~~~

Edit Kubuntu 17.04 gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 23 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I found the trouble: by default mingw on ubuntu works in win32 mode (which doesn’t support thread), if you compile with posix mode it works.

To use posix mode for mingw by default:

$ sudo update-alternatives --config x86_64-w64-mingw32-gcc
<choose x86_64-w64-mingw32-gcc-posix from the list>
$ sudo update-alternatives --config x86_64-w64-mingw32-g++
<choose x86_64-w64-mingw32-g++-posix from the list>

It maybe worth a line in the documentation, what do you think ?

same issue on gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Does it fail only when cross-compiling to win32, or also to win64?

Apparently both, as @Keetz had the same issue for win64: https://pastebin.com/vsdXEifT