:: [Libbitcoin] examples/main.cpp:43 u…
Top Pagina
Delete this message
Reply to this message
Auteur: mlmikael
Datum:  
Aan: Eric Voskuil, libbitcoin
Oude Onderwerpen: Re: [Libbitcoin] libbitcoin-server update
Onderwerp: [Libbitcoin] examples/main.cpp:43 uses "environ" which does not exist at least on OBSD 5.7/GCC 4.8.4. Fix? (Just commenting out the four affected lines solves it at least locally!)
Eric,

https://github.com/libbitcoin/libbitcoin/blob/version2/ has some checks
for __MACH__

      $ grep -r __MACH__ *
      examples/main.cpp:#ifndef __MACH__
      include/bitcoin/bitcoin/utility/time.hpp:#if defined(__MACH__)
      include/bitcoin/bitcoin/utility/time.hpp:#if defined(__MACH__)
      src/utility/time.cpp:#if defined(__MACH__)
      src/utility/time.cpp:#if defined(__MACH__)


. Looks like this is a Mac OS X check,
http://stackoverflow.com/questions/2166483/which-macro-to-wrap-mac-os-x-specific-code-in-c-c
.

__MACH__ is indeed not defined on OpenBSD (5.7, eg++ (GCC) 4.8.4), and
for that reason compilation of the lines in examples/main.cpp :

      #ifndef __MACH__
          if (environ[0] != nullptr)
              bc::cout << "environ[0] : " << environ[0] << std::endl;
      #endif


fail the compilation with error:

      examples/main.cpp: In function 'int libbitcoin::main(int, char**)':
      examples/main.cpp:43:9: error: 'environ' was not declared in this 
scope
           if (environ[0] != nullptr)
          ^


.

Can you please fix that?


Just commenting out the four lines altogether seems to resolve it at
least locally.

(The other __MACH__ ifdefs in the code caused no issue though.)

Thanks.