-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Serious incompatibility problems w/ newer mingw-64 on Ubuntu #8653
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
Conversation
you may have to select the posix version of gcc-mingw-w64 and g++-mingw-w64 to cross-build the latest code on ubuntu
doc/build-windows.md
Outdated
| ./configure --prefix=`pwd`/depends/x86_64-w64-mingw32 | ||
| make | ||
|
|
||
| On Ununtu 15.10 and above, if your build fails because the cross-compiler does not seem to support C++11 threads (you get errors such as "httpserver.cpp:69:10: error: ‘mutex’ in namespace ‘std’ does not name a type) you may have to select the posix versions of gcc-mingw-w64 and g++-mingw-w64: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu
|
tested ACK it solved my issue #8511 |
|
There might still be a problem with bitcoin-qt.exe which I'm investigating. bitcoind.exe builds and works fine (tested on a VM and several windows boxes). Sorry about that. So far I have been able to test on Windows 10 only, so more feedback is welcome |
When cross compiling for Windows on Ubuntu 15.10 and above, you may need to disable hardening if bitcoin-qt.exe fails to start properly
|
|
||
| And select the posix version of the compiler. | ||
|
|
||
| You may also need to disable "hardening" of compiled binaries if your bitcoin-qt.exe does not start properly by adding the --disable-hardening option when calling the configure script: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What, are you sure about this?
Can you be more specific about this problem? I'd prefer figuring out what the issue is and never telling people to disable hardening. The situation on windows is bad enough as it is (#8248). Note that the gitian executables are built with hardening enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not being specific enough: with hardening enabled, bitcoint-qt.exe does not start (it crashes on startup), but bitcoind.exe seems to work fine.
With hardening disabled, bitcoin-qt.exe starts and seems to work fine AFAICT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do remove this recommendation. You should never tell anyone in good conscience to disable hardening on a bitcoin wallet. Those security precautions exists with a good reason. Oh absolutely it will seem to "work fine" but you lose any protection against exploitation, if, say, another buffer overflow turns up in UPnP or openssl or any other library.
If it doesn't work with hardening then you need to debug why it doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I was thinking mostly about people who might need to cross-build quickly for testing purposes and overlooked the fact that people might use the binaries as their real wallet instead of downloading an official release or using gitian to build. I should probably close this PR and open a new specific issue ?
|
Very strong NACK on telling people to disable hardening, ACK on the posix alternatives. |
|
Agree with @laanwj. Also, the disable hardening recommendation comes without a specific reason. Does the posix compatible mingw compiler breaks the Qt build? If so, why exactly? |
|
|
||
| You may also need to disable "hardening" of compiled binaries if your bitcoin-qt.exe does not start properly by adding the --disable-hardening option when calling the configure script: | ||
|
|
||
| ./configure --disable-hardening --prefix=`pwd`/depends/x86_64-w64-mingw32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why --disable-hardening ?
|
To see if I could reproduce I did this:
While doing this I indeed saw some logging output about gcc alternatives: I wonder which one was selected by default. Apparently the -win32 variant, not the POSIX one.
|
|
Whoa this even worse than I imagined. Above I already report that Yes, you read that correctly: the content length is 'zu'. ZU! Also, bitcoind isn't stable, it crashed at least once. Unfortunately I didn't get a useful traceback.
|
|
The issue with bitcoin-cli looks like https://sourceforge.net/p/levent/bugs/363/ which is linked to mingw (but not its POSIX mode specifically) |
|
OK I've done some research. In principle,
This is an Ubuntu-specific problem: the "gthreads" (GCC threads) library is not linked into libcxx. On Trusty this is not an issue as gthreads is provided:
There is a https://github.com/meganz/mingw-std-threads which some people use to work around this problem. But in principle I think Ubuntu should solve this upstream. |
|
I have verified that after reverting the C++11 threads changes (https://github.com/laanwj/bitcoin/tree/2016_09_windows_hell), it builds normally with the default -win32 compiler. However:
This issue doesn't go away either, unfortunately. |
|
FWIW, applying the libevent patch above does seem to fix bitcoin-cli.exe |
|
Looks like So apparently there are three, at most tangentially related issues regarding Windows:
I wonder when each of these issues started. My only recommendation for now is: use an Ubuntu Trusty VM for windows cross-compilation |
Interesting. I wonder what happened in the meantime, I just checked and the 0.13.0 executables don't suffer from this issue. There have been no libevent version changes in depends since then (we've always been using 2.0.22). So it must be an issue with the combination of the new compiler and libevent. I'm a bit afraid that the patch, if we were to apply it to depends, will introduce a similar issue (but backwards) on Trusty instead. But we can try and test. |
|
@laanwj where can I get a copy of your patches? I can build them in Ubuntu 16.04 and then test them on Windows 10. |
Add a patch that seems to be necessary for compatibilty of libevent 2.0.22 with recent mingw-w64 gcc versions (at least GCC 5.3.1 from Ubuntu 16.04). Without this patch the Content-Length in the HTTP header ends up as `Content-Length: zu`, causing communication between the RPC client and server to break down. See discussion in bitcoin#8653. Source: https://sourceforge.net/p/levent/bugs/363/ Thanks to @sstone for the suggestion.
|
FYI, I'm working on a large-scale toolchain refactor for depends so that we have more control over these things. Will report here when it's ready for testing. |
|
Closing this, I've copied all the important info into the #8732 |
…and Ubuntu 17.04 696ce46 [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04 (fanquake) 4f890ba Add new step to clean $PATH var by removing /mnt specific Window's %PATH% paths that cause issues with the make system (Donal OConnor) Pull request description: This updates the Windows build documentation with the workaround required to build using Ubuntu 17.04 on WSL, and makes it's explicit that building on Ubuntu 16.04 is broken, and not recommended. This includes a commit from @donaloconnor in #11244, and is mostly the investigative work of @laanwj throughout #8732, #8653 and quite a few other issues. I tested building on 14.04, 16.04.3 and 17.04 [here](#11244 (comment)) and got the results we expect. --- Built master at c22a53c on a Windows 10 VM (Version 1607, OS Build 14393.1593) using WSL with Ubuntu 14.04.  Upgraded WSL to 16.04.3, and tried building c22a53c using these instructions. The result is as expected.  Upgraded WSL to 17.04 and tried building 3255d63 using these instructions.  If someone else could also verify that builds are working on both 14.04 and 17.04 with these instructions, that would be great. Tree-SHA512: 866f1003eb45d208d8ae849504f54fc2f27c32240129d2124ce5a2ee7167bcbf062d29f23b1745123f532ffd0253a8611e719b2a316d1331d3c3924f91e7775d
7383d77 Updated instructions for Windows 10 Fall Creators Update. (Aaron Clauson) e0fc4a7 Updated Windows build doc for WSL/Xenial workarounds. (Aaron Clauson) Pull request description: An update to the Windows build document that provides workarounds for the broken 64 bit mingw32 cross compiler on WSL/Xenial. This update is an alternative to pull request #11437. While that pull request takes a valid approach by stating building on WSL should be avoided I think it is more useful to give Windows developers a workaround option. The instructions have been tested on: - Ubuntu 14.04 and 64 bit mingw32 tool chain - Ubuntu 16.04 and 64 bit mingw32 tool chain - Ubuntu 17.04 and 64 bit mingw32 tool chain - Windows Subsystem for Linux (Windows 10 OS Build 15063.608) and 32 bit mingw32 tool chain - Windows Subsystem for Linux (Windows 10 OS Build 15063.608) and 64 bit mingw32 tool chain Related items: - Serious incompatibility problems w/ newer mingw-64 on Ubuntu #8653 - `-fstack-protector-all` triggers crashes in mingw-w64 5.3.1 #8732 - Windows build appears broken on WSL (buntu okay) #10269 - Compilation error for windows target #11437 Tree-SHA512: 7c937e37ed7120ae5dcf61aba50e5228a7ed6f729647c724b8f48e7cbbd81366c1a83a818618766a8fe0418425e05ba2eba2b14f2616621c58606585444f45fc
* depends: fix fontconfig with newer glibc See comment for more detail * Create dependencies.md, and link dependencies file from README & build docs * [Docs] Fix broken Markdown table in dependencies.md. Cleanups. Use the correct capitalization for the dependencies Sort dependencies Fix header formatting. Minor style cleanups. * Add required package dependencies for depends cross compilation [skip-ci] * [depends] expat 2.2.5 * [depends] ccache 3.4.1 * [depends] miniupnpc 2.0.20180203 * Update mac_alias to 2.0.7 * fixme: depends: Add D_DARWIN_C_SOURCE to miniupnpc CFLAGS * update config.guess and config.sub to latest version * [depends] Fix Qt compilation with Xcode 8 * [depends] ZeroMQ 4.2.2 * [depends] Qt 5.7.1 * [depends] Don't build libevent sample code * [depends] native_ds_store 1.1.2 * depends: fix zmq build with mingw < 4.0 * depends: fix libzmq's needless linking against libstdc++ This is broken for a number of reasons, including: - g++ understands "-static-libstdc++ -lstdc++" to mean "link against whatever libstdc++ exists, probably shared", which in itself is buggy. - another stdlib (libc++ for example) may be in use * [depends] Allow depends system to support armv7l * depends: fix qt translations build Their buildsystem insists on using the installed ltranslate, but gets confused about how to find it. Since we manually control the build order, just drop the dependency. * depends: qt: disable printer for all platforms, not just osx This also fixes the native osx build. * depends: add a zlib build qt5.7 changed the location of some of its symbols, creating a circular dependency in Qt5Core. Rather than trying to fix that up, build our own zlib rather than having it built for us. * qt: fix build with zlib for target This contains a few hacks very specific to Qt's buildsystem. These can be reverted once we split the build between native and target builds. Qt's build contains a circular dependency when not using a system zlib. By far the easiest fix is to switch to a system zlib, rather than Qt's own. However, that confuses Qt's cross build which assumes that when using a system zlib, it should also find a system (native) zlib for native tools. The build breaks if that zlib is not present. To solve this: 1. Always use a system zlib rather than the one provided by qt 2. Set force_bootstrap, which instructs the build tools to be built as though we're cross-compiling (build != target) 3. For build tools, use qt's internal zlib so that a native zlib is not required. Step 3 means that if any zlib headers are found by the native build, it will confuse Qt's internal zlib build. So we also need to make sure that the target headers/libs aren't found. To do so, specify that our cflags/cxxflags/cppflags/ldflags only apply for non-host builds. * [depends] dbus 1.10.18 * [Depends] Fix Qt build with Xcode 9.2 * depends: zeromq 4.2.3 * depends: patch pthread_set_name_np out of zeromq * depends: Fix Qt build with XCode 9.3 * depends: Add libevent compatibility patch for windows Add a patch that seems to be necessary for compatibilty of libevent 2.0.22 with recent mingw-w64 gcc versions (at least GCC 5.3.1 from Ubuntu 16.04). Without this patch the Content-Length in the HTTP header ends up as `Content-Length: zu`, causing communication between the RPC client and server to break down. See discussion in bitcoin#8653. Source: https://sourceforge.net/p/levent/bugs/363/ Thanks to @sstone for the suggestion. * [depends] Set OSX_MIN_VERSION to 10.8 * depends: use new variable layout for qt sdk * [depends] Boost 1.64.0 * [depends] libevent 2.1.8-stable * depends: Add 'make clean' and 'make clean-all' rules It's useful to have a standard way to clean up the work done by the depends system when testing changes to it. The `make clean-all` rule removes build artifacts for all supported architectures (in addition to sources/), while `make clean` only removes artifacts for current architecture (`BUILD`). * [depends] bump nativce_ccache to 3.4.2 * [depends] remove libevent patches (not needed since 2.1.7rc) * [depends] Fix zeromq make step * [depends] Remove OBJCXX define from config.site.in * [depends] fontconfig 2.12.1 * [depends] FreeType 2.7.1 * Update doc/dependencies.md
…ng WSL and Ubuntu 17.04 696ce46 [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04 (fanquake) 4f890ba Add new step to clean $PATH var by removing /mnt specific Window's %PATH% paths that cause issues with the make system (Donal OConnor) Pull request description: This updates the Windows build documentation with the workaround required to build using Ubuntu 17.04 on WSL, and makes it's explicit that building on Ubuntu 16.04 is broken, and not recommended. This includes a commit from @donaloconnor in bitcoin#11244, and is mostly the investigative work of @laanwj throughout bitcoin#8732, bitcoin#8653 and quite a few other issues. I tested building on 14.04, 16.04.3 and 17.04 [here](bitcoin#11244 (comment)) and got the results we expect. --- Built master at bitcoin@c22a53c on a Windows 10 VM (Version 1607, OS Build 14393.1593) using WSL with Ubuntu 14.04.  Upgraded WSL to 16.04.3, and tried building bitcoin@c22a53c using these instructions. The result is as expected.  Upgraded WSL to 17.04 and tried building bitcoin@3255d63 using these instructions.  If someone else could also verify that builds are working on both 14.04 and 17.04 with these instructions, that would be great. Tree-SHA512: 866f1003eb45d208d8ae849504f54fc2f27c32240129d2124ce5a2ee7167bcbf062d29f23b1745123f532ffd0253a8611e719b2a316d1331d3c3924f91e7775d
you may have to select the posix version of gcc-mingw-w64 and g++-mingw-w64 to cross-build the latest code on ubuntu