Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross compiling windows with ubuntu fails on etc2comp build #9258

Closed
AlexHolly opened this issue Jun 18, 2017 · 23 comments
Closed

Cross compiling windows with ubuntu fails on etc2comp build #9258

AlexHolly opened this issue Jun 18, 2017 · 23 comments

Comments

@AlexHolly
Copy link
Contributor

AlexHolly commented Jun 18, 2017

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

@akien-mga
Copy link
Member

Ubuntu and mingw versions?

@akien-mga akien-mga changed the title Cross compiling windows with ubuntu Cross compiling windows with ubuntu fails on etc2comp build Jun 24, 2017
@akien-mga akien-mga added this to the 3.0 milestone Jun 24, 2017
@akien-mga
Copy link
Member

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

akien-mga referenced this issue Jun 30, 2017
Remove rg-etc1 code. Also updated travis to use ubuntu 14.04.

Fixes #8457.
@akien-mga
Copy link
Member

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

@akien-mga
Copy link
Member

Trying on Mageia, it builds fine both in 32-bit and 64-bit (I built with the changes of #9455, but I don't expect they would have an influence on this issue).

MinGW-w64 5.0.1 with GCC 6.1.0.

@akien-mga
Copy link
Member

It also builds fine on Travis CI btw, with this system:
Ubuntu 14.04.3, MinGW-w64 3.1.0 with GCC 4.8.2.

So I'm not sure why it wouldn't work with versions in between like you have.

@ippan
Copy link
Contributor

ippan commented Jul 5, 2017

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

@akien-mga
Copy link
Member

akien-mga commented Jul 5, 2017

The fix is to change distro. So far it seems to fail only on Ubuntu :P </troll>

@Xrayez
Copy link
Contributor

Xrayez commented Jul 12, 2017

Are you guys using WSL (windows subsystem for linux) to compile Godot for Windows? I'm having the same issue here.

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Windows 10 version 1703 build 15063.483

@touilleMan
Copy link
Member

Same issue here with Ubuntu 16.04 with i686-w64-mingw32-gcc (GCC) 5.3.1 20160211 :'-(

@touilleMan
Copy link
Member

touilleMan commented Jul 16, 2017

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 ?

@AlexHolly
Copy link
Contributor Author

Hmm still not working.
I also get this message when I switch something.

update-alternatives: warning: skip creation of /usr/bin/x86_64-w64-mingw32-gcc-6 because associated file /usr/bin/x86_64-w64-mingw32-gcc-6-posix (of link group x86_64-w64-mingw32-gcc) doesn't exist

@sketchyfun
Copy link
Contributor

I was having the same problem on Ubuntu, but I managed to get it working by including bits=64 in the scons command

@Xrayez
Copy link
Contributor

Xrayez commented Jul 18, 2017

@sketchyfun I had the same issue compiling it with either 32 or 64 bits. Changing to posix mode with the above method solved it for me.

@sketchyfun
Copy link
Contributor

@Xrayez I tried that, but I received the same error as @AlexHolly. Either way, hopefully a combination of this information will be of help to other people :)

@AlexHolly
Copy link
Contributor Author

  1. Use @touilleMan solution an switch to posix
  2. Use @sketchyfun solution and run with scons p=windows bits=64

It works again, thanks.

Is there a bug in the scons or why is it not using bits=64 as default on a 64bit system?

@Keetz
Copy link
Contributor

Keetz commented Jul 18, 2017

@AlexHolly in my experience it is only p=windows that doesn't use 64 bits as default. Whenever i build to x11 it defaults to 64 bits just fine.

@akien-mga
Copy link
Member

The bits logic on Windows is pretty convoluted, both for MinGW and for MSVC, so no idea why it defaults to 32-bit. At least it seems to try to detect 64-bit so I guess it's a bug.

@vnen
Copy link
Member

vnen commented Jul 19, 2017

I believe the logic is only for MSVC, because it requires the proper compiler to be already set up. With MinGW you can have both compilers available and select the right one by changing the prefix.

@reduz
Copy link
Member

reduz commented Aug 7, 2017

so, issue or not?

@akien-mga
Copy link
Member

akien-mga commented Oct 23, 2017

Got a report on Discord of someone running into this issue on Lubuntu (version unknown) with MinGW-w64 4.0.4.

Looks like that version is buggy, so the fix would be: get a newer mingw.
Edit: There's a workaround documented above: #9258 (comment)

@tofutim
Copy link

tofutim commented Mar 26, 2018

does anyone know if it is possible to switch to posix in shell without manually entering the number?

@AlexHolly
Copy link
Contributor Author

If you try to build some CI you should try to use a proper docker-container where this is not needed.
This one works for me FROM debian:jessie

If not this should work.

RUN echo "1"| sudo update-alternatives --config x86_64-w64-mingw32-gcc
RUN echo "1"| sudo update-alternatives --config x86_64-w64-mingw32-g++

@nathanfranke
Copy link
Contributor

does anyone know if it is possible to switch to posix in shell without manually entering the number?

This should work:

sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests