fix compile error on boost >= 1.55 #5166

pull microcai wants to merge 1 commits into bitcoin:master from microcai:master changing 1 files +10 −10
  1. microcai commented at 6:31 AM on October 29, 2014: none

    since bitcoin already requires c++11 compiler, so change the use of boost::assign::list_of to c++11 new {} style initialiser. This can fix compile errors with recent boost versions.

  2. fix compile error on boost >= 1.55
    since bitcoin already requires c++11 compiler, so change the use of boost::assign::list_of to c++11 new {} style initialiser.
    This can fix compile errors with recent boost versions.
    1557197efb
  3. theuni commented at 6:47 AM on October 29, 2014: member

    Bitcoin does not use c++11. What's the boost compile error?

  4. microcai commented at 8:37 AM on October 29, 2014: none

    compiler says: ambiguous overload for ‘operator=’ (operand types are ‘std::vector<unsigned char>’ and ‘boost::assign_detail::generic_list<int>’)

  5. laanwj commented at 8:49 AM on October 29, 2014: member

    NACK. This causes compile errors on all of our compilers in Travis.

  6. theuni commented at 9:14 AM on October 29, 2014: member

    Dumb guess is that it doesn't like the single-element ones. Please give this a try:

    diff --git a/src/chainparams.cpp b/src/chainparams.cpp
    index 1ab2925..f1d52a8 100644
    --- a/src/chainparams.cpp
    +++ b/src/chainparams.cpp
    @@ -153,9 +153,9 @@ public:
             vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io"));
             vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org"));
    
    -        base58Prefixes[PUBKEY_ADDRESS] = list_of(0);
    -        base58Prefixes[SCRIPT_ADDRESS] = list_of(5);
    -        base58Prefixes[SECRET_KEY] =     list_of(128);
    +        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 0);
    +        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 5);
    +        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1, 128);
             base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
             base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
    
    @@ -216,9 +216,9 @@ public:
             vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me"));
             vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de"));
    
    -        base58Prefixes[PUBKEY_ADDRESS] = list_of(111);
    -        base58Prefixes[SCRIPT_ADDRESS] = list_of(196);
    -        base58Prefixes[SECRET_KEY]     = list_of(239);
    +        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 111);
    +        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 196);
    +        base58Prefixes[SECRET_KEY]     = std::vector<unsigned char>(1, 239);
             base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
             base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
    
  7. microcai commented at 9:28 AM on October 29, 2014: none

    2014-10-29 17:14 GMT+08:00 Cory Fields notifications@github.com:

    Dumb guess is that it doesn't like the single-element ones. Please give this a try:

    diff --git a/src/chainparams.cpp b/src/chainparams.cppindex 1ab2925..f1d52a8 100644--- a/src/chainparams.cpp+++ b/src/chainparams.cpp@@ -153,9 +153,9 @@ public: vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io")); vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org"));

    •    base58Prefixes[PUBKEY_ADDRESS] = list_of(0);-        base58Prefixes[SCRIPT_ADDRESS] = list_of(5);-        base58Prefixes[SECRET_KEY] =     list_of(128);+        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 0);+        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 5);+        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1, 128);
       base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
       base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
      @@ -216,9 +216,9 @@ public: vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de"));
    •    base58Prefixes[PUBKEY_ADDRESS] = list_of(111);-        base58Prefixes[SCRIPT_ADDRESS] = list_of(196);-        base58Prefixes[SECRET_KEY]     = list_of(239);+        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 111);+        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 196);+        base58Prefixes[SECRET_KEY]     = std::vector<unsigned char>(1, 239);
       base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
       base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);

    — Reply to this email directly or view it on GitHub #5166 (comment).

    negative, I got exactly 10 errors.

  8. theuni commented at 9:18 PM on October 29, 2014: member

    ...and what are those errors? Please be sure to provide as much info as possible when reporting build issues.

  9. microcai commented at 2:44 AM on October 30, 2014: none

    ...and what are those errors? Please be sure to provide as much info as possible when reporting build issues.

    compiler says: ambiguous overload for ‘operator=’ (operand types are ‘std::vector’ and ‘boost::assign_detail::generic_list’)

  10. laanwj added the label Build system on Nov 3, 2014
  11. laanwj commented at 5:07 PM on November 12, 2014: member

    @microcai Are you going to try finding a solution that doesn't require c++11?

  12. microcai commented at 6:43 PM on November 12, 2014: none

    @laanwj Just don't know what the proper solution will be without c++11

    maybe ifdef surrounded ?

  13. theuni commented at 9:55 PM on November 24, 2014: member

    @microcai what compiler? what os? Please pastebin the entire build log. We need to figure out why you see this problem that nobody else does.

  14. theuni commented at 10:30 PM on November 24, 2014: member

    Ok, I managed to track down the problem here. It's only an issue when building bitcoin in c++11 mode, which we don't yet support. Other than this issue, bitcoin seems to build fine as c++11.

    I'm not quite sure what the correct fix is here. Here's a patch that just blindly fixes the problem: https://github.com/theuni/bitcoin/commit/b08ef0c736efab9f349df57d34883d8780f9009e

    But if we're compiling for c++11, we don't need the list_of to begin with, we can just use the generic initialization syntax. So the other obvious fix would be to ifdef for c++11 which I'd rather not do, since we'll eventually be moving to that and requiring it.

    So I think the most reasonable thing may be to take the patch above and forget about it, then the list_of's will go away after we switch to c++11.

  15. gmaxwell commented at 10:41 PM on November 24, 2014: contributor

    I'd like to understand how Microcai ended up compiling in C++11 mode in the first place?

  16. theuni commented at 11:02 PM on November 24, 2014: member

    @gmaxwell ./configure CXXFLAGS="-std=c++11".

    The thought crossed my mind (which may be what you're considering as well) that some toolchain is defaulting to c++11 now. But I really just can't imagine that's the case.

  17. laanwj closed this on Dec 16, 2014

  18. MarcoFalke 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-13 18:15 UTC

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