Skip to content

doc: Windows WSL build recommendation to temporarily disable Win32 PE support - #19408

Merged
laanwj merged 1 commit into
bitcoin:masterfrom
sipsorcery:wsldoc
Jul 1, 2020
Merged

laanwj merged 1 commit into
bitcoin:masterfrom
sipsorcery:wsldoc

Conversation

@sipsorcery

Copy link
Copy Markdown
Contributor

This is a solution for the issues described in #17277 and #18348

When cross compiling Bitcoin Code for Windows the Autoconf configure scripts attempt to execute Win32 PE files. The configure scripts expect the attempt to fail, however, WSL supports forking the execution of Win32 PE files out to the underlying Windows OS. This can result in the executions failing for unanticipated reasons, which is the case in the two referenced issues.

This PR adds an explanatory note and additional instructions to temporarily disable WLS's Win32 support.

@fanquake fanquake added the Docs label Jun 29, 2020
@laanwj

laanwj commented Jun 29, 2020 •

Copy link
Copy Markdown
Member

I think this is okay for a temporary workaround, but in time, I think a fix to the build system to not ry to run target executables when cross-compiling would be way preferable.
(every manual step added has a potential for human error)

@billygarrison

Copy link
Copy Markdown
Contributor

I can confirm that this fixed issue #18348 for me.

Tested using Ubuntu 18.04 and 20.04 on WSL.

@sipsorcery

Copy link
Copy Markdown
Contributor Author

I think this is okay for a temporary workaround, but in time, I think a fix to the build system to not [t]ry to run target executables when cross-compiling would be way preferable.

I agree but that would most likely mean ditching Autoconf (or at least the configure scripts) for something more modern.

I only looked at the configure script operation for the bdb dependency but I'd be surprised if the other dependencies weren't the same. There were numerous configure checks that compiled a small block of code and then checked the result of the execution attempt.

@laanwj

laanwj commented Jul 1, 2020 •

Copy link
Copy Markdown
Member

There were numerous configure checks that compiled a small block of code and then checked the result of the execution attempt.

Which is okay! It's allowed to use the (cross-)compiler for compiling, linking, doing anything with the result. Just not running it. I think only berkeleydb does this, because it uses an ancient autoconf with a weird check. In bdb 4.8 times, cross-compiling was still seen as a rare exceptoin. I would be very surprised if any new software does this.

Edit: Bleh, seems you're right. Even current autotools still does this, this is from bitcoind itself not berkeleydb:

configure:4130: checking whether we are cross compiling
configure:4138: arm-unknown-linux-gnueabihf-g++ -o conftest -pipe -O2  -I/data/src/bitcoin-arm/depends/arm-unknown-linux-gnueabihf/share/../include/ -O2 -g -L/data/src/bitcoin-arm/depends/arm-unknown-linux-gnueabihf/share/../lib -static-libstdc++ conftest.cpp  >&5
configure:4142: $? = 0
configure:4149: ./conftest
./configure: line 4151: ./conftest: cannot execute binary file: Exec format error

@laanwj

laanwj commented Jul 1, 2020

Copy link
Copy Markdown
Member

ACK 21a6575

@laanwj
laanwj merged commit 85a6895 into bitcoin:master Jul 1, 2020
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Dec 7, 2020
…able Win32 PE support

5139143 Add Windows WSL build recommendation to temporarily disable Win32 PE support. (Aaron Clauson)

Pull request description:

  This is a cherry-pick from Bitcoin upstream.

  bitcoin#19408
  ```
  This is a solution for the issues described in bitcoin#17277 and bitcoin#18348

  When cross compiling Bitcoin Code for Windows the Autoconf configure scripts attempt to execute Win32 PE files. The configure scripts expect the attempt to fail, however, WSL supports forking the execution of Win32 PE files out to the underlying Windows OS. This can result in the executions failing for unanticipated reasons, which is the case in the two referenced issues.

  This PR adds an explanatory note and additional instructions to temporarily disable WLS's Win32 support.
  ```

  Anyways I am making a pull request for this as it would be nice to be able to cross-compile pivx using the docs in the repo instead of checking bitcoin upstream for fixes and such.

ACKs for top commit:
  Fuzzbawls:
    ACK 5139143
  random-zebra:
    utACK 5139143 and merging...

Tree-SHA512: 13ae4f19dc3a0b327f689ab5fa5e0c97fea748c2eb88192a847959262edc70d6d21e6cdc3ea8fe24fa897b3c6d727e6a494f4140c13c5dfbfc3d58c5d263da7a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants