<!-- This issue tracker is only for technical issues related to Bitcoin Core.

General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com.

For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/.

If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

<!-- Describe the issue -->

gmake fails to compile bitcoin from source for commits 8470e6472 or newer on OpenBSD 6.2.

<!--- What behavior did you expect? -->

Expected successful gmake exit.

<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

gmake exits with 3 errors:

```
3 errors generated.
gmake[2]: *** [Makefile:6149: libbitcoin_util_a-util.o] Error 1
gmake[2]: Leaving directory '/home/bitcoin/bitcoin/src'
gmake[1]: *** [Makefile:9417: all-recursive] Error 1
gmake[1]: Leaving directory '/home/bitcoin/bitcoin/src'
gmake: *** [Makefile:745: all-recursive] Error 1
```
Full output is given below.

<!--- How reliably can you reproduce the issue, what are the steps to do so? -->

This error always occurs when following the instructions in /doc/build-openbsd.md using bitcoin sources from commits 8470e6472 and newer.

However, when compiling bitcoin source using commit 7f81250 on the same system, gmake successfully completes.

<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

This error occurs using bitcoin sources from commits 8470e6472 and newer.

<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

OpenBSD 6.2 amd64

<!-- Any extra information that might be useful in the debugging process. -->

gmake-4.2.1
autoconf-2.69.p2
automake-1.15.1
boost-1.58.0p8

Bitcoin source information for the attached output:
```
commit fe53d5f3636aed064823bc220d828c7ff08d1d52 (HEAD -> master, origin/master, origin/HEAD)
Merge: 948c29cc0 464015f6f
Author: MarcoFalke <falke.marco@gmail.com>
Date:   Sat Feb 10 09:47:21 2018 -0500
```

Configured using:
```
./configure --with-gui=no CC=cc CXX=c++ \
    BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
    BDB_CFLAGS="-I${BDB_PREFIX}/include"
```

```
Options used to compile and link:
  with wallet   = yes
  with gui / qt = no
  with zmq      = no
  with test     = yes
  with bench    = yes
  with upnp     = auto
  use asm       = yes
  debug enabled = no
  werror        = no

  target os     = 
  build os      = 

  CC            = cc
  CFLAGS        = -g -O2
  CPPFLAGS      =  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = c++ -std=c++11
  CXXFLAGS      = -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wthread-safety-analysis -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough
  LDFLAGS       = 
  ARFLAGS       = cr
```

<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

gmake output:
```
$ Making all in src
gmake[1]: Entering directory '/home/bitcoin/bitcoin/src'
gmake[2]: Entering directory '/home/bitcoin/bitcoin/src'
  CXX      crypto/libbitcoinconsensus_la-aes.lo
  CXX      crypto/libbitcoinconsensus_la-chacha20.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha256.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha512.lo
  CXX      crypto/libbitcoinconsensus_la-ripemd160.lo
  CXX      crypto/libbitcoinconsensus_la-sha1.lo
  CXX      crypto/libbitcoinconsensus_la-sha256.lo
  CXX      crypto/libbitcoinconsensus_la-sha512.lo
  CXX      crypto/libbitcoinconsensus_la-sha256_sse4.lo
  CXX      libbitcoinconsensus_la-arith_uint256.lo
  CXX      consensus/libbitcoinconsensus_la-merkle.lo
  CXX      libbitcoinconsensus_la-hash.lo
  CXX      primitives/libbitcoinconsensus_la-block.lo
  CXX      primitives/libbitcoinconsensus_la-transaction.lo
  CXX      libbitcoinconsensus_la-pubkey.lo
  CXX      script/libbitcoinconsensus_la-bitcoinconsensus.lo
  CXX      script/libbitcoinconsensus_la-interpreter.lo
  CXX      script/libbitcoinconsensus_la-script.lo
  CXX      script/libbitcoinconsensus_la-script_error.lo
  CXX      libbitcoinconsensus_la-uint256.lo
  CXX      libbitcoinconsensus_la-utilstrencodings.lo
gmake[3]: Entering directory '/home/bitcoin/bitcoin/src/secp256k1'
gcc -I. -g -O2 -Wall -Wextra -Wno-unused-function -c src/gen_context.c -o gen_context.o
gcc gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
  CCLD     libsecp256k1.la
gmake[3]: Leaving directory '/home/bitcoin/bitcoin/src/secp256k1'
  CXXLD    libbitcoinconsensus.la

*** Warning: This system can not link to static lib archive secp256k1/libsecp256k1.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
  CXX      bitcoind-bitcoind.o
  CXX      libbitcoin_server_a-addrdb.o
  CXX      libbitcoin_server_a-addrman.o
  CXX      libbitcoin_server_a-bloom.o
  CXX      libbitcoin_server_a-blockencodings.o
  CXX      libbitcoin_server_a-chain.o
  CXX      libbitcoin_server_a-checkpoints.o
  CXX      consensus/libbitcoin_server_a-tx_verify.o
  CXX      libbitcoin_server_a-httprpc.o
  CXX      libbitcoin_server_a-httpserver.o
  CXX      libbitcoin_server_a-init.o
  CXX      libbitcoin_server_a-dbwrapper.o
  CXX      libbitcoin_server_a-merkleblock.o
  CXX      libbitcoin_server_a-miner.o
  CXX      libbitcoin_server_a-net.o
  CXX      libbitcoin_server_a-net_processing.o
  CXX      libbitcoin_server_a-noui.o
  CXX      policy/libbitcoin_server_a-fees.o
  CXX      policy/libbitcoin_server_a-policy.o
  CXX      policy/libbitcoin_server_a-rbf.o
  CXX      libbitcoin_server_a-pow.o
  CXX      libbitcoin_server_a-rest.o
  CXX      rpc/libbitcoin_server_a-blockchain.o
  CXX      rpc/libbitcoin_server_a-mining.o
  CXX      rpc/libbitcoin_server_a-misc.o
  CXX      rpc/libbitcoin_server_a-net.o
  CXX      rpc/libbitcoin_server_a-rawtransaction.o
  CXX      rpc/libbitcoin_server_a-safemode.o
  CXX      rpc/libbitcoin_server_a-server.o
  CXX      script/libbitcoin_server_a-sigcache.o
  CXX      script/libbitcoin_server_a-ismine.o
  CXX      libbitcoin_server_a-timedata.o
  CXX      libbitcoin_server_a-torcontrol.o
  CXX      libbitcoin_server_a-txdb.o
  CXX      libbitcoin_server_a-txmempool.o
  CXX      libbitcoin_server_a-ui_interface.o
  CXX      libbitcoin_server_a-validation.o
  CXX      libbitcoin_server_a-validationinterface.o
  CXX      libbitcoin_server_a-versionbits.o
  AR       libbitcoin_server.a
  CXX      libbitcoin_common_a-base58.o
  CXX      libbitcoin_common_a-bech32.o
  CXX      libbitcoin_common_a-chainparams.o
  CXX      libbitcoin_common_a-coins.o
  CXX      libbitcoin_common_a-compressor.o
  CXX      libbitcoin_common_a-core_read.o
  CXX      libbitcoin_common_a-core_write.o
  CXX      libbitcoin_common_a-key.o
key.cpp:51:23: warning: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    if (end - privkey < lenb) {
        ~~~~~~~~~~~~~ ^ ~~~~
key.cpp:57:23: warning: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    if (end - privkey < len) {
        ~~~~~~~~~~~~~ ^ ~~~
key.cpp:71:37: warning: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    if (oslen > 32 || end - privkey < oslen) {
                      ~~~~~~~~~~~~~ ^ ~~~~~
3 warnings generated.
  CXX      libbitcoin_common_a-keystore.o
  CXX      libbitcoin_common_a-netaddress.o
  CXX      libbitcoin_common_a-netbase.o
  CXX      policy/libbitcoin_common_a-feerate.o
  CXX      libbitcoin_common_a-protocol.o
  CXX      libbitcoin_common_a-scheduler.o
  CXX      script/libbitcoin_common_a-sign.o
  CXX      script/libbitcoin_common_a-standard.o
  CXX      libbitcoin_common_a-warnings.o
  AR       libbitcoin_common.a
gmake[3]: Entering directory '/home/bitcoin/bitcoin/src/univalue'
  CXX      lib/libunivalue_la-univalue.lo
  CXX      lib/libunivalue_la-univalue_get.lo
  CXX      lib/libunivalue_la-univalue_read.lo
  CXX      lib/libunivalue_la-univalue_write.lo
  CXXLD    libunivalue.la
gmake[3]: Leaving directory '/home/bitcoin/bitcoin/src/univalue'
  CXX      support/libbitcoin_util_a-lockedpool.o
  CXX      libbitcoin_util_a-chainparamsbase.o
  CXX      libbitcoin_util_a-clientversion.o
  CXX      compat/libbitcoin_util_a-glibc_sanity.o
  CXX      compat/libbitcoin_util_a-glibcxx_sanity.o
  CXX      compat/libbitcoin_util_a-strnlen.o
  CXX      libbitcoin_util_a-fs.o
  CXX      libbitcoin_util_a-random.o
  CXX      rpc/libbitcoin_util_a-protocol.o
  CXX      rpc/libbitcoin_util_a-util.o
  CXX      support/libbitcoin_util_a-cleanse.o
  CXX      libbitcoin_util_a-sync.o
  CXX      libbitcoin_util_a-threadinterrupt.o
  CXX      libbitcoin_util_a-util.o
In file included from util.cpp:6:
In file included from ./util.h:18:
In file included from ./fs.h:9:
In file included from /usr/include/c++/v1/string:442:
In file included from /usr/include/c++/v1/algorithm:633:
/usr/include/c++/v1/utility:330:5: error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const
    pair(pair const&) = default;
    ^
util.cpp:384:121: note: in instantiation of template class 'std::__1::pair<const std::__1::basic_string<char>, boost::interprocess::file_lock>' requested here
        boost::interprocess::file_lock& lock = locks.emplace(pathLockFile.string(), pathLockFile.string().c_str()).first->second;
                                                                                                                        ^
In file included from util.cpp:6:
In file included from ./util.h:18:
In file included from ./fs.h:9:
In file included from /usr/include/c++/v1/string:442:
In file included from /usr/include/c++/v1/algorithm:633:
/usr/include/c++/v1/utility:330:5: error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const
    pair(pair const&) = default;
    ^
/usr/include/c++/v1/map:627:21: note: in instantiation of template class 'std::__1::pair<std::__1::basic_string<char>, boost::interprocess::file_lock>' requested here
    __nc_value_type __nc;
                    ^
/usr/include/c++/v1/__tree:754:23: note: in instantiation of template class 'std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>' requested here
    __node_value_type __value_;
                      ^
/usr/include/c++/v1/__tree:1789:49: note: in instantiation of template class 'std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, void *>' requested here
        destroy(static_cast<__node_pointer>(__nd->__left_));
                                                ^
/usr/include/c++/v1/__tree:1780:5: note: in instantiation of member function 'std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>,
      std::__1::__map_value_compare<std::__1::basic_string<char>, std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, std::__1::less<std::__1::basic_string<char> >, true>,
      std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock> > >::destroy' requested here
    destroy(__root());
    ^
/usr/include/c++/v1/map:738:78: note: in instantiation of member function 'std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>,
      std::__1::__map_value_compare<std::__1::basic_string<char>, std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, std::__1::less<std::__1::basic_string<char> >, true>,
      std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock> > >::~__tree' requested here
    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
                                                                             ^
In file included from util.cpp:6:
In file included from ./util.h:18:
In file included from ./fs.h:9:
In file included from /usr/include/c++/v1/string:442:
In file included from /usr/include/c++/v1/algorithm:633:
/usr/include/c++/v1/utility:298:23: error: no matching constructor for initialization of 'boost::interprocess::file_lock'
        : first(__x), second(__y) {}
                      ^      ~~~
/usr/include/c++/v1/memory:1747:31: note: in instantiation of member function 'std::__1::pair<const std::__1::basic_string<char>, boost::interprocess::file_lock>::pair' requested here
            ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
                              ^
/usr/include/c++/v1/memory:1658:18: note: in instantiation of function template specialization 'std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>,
      boost::interprocess::file_lock>, void *> >::construct<std::__1::pair<const std::__1::basic_string<char>, boost::interprocess::file_lock>, const std::__1::basic_string<char> &, const char *>' requested here
            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                 ^
/usr/include/c++/v1/memory:1504:14: note: in instantiation of function template specialization
      'std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, void *> > >::__construct<std::__1::pair<const
      std::__1::basic_string<char>, boost::interprocess::file_lock>, const std::__1::basic_string<char> &, const char *>' requested here
            {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
             ^
/usr/include/c++/v1/__tree:2149:20: note: in instantiation of function template specialization
      'std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, void *> > >::construct<std::__1::pair<const
      std::__1::basic_string<char>, boost::interprocess::file_lock>, const std::__1::basic_string<char> &, const char *>' requested here
    __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), _VSTD::forward<_Args>(__args)...);
                   ^
/usr/include/c++/v1/__tree:2094:29: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>,
      std::__1::__map_value_compare<std::__1::basic_string<char>, std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, std::__1::less<std::__1::basic_string<char> >, true>,
      std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock> > >::__construct_node<const std::__1::basic_string<char> &, const char *>' requested here
        __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
                            ^
/usr/include/c++/v1/__tree:1156:16: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>,
      std::__1::__map_value_compare<std::__1::basic_string<char>, std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, std::__1::less<std::__1::basic_string<char> >, true>,
      std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock> > >::__emplace_unique_key_args<std::__1::basic_string<char>, const std::__1::basic_string<char> &,
      const char *>' requested here
        return __emplace_unique_key_args(__f, _VSTD::forward<_First>(__f),
               ^
/usr/include/c++/v1/map:1047:24: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>,
      std::__1::__map_value_compare<std::__1::basic_string<char>, std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock>, std::__1::less<std::__1::basic_string<char> >, true>,
      std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char>, boost::interprocess::file_lock> > >::__emplace_unique<const std::__1::basic_string<char> &, const char *>' requested here
        return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);
                       ^
util.cpp:384:54: note: in instantiation of function template specialization 'std::__1::map<std::__1::basic_string<char>, boost::interprocess::file_lock, std::__1::less<std::__1::basic_string<char> >,
      std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, boost::interprocess::file_lock> > >::emplace<const std::__1::basic_string<char> &, const char *>' requested here
        boost::interprocess::file_lock& lock = locks.emplace(pathLockFile.string(), pathLockFile.string().c_str()).first->second;
                                                     ^
/usr/local/include/boost/interprocess/sync/file_lock.hpp:48:35: note: candidate constructor not viable: 1st argument ('const boost::interprocess::file_lock') would lose const qualifier
   BOOST_MOVABLE_BUT_NOT_COPYABLE(file_lock)
                                  ^
/usr/local/include/boost/move/core.hpp:216:46: note: expanded from macro 'BOOST_MOVABLE_BUT_NOT_COPYABLE'
      BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\
                                             ^
/usr/local/include/boost/move/core.hpp:35:7: note: expanded from macro 'BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN'
      TYPE(TYPE &);\
      ^
/usr/local/include/boost/interprocess/sync/file_lock.hpp:65:4: note: candidate constructor not viable: no known conversion from 'const boost::interprocess::file_lock' to '::boost::rv<file_lock> &' for 1st
      argument
   file_lock(BOOST_RV_REF(file_lock) moved)
   ^
/usr/local/include/boost/interprocess/sync/file_lock.hpp:153:19: note: candidate constructor not viable: no known conversion from 'const boost::interprocess::file_lock' to 'const char *' for 1st argument
inline file_lock::file_lock(const char *name)
                  ^
/usr/local/include/boost/interprocess/sync/file_lock.hpp:54:4: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
   file_lock()
   ^
3 errors generated.
gmake[2]: *** [Makefile:6149: libbitcoin_util_a-util.o] Error 1
gmake[2]: Leaving directory '/home/bitcoin/bitcoin/src'
gmake[1]: *** [Makefile:9417: all-recursive] Error 1
gmake[1]: Leaving directory '/home/bitcoin/bitcoin/src'
gmake: *** [Makefile:745: all-recursive] Error 1
```
if (file) fclose(file);
    try {
        auto lock = MakeUnique<boost::interprocess::file_lock>(pathLockFile.string().c_str());
        if (!lock->try_lock()) {
            return false;
        }
        if (!probe_only) {
            
            locks.emplace(pathLockFile.string(), std::move(lock));
        }
    } catch (const boost::interprocess::interprocess_exception& e) {
        return error("Error while attempting to lock directory %s: %s", directory.string(), e.what());
    }
    return true;
}
static bool InterpretBool(const std::string& strValue)
{
    if (strValue.empty())
        return true;
    return (atoi(strValue) != 0);
}
static void InterpretNegativeSetting(std::string& strKey, std::string& strValue)
{
    if (strKey.length()>3 && strKey[0]=='-' && strKey[1]=='n' && strKey[2]=='o')
    {
        strKey = "-" + strKey.substr(3);
        strValue = InterpretBool(strValue) ? "0" : "1";
    }
}
void ArgsManager::ParseParameters(int argc, const char* const argv[])