- changed status to open
Issues compiling with gcc7.3 with c++17
I’m currently in the process of installing Carpet via the latest repo of WhiskyTHC. See attached thornlist for details of versions.
During installation with gcc7.3 with -std=c++17, I continue to receive “error: reference to ‘data’ is ambiguous” related to the implementation of data.cc using overlapping namespaces with std (see attached make_thc.err for details).
I have obtained the same errors using Intel 2019. If I use Intel 2017, this error does not occur.
I came across issue 1121 which seemed similar in nature, but this was a much older compiler and I did not find a solution (compiler flag or the like) that would resolve the issue I was seeing. Additionally, I have attached the config file I am using which details compiler flags, declared variables etc.
Thank you for the assistance
Comments (10)
-
-
- changed version to ET_2016_11
Change version to ET release referenced in thornlist.
-
I tried reproducing this using the master branch of Carpet with the compilers available on my workstation:
- g++-9 (Debian 9.2.1-22) 9.2.1 20200104 compiles without error
- g++-8 (Debian 8.3.0-26) 8.3.0 compiles without error
- g++-7 (Debian 7.5.0-3) 7.5.0 compiles without error
Switching to ET_2016_11 I find that:
- g++-7 (Debian 7.5.0-3) 7.5.0 fails with the error your describe
- g++-8 (Debian 8.3.0-26) 8.3.0 fails with the error your describe
- g++-9 (Debian 9.2.1-22) 9.2.1 20200104 fails with the error your describe
Since the version you are using (ET_2016_11) is 3 years old, there have been quite a few changes since then. However if I had to bet I’d say that git hash 986b01b2 "Move CarpetLib types and functions into a new namespace CarpetLib" of carpet is the one that makes it work in master.
@{5b59c8ffe288ee2d9b4ba7ba} , you have some options:
- switch to use master (at least for Carpet)
- ask @David Radice whether a newer version of the ET can be used (anything starting with ET_2019_03 will do) with THC
- try and cherry pick the commit I pointed out and hope for the best
Since this is a very old release we (the ET maintainers) are unlikely to backport a fix to it.
-
I am not aware of any reason why THC should not work with a newer version of the ET: it should be only a matter of adding the thorns to the the standard ET thornlist. However, we have not tested it.
-
reporter - attached ETK1910_full.th
- attached ETK1910.cfg
- attached ETK1910_make_thc.log
- attached ETK1910_make_thc.err
Tests ran with gcc7.3, ETK repo 19_10, and Carpet repo master
-
reporter @Roland Haas thank you for your response. I have attached the files related to starting from a clean directory and pulling all files related to ETK_19_10, but with Carpet repo set to master. However, I still obtain errors related to the Carpet “data” type.
-
I get the same errors as you (gcc 7.5 as above) when compiling CarpetIOASCII. Before I had only compiled CarpetLib which compiles fine and thus I had not notice this, sorry. The error goes away when changing -
std=gnu++17
to-std=gnu++11
.Indeed a fix is to prefix the
*(data<T>*)foo
casts byCarpetLib::
to indicate the explicit namespace since the compiler cannot deduce the template based on function arguments.This pull request implements the required changes, though there may be better ways to solve this:
https://bitbucket.org/eschnett/carpet/pull-requests/32/rhaas-c-17/diff
With these changes I can compile your thornlist using
std=gnu++17
and gcc-7.5. -
Please review.
-
reporter Reviewed and can confirm the work-around proposed resolves the compile issues using gcc-7.3 with -std=gnu++17 after correcting intel linking parameters in the previously attached cfg file.
Thank you, @Roland Haas
-
- changed status to resolved
- Log in to comment