build failure on ubuntu 14.10 with g++ 4.9.1 #5920

issue zefir-k opened this issue on March 17, 2015
  1. zefir-k commented at 9:20 PM on March 17, 2015: none

    On a fresh Ubuntu 14.10 system (g++ 4.9.1), with current HEAD (93a8c468) ./autogen.sh && ./configure --disable-wallet --disable-tests --with-gui=no --without-miniupnpc generates a bitcoin-config.h without HAVE_ENDIAN_H and no endian macros (HAVE_DECL_HTOxx, etc.) set.

    With that, a compile run fails immediately, since <endian.h> is included from other headers and causes errors like

      CXX      crypto/libbitcoinconsensus_la-ripemd160.lo
    In file included from ./crypto/common.h:14:0,
                     from crypto/ripemd160.cpp:7:
    ./compat/endian.h:132:18: error: expected unqualified-id before '__extension__'
     inline uint16_t be16toh(uint16_t big_endian_16bits)
                      ^
    ./compat/endian.h:132:18: error: expected ')' before '__extension__'
    ./compat/endian.h:160:17: error: redefinition of 'uint32_t __bswap_32(uint32_t)'
     inline uint32_t be32toh(uint32_t big_endian_32bits)
                     ^
    In file included from /usr/include/endian.h:60:0,
                     from /usr/include/x86_64-linux-gnu/bits/waitstatus.h:64,
                     from /usr/include/stdlib.h:42,
                     from ./crypto/ripemd160.h:9,
                     from crypto/ripemd160.cpp:5:
    /usr/include/x86_64-linux-gnu/bits/byteswap.h:45:1: note: 'unsigned int __bswap_32(unsigned int)' previously defined here
     __bswap_32 (unsigned int __bsx)
     ^
    

    As a quick workaround it is enough to undefine the endian functions when HAVE_ENDIAN_H is not set:

    diff --git a/src/compat/endian.h b/src/compat/endian.h
    index 4d041d6..cd86ab4 100644
    --- a/src/compat/endian.h
    +++ b/src/compat/endian.h
    @@ -15,6 +15,23 @@
    
     #if defined(HAVE_ENDIAN_H)
     #include <endian.h>
    +#else
    +#undef htobe16
    +#undef htobe32
    +#undef htobe64
    +
    +#undef htole16
    +#undef htole32
    +#undef htole64
    +
    +#undef be16toh
    +#undef be32toh
    +#undef be64toh
    +
    +#undef le16toh
    +#undef le32toh
    +#undef le64toh
    +
     #endif
    
     #if defined(WORDS_BIGENDIAN)
    

    But that's most probably not the right type of fix.

  2. theuni commented at 11:53 PM on March 17, 2015: member

    I'm guessing you have a stale src/bitcoin-config.h laying around? if so, delete it. That's been moved to config/bitcoin-config.h

    If this is raising its head once again, I'll fix the root problem once and for all.

  3. laanwj commented at 7:04 AM on March 18, 2015: member

    Some remnant of an older configuration is staying behind. This is solved by using git clean -f -x -d to clean your tree.

  4. laanwj closed this on Mar 18, 2015

  5. zefir-k commented at 8:30 AM on March 18, 2015: none

    Thanks, git clean did the job. Obviously a make distclean after issuing ./autogen.sh with changing file layouts can't fix the issue.

    Sorry for noise.

  6. rebroad commented at 12:47 PM on June 12, 2015: contributor

    I'm also getting this problem. Clearly a "make clean" isn't sufficient - but shouldn't it be?

  7. ayeowch referenced this in commit 643348626b on Jul 13, 2015
  8. feathercoin2 commented at 1:20 PM on December 7, 2015: none

    I'm also getting this problem.

  9. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 06:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me