Skip to content
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

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

Merged
merged 1 commit into from Jul 26, 2017

Conversation

brianmcmichael
Copy link
Contributor

Fixes #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.

@laanwj
Copy link
Member

laanwj commented Jul 24, 2017

utACK

@TheBlueMatt
Copy link
Contributor

utACK

@maflcko maflcko changed the title Qt: Use _putenv_s instead of setenv on Windows builds [test] Qt: Use _putenv_s instead of setenv on Windows builds Jul 25, 2017
@maflcko maflcko added this to the 0.15.0 milestone Jul 25, 2017
@maflcko
Copy link
Member

maflcko commented Jul 25, 2017

utACK 0be03c7

@laanwj laanwj merged commit 0be03c7 into bitcoin:master Jul 26, 2017
laanwj added a commit that referenced this pull request Jul 26, 2017
…uilds

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

Pull request description:

  Fixes #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.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 6, 2019
…ndows builds

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

Pull request description:

  Fixes bitcoin#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.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 6, 2019
…ndows builds

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

Pull request description:

  Fixes bitcoin#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.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…ndows builds

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

Pull request description:

  Fixes bitcoin#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.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiling Error: qt/test/test_main.cpp
5 participants