Repository navigation
Description
Expected behavior
I should be able to make the depends without an error.
Actual behavior
The program extracts BDB, preprocesses BDB, and configures BDB (I think), then goes into a long list of "checking" lines (e.g. checking for fopen... yes).
The output shows checking for clock_gettime monotonic clock... then the error message below pops up (The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem.)
I click okay and it outputs no for checking for clock_gettime monotonic clock.... The program continues running the checks and seems to finish building the depends normally. I can then do the following:
cd ..
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make
And it builds without error.
To reproduce
I get the error every time I run it on my system.
- Clone repository to WSL
/home/billy/bitcoin - Follow steps at https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md "Cross-compilation for Ubuntu and Windows Subsystem for Linux" and "Building for 64-bit Windows" up to and including
make HOST=x86_64-w64-mingw32 - Let it run until the error message (screenshot above) pops up
System information
- Bitcoin Core master, built using instructions at https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md
- Windows 10 version 10.0.18363.719
- Ubuntu 18.04 WSL (fresh install from Microsoft Store). I also tried on a different WSL that I upgraded from Ubuntu 16.04 to 18.04
- Intel i7 processor
Other information
Similar issue here: #17277
Here's a copy of the full output from making the depends: https://gist.githubusercontent.com/billygarrison/c548ea99d3b498065c3dc1438d1561c7/raw/64359504e6bf5639396c9aa2313e73a1b0dd2ce8/out.log
And here's a subset of that with showing just the bdb output (line 283 is where it hangs until I click OK on the error popup): https://gist.github.com/billygarrison/ebaad2b2f93c8e89281e7a1d2ce9d88b
EDIT: Removed mention of make check test failing as it is not supported in WSL.
EDIT 2: This issue only occurs if I use make HOST=x86_64-w64-mingw32, if I use it with sudo make HOST=x86_64-w64-mingw32 then it builds fine, and the output includes checking for clock_gettime monotonic clock... yes instead of no.

Activity
brakmic commentedon Mar 19, 2020
Hi @billygarrison ,
I just cloned, configured and compiled successfully a Windows Bitcoin-Qt binary.
My setup is:
Before having started building the binaries I executed the usual
to update my Ubuntu.
I did neither encounter problems with make in depends-directory nor later when building Bitcoin itself.
Here the About window of my local build:
Now I have one "stupid" question: did you also set the compiler for Ubuntu 18.04 as stated here?:
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.I actually assume you did, because you wrote you were following the Bitcoin Windows Compilation docs.
Regards,
billygarrison commentedon Mar 19, 2020
Thanks for looking into this @brakmic - yes, I did do that step as well as the rest in build-windows.md
I'm also using Linux DESKTOP-LLRVDLC 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux, a fresh install of that as well as a fresh clone of the bitcoin repo.
I've run other installations through a different WSL install on this machine. I wonder if some kind of system setting or config was changed in the process that is somehow also accessed by my new WSL
billygarrison commentedon Jun 20, 2020
Update on this issue:
I rebuilt again and did not get this error. I'm not sure what has changed since I opened this issue. Perhaps the issue was fixed by a recent commit. The only thing I can think that has changed on my end is I built it in
/src/bitcoin/dependsthis time instead of/home/billy/bitcoin/depends. I had to usesudo make, which could be why it worked without error.I will try building the depends in
/home/billy/bitcoin/dependsagain, with and withoutsudo, to see if the error occurs.billygarrison commentedon Jun 21, 2020
This issue only occurs if I use
make HOST=x86_64-w64-mingw32, if I use it withsudo make HOST=x86_64-w64-mingw32then it builds fine, and the output includeschecking for clock_gettime monotonic clock... yesinstead ofnosipsorcery commentedon Jun 23, 2020
@billygarrison there's almost no chance a recent commit changed anything to do with the build of the BerkeleyDB dependency. Much more likely is something with the WSL config changed.
I've attempted to replicate this issue again (previously tried unsuccessfully with #17277).
Would you be able to test with a fresh install of Ubuntu 20.04 from the Microsoft Store? I did a fresh install and ran the steps below and did not experience the problem.
billygarrison commentedon Jun 27, 2020
Thanks for the suggestion @sipsorcery, unfortunately the error still occurs. The only deviation I took from your instructions was that I did
cd srcaftermkdir src.In case you missed it, I don't think it suddenly working for me has anything to do with an update to BDB/Bitcoin/WSL. It works when I do
sudo make HOST=x86_64-w64-mingw32(which I hadn't tried when originally posting this issue)sipsorcery commentedon Jun 27, 2020
@billygarrison yes I saw it works when using
sudo. Also the last update thebdbdependency package was 9 months ago. It's almost certain that the need to use sudo is something to do with the Windows and/or WSL version and/or configuration.I'd like to track it down as a matter of interest but given I can't reproduce the problem I need a guinea pig to run the tests. If you don't want to be that guinea pig, no problems.
If you are happy to do another test could you strace the bdb configure step on one of your WSL installs:
In the strace log I'm interested to see what's attempting to execute
conftest.exe. In my strace log there are no messages relating toconftest.exeor any other.exefile.billygarrison commentedon Jun 27, 2020
@sipsorcery I am happy to run as many tests as necessary. Thanks for taking this on. I will be able to run the latest in a couple hours.
When I originally tried your instructions, it didn't work using
bdb_configured. I can post the results in a bit, but the depends didn't build at all. What does that option do?billygarrison commentedon Jun 27, 2020
@sipsorcery Not sure if related, but
make cleangave me a permissions error.sudo make cleanworked.Have you read through #17277? They have narrowed the problem to a few possible fixes (that I didn't understand or wasn't able to implement by myself)
The log from using strace didn't turn up anything containing "conftest" either
sipsorcery commentedon Jun 27, 2020
Yes I've followed #17277 but the only real fix is to use
sudowhich we don't want to recommend unless we know the reason why.With a fresh install of the WSL Ubuntu 20.04 app we should both have the exact same environment. I'm going to remove my 20.04 instance, reinstall and set the WSL version to 1 and see if that makes any difference.
What do you get if you execute
sudo find / -path /mnt -prune -o -name libwinpthread-1.dll?Here's my result:
billygarrison commentedon Jun 27, 2020
@sipsorcery Same result here. My Linux version is
Linux version 4.4.0-18362-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #836-Microsoft Mon May 05 16:04:00 PST 2020fromcat /proc/versionin WSL. Ubuntu 20.04 LTS from Microsoft Store (fresh install)sipsorcery commentedon Jun 27, 2020
WSL 2:
Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020Downgrade WSL2 VM to WSL1 PS:
wsl --set-version Ubuntu-20.04 1WSL 1:
Linux version 4.4.0-19041-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1-Microsoft Fri Dec 06 14:06:00 PST 2019There is a bit of a difference in our Windows 10 versions -18362 compared to 19041 - but I was able to build Bitcoin Core on WSL nearly 3 years ago so that's not exactly a smoking gun.
Success building the
bdbdependency after downgrading VM to WSL1.I've set my default WSL version to 1 and will now delete my Ubuntu 20.04 VM and try again from scratch.
sipsorcery commentedon Jun 27, 2020
My WSL1 build of the bdb dependency ran without issue.
I've trawled back through the logs on #17277 and have a couple more tests to keep trying to identify what's different.
main.cand copy the contents as:x86_64-w64-mingw32-gcc -o main.exe main.c -lpthreadlibwinpthread-1.dlldue to pollution from different mingw packages. That seems unlikely here as the failure has occurred on a fresh WSL install. Run command below and report the results:billygarrison commentedon Jun 27, 2020
@sipsorcery
First test:
No print statement.
Second test:
Identical results to yours (checked with diffchecker.com)
billygarrison commentedon Jun 27, 2020
@sipsorcery it looks like the bitcoin/bitcoin code only contains "conftest" in these three places: https://github.com/bitcoin/bitcoin/search?q=conftest&type=Code
sipsorcery commentedon Jun 28, 2020
@billygarrison
conftest.exeis the name theautoconftools use when building test programs to check if the system supports a particular feature. In this case thebdbconfigurescript builds and executes multipleconftest.exeprograms. It's good news that the small program with theCLOCK_MONOTONICcheck causes the error on your system. That should be enough to log an issue with WSL.Last step before I create the WSL issue. Can you generate an
stracelog for the previous test program execution (WSL issues require anstracelog).strace ./main.exebillygarrison commentedon Jun 28, 2020
main.exedoes not get created, here is the output ofstrace x86_64-w64-mingw32-gcc -o main.exe main.c -lpthread:billygarrison commentedon Jun 28, 2020
@sipsorcery if you ctrl+F that output/this page for
-Wimplicit-int, that line + the following two lines are the ones that only ones that get output when not usingstrace.sipsorcery commentedon Jun 28, 2020
Sorry I meant to build
main.exefirst and then execute it withstrace.billygarrison commentedon Jun 28, 2020
@sipsorcery My mistake, I thought part of the issue was that
main.exewasn't successfully building in the first place.Here is the output of
strace ./main.exesipsorcery commentedon Jun 28, 2020
@billygarrison thx for the trace.
When I went to log this problem on the WSL repo there are a bunch of system clock related issues from 2018/2019. Supposedly they've been fixed but your Windows 10 should have the fix.
Apparently one of the WSL problems relates to the time the system was last rebooted and can be worked around by restarting the WSL service. Could you try the commands below from a DOS box, re-open your WSL app and then re-execute
main.exe?billygarrison commentedon Jun 28, 2020
@sipsorcery Thanks for the tip, unfortunately I still get the System Error popup referring to
libwinpthread-1.dlland an exit code 53sipsorcery commentedon Jun 29, 2020
@billygarrison as mentioned in the WSL issue disabling the hook that allows WSL to execute Windows PE files looks like a potential fix. Can you try:
sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status"and then re-attempt the Bitcoin Core build.
After testing you can revert the change with:
sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status"I was able to reproduce the original
libwinpthread-1.dllnot found issue by removing the Windows 10 application that contained that dll. After then disabled the PEbinfmt_mischook, using the command above, the build was successful.billygarrison commentedon Jun 29, 2020
That took care of the issue. Thank you for walking me through this!
Merge #19408: doc: Windows WSL build recommendation to temporarily di…
Merge #2032: doc: Windows WSL build recommendation to temporarily dis…