Page MenuHomePhabricator

[backport#10899] [test] Qt: Use _putenv_s instead of setenv on Windows builds
AbandonedPublic

Authored by majcosta on Oct 2 2020, 17:55.

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Summary

0be03c7 Qt: Use _putenv_s instead of setenv on Windows builds (Brian McMichael)

Pull request description:

Fixes https://github.com/bitcoin/bitcoin/issues/10836

Error message I would get on `make`:
```
...
  CXXLD    bench/bench_bitcoin.exe
  OBJCXXLD qt/bitcoin-qt.exe
qt/test/test_main.cpp: In function ‘int main(int, char**)’:
qt/test/test_main.cpp:64:43: error: ‘setenv’ was not declared in this scope
     setenv("QT_QPA_PLATFORM", "minimal", 0);
                                           ^
make[2]: *** [qt/test/qt_test_test_bitcoin_qt-test_main.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
make: *** [all-recursive] Error 1
```

`setenv` function is not available from the Microsoft runtime library. Need to use `_putenv_s` instead.

This solution tells the compiler to use `_putenv_s` on `WIN32` compilation (Note: this also works on 64-bit Windows instances.) and `setenv` everywhere else.

I've tested builds on Windows 10 x64 and Ubuntu 16.04 with this code.

Backport of Core PR10899

Test Plan
ninja all check check-functional

Event Timeline

majcosta requested review of this revision.Oct 2 2020, 17:55

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Snippet of first build failure:

Build 'Bitcoin ABC Diffs / Diff Testing' #16954, branch 'refs/tags/phabricator/diff/24223'
Started 2020-10-02 17:56:16 on 'buildagent2' by 'Phabricator Staging (phabricator-staging)'
Finished 2020-10-02 18:00:45 with status FAILURE 'Build build-without-wallet failed with exit code 1'

Each failure log is accessible here:
Bitcoin ABC functional tests: p2p_timeouts.py

jasonbcox requested changes to this revision.Oct 2 2020, 18:21
jasonbcox added a subscriber: jasonbcox.

Unless something changed, I think the feedback from D3225 is still valid.

This revision now requires changes to proceed.Oct 2 2020, 18:21

ha, that's what I get for grepping the repository but not Phabricator. abandoning. :-)