bredelings / BAli-Phy

Bayesian co-estimation of phylogenies and multiple alignments via MCMC
http://www.bali-phy.org/
GNU General Public License v2.0
45 stars 16 forks source link

gcc 10.1 compilation fails, call of overloaded ptree is ambiguous #10

Closed joelb123 closed 4 years ago

joelb123 commented 4 years ago

gcc 10 has some improved pgo and lto options that might offer better performance.

However, compilation fails for me, with the message: ./BAli-Phy-3.5.0.1/src/models/rules.cc:362:51: error: call of overloaded ‘ptree()’ is ambiguous ... ./BAli-Phy-3.5.0.1/src/models/rules.cc:374:62: error: call of overloaded ‘ptree()’ is ambiguous

Compilation worked for me under gcc 9.3.0.

Build output attached.

build.log

bredelings commented 4 years ago

Thanks, I will take a look. Interesting, I am using gcc 10 already, so it could depend on the compiler options, or alternatively the problem could exist in 3.5.0.1 but not on master.

joelb123 commented 4 years ago

I just checked and I get the same thing with 3.5.0.

Using system eigen 3.3.7, boost 1.73.0, nlohmann_json 3.7.3, range-v3 0.10.0. Turning off -system on those things (range-v3 doesn't seem to have a config option) doesn't make a difference either.

joelb123 commented 4 years ago

Oh, probably more to the point is that I'm using glibc2.31

bredelings commented 4 years ago

Do you know if your version of gcc 10.1 has any extra patches, or if it is straight 10.1? I'm going to add gcc-10 to the continuous-integration tests and see if I can reproduce this.

joelb123 commented 4 years ago

Straight 10.1.0 patch 1:

gcc --version gcc (Gentoo 10.1.0 p1) 10.1.0

I strongly suspect the problem is from glibc version:

ldd --version ldd (Gentoo 2.31-r3 p5) 2.31

Unfortunately it's nearly impossible to back out a glibc version once it's installed.

bredelings commented 4 years ago

I've tested some recent branches with glibc 2.31, and I'm not seeing a problem. I'd be surprised if this was related to glibc, since the error seems to be a C++-specific issue relating to brace-enclosed initializer lists.

I also added gcc-10 to the CI testers on github actions. This uses ubuntu, and it seems to work OK.

I think the next thing is to double-check the actual 3.5.0.1 source, since I have only tested more recent branches. But it seems like there is some difference in the version of GCC 10 from Debian/Ubuntu and Gentoo.

joelb123 commented 4 years ago

On Monday I will check out the master and any other branches that you want. I can also try it on Clear Linux, which stays more aggressively up-to-date than any other distribution I work with.

joelb123 commented 4 years ago

I get this failure using both gcc 10.1 and gcc 8.4 on Gentoo using glibc 2.31 on the master branch.

I also get the same failure on the master branch using gcc 10.1.1 and glibc 2.31 under Clear Linux.

reneeotten commented 4 years ago

I am seeing the same issue on macOS when trying to build using MacPorts (version 3.5.0.1, with Apple LLVM version 10.0.1 (clang-1001.0.46.4)).

[237/337] /usr/bin/clang++ -Isrc/25a6634@@baliphy@sta -Isrc -I../bredelings-BAli-Phy-d6cb833/src -I. -I../bredelings-BAli-Phy-d6cb833 -I../bredelings-BAli-Phy-d6cb833/src/util/include -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -std=c++17 -O3 -DHAVE_CONFIG_H -Wno-sign-compare -Woverloaded-virtual -Wstrict-aliasing -Wno-unknown-pragmas -fdiagnostics-show-template-tree -DNDEBUG -DNDEBUG_DP -funroll-loops -fno-math-errno -fno-signed-zeros -fvisibility=default -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -isystem/opt/local/include/eigen3 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_RANDOM_DYN_LINK -DBOOST_ALL_NO_LIB -isystem../bredelings-BAli-Phy-d6cb833/external/range-v3/0.10.0/include -MD -MQ 'src/25a6634@@baliphy@sta/models_rules.cc.o' -MF 'src/25a6634@@baliphy@sta/models_rules.cc.o.d' -o 'src/25a6634@@baliphy@sta/models_rules.cc.o' -c ../bredelings-BAli-Phy-d6cb833/src/models/rules.cc
FAILED: src/25a6634@@baliphy@sta/models_rules.cc.o
/usr/bin/clang++ -Isrc/25a6634@@baliphy@sta -Isrc -I../bredelings-BAli-Phy-d6cb833/src -I. -I../bredelings-BAli-Phy-d6cb833 -I../bredelings-BAli-Phy-d6cb833/src/util/include -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -std=c++17 -O3 -DHAVE_CONFIG_H -Wno-sign-compare -Woverloaded-virtual -Wstrict-aliasing -Wno-unknown-pragmas -fdiagnostics-show-template-tree -DNDEBUG -DNDEBUG_DP -funroll-loops -fno-math-errno -fno-signed-zeros -fvisibility=default -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -isystem/opt/local/include/eigen3 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_RANDOM_DYN_LINK -DBOOST_ALL_NO_LIB -isystem../bredelings-BAli-Phy-d6cb833/external/range-v3/0.10.0/include -MD -MQ 'src/25a6634@@baliphy@sta/models_rules.cc.o' -MF 'src/25a6634@@baliphy@sta/models_rules.cc.o.d' -o 'src/25a6634@@baliphy@sta/models_rules.cc.o' -c ../bredelings-BAli-Phy-d6cb833/src/models/rules.cc
../bredelings-BAli-Phy-d6cb833/src/models/rules.cc:362:20: error: call to constructor of 'ptree' is ambiguous
                rules[synonym] = ptree({{"synonym",ptree(name)}});
                                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:22:8: note: candidate constructor (the implicit move constructor)
struct ptree: public std::vector<std::pair<std::string,ptree>>
       ^
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:22:8: note: candidate constructor (the implicit copy constructor)
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:125:5: note: candidate constructor
    ptree(const std::vector<std::pair<std::string,ptree>>& x):std::vector<std::pair<std::string,ptree>>(x) { }
    ^
../bredelings-BAli-Phy-d6cb833/src/models/rules.cc:374:20: error: call to constructor of 'ptree' is ambiguous
                rules[synonym] = ptree({{"deprecated-synonym",ptree(name)}});
                                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:22:8: note: candidate constructor (the implicit move constructor)
struct ptree: public std::vector<std::pair<std::string,ptree>>
       ^
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:22:8: note: candidate constructor (the implicit copy constructor)
../bredelings-BAli-Phy-d6cb833/src/util/include/util/ptree.H:125:5: note: candidate constructor
    ptree(const std::vector<std::pair<std::string,ptree>>& x):std::vector<std::pair<std::string,ptree>>(x) { }
    ^
2 errors generated.

Please let me know if you need more information - thanks for looking into this!

[UPDATE] It appears to be caused by boost: compilation is successful with boost version 1.71.0, but fails with version 1.73.0.

bredelings commented 4 years ago

[UPDATE] It appears to be caused by boost: compilation is successful with boost version 1.71.0, but fails with version 1.73.0.

Thank you! I have been mystified why this compiles for me but you not. Hopefully this will help me reproduce it.

reneeotten commented 4 years ago

[UPDATE] It appears to be caused by boost: compilation is successful with boost version 1.71.0, but fails with version 1.73.0.

Thank you! I have been mystified why this compiles for me but you not. Hopefully this will help me reproduce it.

Great - you're help is much appreciated, Happy 4th of July! It also compiles for me with boost v1.72.0, so there must be something that has changed in the latest boost.

bredelings commented 4 years ago

@joelb123 This means that you could add -Dboost=internal to the meson configure line as a temporary solution. That will use the included boost 1.72, which seems to work fine.

bredelings commented 4 years ago

I've made a new branch (3.5) and a new tag (3.5.0.2). Can you see if 3.5.0.2 fixes this issue?

reneeotten commented 4 years ago

@bredelings thank you very much - I can confirm that it compiles fine now with the latest versions of boost and GCC (on Linux) or Clang (on macOS). In both cases it also passes the test-suite, so it looks all good!

joelb123 commented 4 years ago

I also can confirm that 3.5.0.2 fixes the problem, and also that I was using boost 1.73.0 on both systems I tested this on. I think this issue can be closed.