You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
conftest.exe error during make of depends on Windows Subsystem for Linux #17277
Expected behavior
Making the Bitcoin depends on Windows Subsystem for Linux (Ubuntu 18.04) should complete without error.
Actual behavior
I'm getting prompted with a conftest.exe application error (see below for screenshot) during the make of the depends. This blocks further progress of make until I click the prompt. It doesn't seem to impact the ultimate build result, but it wastes time, blocking the remaining process while waiting for user input. I assume WSL is incorrectly trying to run this executable in Windows. The error occurs during the "checking for clock_gettime monotonic clock..." step, or shortly thereafter. I verified that no extraneous paths have been added to my $PATH variable.
To reproduce
1.) In Windows, open bash prompt of Windows Subsystem for Linux (Ubuntu 18.04).
2.) Install the required packages to build Bitcoin, set the default mingw32 g++ compiler option to posix, etc. (In other words, do all the standard preparation steps for compiling Bitcoin on Windows.)
3..) Run the following:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
//this strips out problematic Windows %PATH% imported var (see doc/build-windows.md)
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/depends
make HOST=x86_64-w64-mingw32
4.) Now wait until it gets to "checking for clock_gettime monotonic clock...", and then you will get the following application error prompt:
I failed to replicate this with WSL and Ubuntu 18.04.
A quick Google found some articles where the conftest.exe generated by the mingw configure script gets flagged by anti-virus programs. Do you have an AV program that could be the culprit?
I failed to replicate this with WSL and Ubuntu 18.04.
A quick Google found some articles where the conftest.exe generated by the mingw configure script gets flagged by anti-virus programs. Do you have an AV program that could be the culprit?
No, only the regular "Windows Security" virus protection that's built in to Windows 10. Let me do some further testing on another machine and see if I can reproduce it and compare it to the offending machine.
It seems there must be a part of the make process (of the dependencies) that removes the config.log(s) after it completes. I did a file search while it was running and did see a config.log present under, for example, a zeromq subfolder, but this file disappeared once everything was completed. I'll capture the console output and monitor it to see if I can better pinpoint the package where this is happening.
Okay, I think I found it. It's happening during the configuring of bdb. The error happens after the following bdb config.log line 5842, where the console output is: "checking for clock_gettime monotonic clock". I'm outside of my knowledge as far as what might be going wrong here. bdb_config.log
Definitely interesting, so the next question is: why does its execution error out on my machine, whereas it doesn't on sipsorcery's machine?
I noticed that the line @laanwj referenced is not the only time where ./conftest.exe is run, so, might there be something specific to the "checking for clock_gettime monotonic clock" test that's causing the executable to fail, only at this step?
@sipsorcery , what version of Windows 10 are you running? I'm on 1903. I came across the following, but I don't know if it applies or not (and it's unclear whether it's been fixed in the latest Windows 10 builds or not): microsoft/WSL#3840
@mmortal03 I'm on Windows 10 Pro Insider Preview Build 18956.rs_prerelease.190803-1414.
I switched to the Windows Insider Ring about 6 months ago and prior to that was able to build Bitcoin Core on the standard release version of Windows 10.
Are you using WSL 1 or 2? There are some fundamental changes between them.
wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
@sipsorcery I just tried that from the Windows command line, as well as PowerShell, but my wsl command doesn't have that verbose argument as an option, it only has the list argument, so I can't provide the same output. I would suspect I'm on version 1, though.
It'd be good to ensure all updates (windows and ubuntu, and WSL) are up to date first, to avoid spending time chasing ghosts.
might there be something specific to the "checking for clock_gettime monotonic clock" test that's causing the executable to fail, only at this step?
Could be, yes. You could try to extract test code it's trying to compile and run at that step, compile it yourself and try to figure out why it produces an invalid exe.
In terms of going the static linking route, I came across the suggestion of the following parameters which do seem to work around the issue of needing libwinpthread-1.dll to be present:
The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem.
@mmortal03, which directory did you place the .dll in? (which executable are you referring to in the following?):
I went and grabbed the libwinpthread-1.dll from /usr/x86_64-w64-mingw32/lib/ and placed it in the same directory as the executable, which seems to fix the problem
I should add that after closing the error popup, the command seemed to continue successfully.
Following the build-windows.md instructions I was able to successfully do the following commands:
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make
make install DESTDIR=/mnt/c/bitcoin
But when I ran make check there was a failure, which may or may not be related to the DLL error in the depends make command:
********* Start testing of WalletTests *********
Config: Using QtTest library 5.9.8, Qt 5.9.8 (x86_64-little_endian-llp64 static release build; by GCC 7.3-posix 20180312)
PASS : WalletTests::initTestCase()
QDEBUG : WalletTests::walletTests() TransactionTablePriv::refreshWallet
QWARN : WalletTests::walletTests() This plugin does not support propagateSizeHints()
A crash occurred in \\wsl$\Ubuntu\usr\src\bitcoin\src\qt\test\test_bitcoin-qt.exe.
Function time: 1440ms Total time: 1441ms
Exception address: 0x0000000001568e55
Exception code : 0xc0000005
Stack:
# 1: Unable to obtain symbol
# 2: UnhandledExceptionFilter() - 0x00007fff0a61f4b0
# 3: memset() - 0x00007fff0c8c3000
# 4: _C_specific_handler() - 0x00007fff0c8ac640
# 5: _chkstk() - 0x00007fff0c8c1100
# 6: RtlRaiseException() - 0x00007fff0c889ef0
# 7: KiUserExceptionDispatcher() - 0x00007fff0c8bfe60
# 8: Unable to obtain symbol
# 9: Unable to obtain symbol
# 10: Unable to obtain symbol
# 11: Unable to obtain symbol
# 12: Unable to obtain symbol
# 13: Unable to obtain symbol
# 14: Unable to obtain symbol
# 15: Unable to obtain symbol
# 16: Unable to obtain symbol
# 17: Unable to obtain symbol
# 18: Unable to obtain symbol
# 19: Unable to obtain symbol
# 20: Unable to obtain symbol
# 21: Unable to obtain symbol
# 22: Unable to obtain symbol
# 23: Unable to obtain symbol
# 24: Unable to obtain symbol
# 25: Unable to obtain symbol
# 26: Unable to obtain symbol
# 27: Unable to obtain symbol
# 28: Unable to obtain symbol
# 29: Unable to obtain symbol
# 30: secp256k1_ecdsa_recover() - 0x0000000001e309a0
# 31: Unable to obtain symbol
# 32: Unable to obtain symbol
# 33: BaseThreadInitThunk() - 0x00007fff0b8a7bc0
# 34: RtlUserThreadStart() - 0x00007fff0c88ceb0
FAIL qt/test/test_bitcoin-qt.exe (exit status: 5)
@mmortal03, which directory did you place the .dll in? (which executable are you referring to in the following?):
I went and grabbed the libwinpthread-1.dll from /usr/x86_64-w64-mingw32/lib/ and placed it in the same directory as the executable, which seems to fix the problem
There might be a way to automatically inject the dll into the proper directory at compile time, but I can't say what exact modifications that would entail, because I think the directories are generated during the compilation process. I'm pretty sure I was just reporting that it fixed the error in the isolated sense of putting the two together in their own directory -- dealing with the issue at compile time still needs a fix.
Using sudo make HOST=x86_64-w64-mingw32 instead of just make HOST=x86_64-w64-mingw32 fixes the problem. No idea why.
Yeah, I've seen cases of this sort of thing working in various respects, even though people will tell you that we shouldn't be putting sudo on such compilation commands. I haven't tested this lately. I should try compiling 0.20.0 and see if anything different happens.
@billygarrison I just tested it, and can confirm that using sudo gets around it for me, as well. Hopefully someone more knowledgeable can figure out why this is the case and fix it.
Yep, I'll close it, then. I guess someone could post a bug report to [email protected], though I did a quick search through their archives regarding Windows and someone stated, "MS-Windows is not our platform of choice and questions involving it are lower priority." Maybe it's not up the GNU gang and it's the Microsoft WSL people who need to come up with a more elegant default handling of binfmt_misc cases. It's beyond my paygrade, lol.
Activity
sipsorcery commentedon Nov 4, 2019
I failed to replicate this with WSL and Ubuntu 18.04.
A quick Google found some articles where the
conftest.exegenerated by the mingw configure script gets flagged by anti-virus programs. Do you have an AV program that could be the culprit?mmortal03 commentedon Nov 5, 2019
No, only the regular "Windows Security" virus protection that's built in to Windows 10. Let me do some further testing on another machine and see if I can reproduce it and compare it to the offending machine.
laanwj commentedon Nov 5, 2019
Please upload your
config.logsomewhere, it might give a clue why you end up with aconftest.exeinstead of a Linux executable.mmortal03 commentedon Nov 6, 2019
Should there be a config.log? This is occurring in the make of the depends folder, before I get to the configure step.
laanwj commentedon Nov 6, 2019
There's always a config.log when configure runs.
Also it would be good to know what dependency is generating this error! It's useful information at least that it's not bitcoin's own configure script.
mmortal03 commentedon Nov 6, 2019
It seems there must be a part of the make process (of the dependencies) that removes the config.log(s) after it completes. I did a file search while it was running and did see a config.log present under, for example, a zeromq subfolder, but this file disappeared once everything was completed. I'll capture the console output and monitor it to see if I can better pinpoint the package where this is happening.
mmortal03 commentedon Nov 6, 2019
Okay, I think I found it. It's happening during the configuring of bdb. The error happens after the following bdb config.log line 5842, where the console output is: "checking for clock_gettime monotonic clock". I'm outside of my knowledge as far as what might be going wrong here.
bdb_config.log
laanwj commentedon Nov 6, 2019
that helps!
berkeleydb apparently checks whether it's cross-compiling by trying to execute the build output
this is quite unusual; it should derive this from command line settings only
then again the build system for bdb 4.8 is old as the hills
mmortal03 commentedon Nov 7, 2019
Definitely interesting, so the next question is: why does its execution error out on my machine, whereas it doesn't on sipsorcery's machine?
I noticed that the line @laanwj referenced is not the only time where ./conftest.exe is run, so, might there be something specific to the "checking for clock_gettime monotonic clock" test that's causing the executable to fail, only at this step?
@sipsorcery , what version of Windows 10 are you running? I'm on 1903. I came across the following, but I don't know if it applies or not (and it's unclear whether it's been fixed in the latest Windows 10 builds or not): microsoft/WSL#3840
sipsorcery commentedon Nov 7, 2019
@mmortal03 I'm on Windows 10 Pro Insider Preview Build 18956.rs_prerelease.190803-1414.
I switched to the Windows Insider Ring about 6 months ago and prior to that was able to build Bitcoin Core on the standard release version of Windows 10.
Are you using WSL 1 or 2? There are some fundamental changes between them.
mmortal03 commentedon Nov 7, 2019
@sipsorcery I just tried that from the Windows command line, as well as PowerShell, but my wsl command doesn't have that verbose argument as an option, it only has the list argument, so I can't provide the same output. I would suspect I'm on version 1, though.
laanwj commentedon Nov 7, 2019
It'd be good to ensure all updates (windows and ubuntu, and WSL) are up to date first, to avoid spending time chasing ghosts.
Could be, yes. You could try to extract test code it's trying to compile and run at that step, compile it yourself and try to figure out why it produces an invalid exe.
2 remaining items
mmortal03 commentedon Nov 8, 2019
In terms of going the static linking route, I came across the suggestion of the following parameters which do seem to work around the issue of needing libwinpthread-1.dll to be present:
x86_64-w64-mingw32-gcc -o conftest.exe conftest.c -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archiveSource: https://stackoverflow.com/a/43402308/4438237
Also important, the following distinguishes between this issue in the mingw-w64 project and what MinGW.org does: metaeducation/revolt#624 (comment)
billygarrison commentedon Mar 8, 2020
I have the same issue, which also appears at the
checking for clock_gettime monotonic clockpoint.Windows 10 build 18363, WSL (not WSL 2). I upgraded Ubuntu from 16.04 to 18.04 and then followed the instructions at https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md.
The error message that popped up was:
The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem.@mmortal03, which directory did you place the .dll in? (which executable are you referring to in the following?):
billygarrison commentedon Mar 8, 2020
I should add that after closing the error popup, the command seemed to continue successfully.
Following the build-windows.md instructions I was able to successfully do the following commands:
But when I ran
make checkthere was a failure, which may or may not be related to the DLL error in the dependsmakecommand:mmortal03 commentedon Mar 8, 2020
There might be a way to automatically inject the dll into the proper directory at compile time, but I can't say what exact modifications that would entail, because I think the directories are generated during the compilation process. I'm pretty sure I was just reporting that it fixed the error in the isolated sense of putting the two together in their own directory -- dealing with the issue at compile time still needs a fix.
billygarrison commentedon Jun 21, 2020
@mmortal03 @laanwj I have found a working solution to this problem in my case (#18348)
Using
sudo make HOST=x86_64-w64-mingw32instead of justmake HOST=x86_64-w64-mingw32fixes the problem. No idea why.mmortal03 commentedon Jun 22, 2020
Yeah, I've seen cases of this sort of thing working in various respects, even though people will tell you that we shouldn't be putting sudo on such compilation commands. I haven't tested this lately. I should try compiling 0.20.0 and see if anything different happens.
mmortal03 commentedon Jun 23, 2020
@billygarrison I just tested it, and can confirm that using sudo gets around it for me, as well. Hopefully someone more knowledgeable can figure out why this is the case and fix it.
billygarrison commentedon Jun 29, 2020
@sipsorcery came up with an easy-to-implement workaround #18348 (comment)
mmortal03 commentedon Jun 30, 2020
Thanks! I can confirm that this works around the the issue.
@laanwj , should we close this and open a new issue for the long term, automated fix?
Merge #19408: doc: Windows WSL build recommendation to temporarily di…
laanwj commentedon Jul 1, 2020
I don't think it's possible to fix this on our side. #19408 (comment) is probably right that this issue is common to all autoconf projects.
mmortal03 commentedon Jul 2, 2020
Yep, I'll close it, then. I guess someone could post a bug report to [email protected], though I did a quick search through their archives regarding Windows and someone stated, "MS-Windows is not our platform of choice and questions involving it are lower priority." Maybe it's not up the GNU gang and it's the Microsoft WSL people who need to come up with a more elegant default handling of binfmt_misc cases. It's beyond my paygrade, lol.
Merge #2032: doc: Windows WSL build recommendation to temporarily dis…