jeaye / color_coded

A vim plugin for libclang-based highlighting of C, C++, ObjC
MIT License
870 stars 53 forks source link

/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/cpp_type_traits.h:406:32: error: reference to 'move_iterator' is ambiguous #159

Closed salazardetroya closed 7 years ago

salazardetroya commented 7 years ago

I am getting these errors when doing :CCerror. I actually see some partial highlighting.

/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/cpp_type_traits.h:406:32: error: reference to 'move_iterator' is ambiguous /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/cpp_type_traits.h:406:46: error: '_Iterator' does not refer to a value /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:79:13: error: reference to 'piecewise_construct_t' is ambiguous /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:79:57: error: reference to 'piecewise_construct_t' is ambiguous /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:155:14: error: reference to 'piecewise_construct_t' is ambiguous /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:155:37: error: unknown type name 'tuple' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:155:42: error: expected ')' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:206:14: error: unknown type name 'tuple' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:206:19: error: expected ')' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:214:22: error: unknown type name 'pair' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:214:26: error: expected ')' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:215:14: error: use of undeclared identifier '__x' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:215:27: error: use of undeclared identifier '__y' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:215:40: error: use of undeclared identifier '__x' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:215:54: error: use of undeclared identifier '__y' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:220:21: error: unknown type name 'pair' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:220:25: error: expected ')' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:221:14: error: use of undeclared identifier '__x' /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/stl_pair.h:221:26: error: use of undeclared identifier '__y'

My .color_coded file: -x c++ -DNDEBUG -Dtopopt_EXPORTS -I/g/g92/miguel/code/topsm/include -I/g/g92/miguel/code/topsm/src/../include -I/g/g92/miguel/scicomp_libraries/Ipopt/include/coin -I/g/g92/miguel/workspace/libmesh/include -I/g/g92/miguel/workspace/libmesh/include/contrib -I/opt/openmpi/2.0/gnu/include -I/usr/gapps/FEniCS/petsc-3.7.6/include -I/usr/gapps/FEniCS/petsc-3.7.6/petsc_fenics/include -I/usr/workspace/wsb/miguel/VTK/include/vtk-7.1 -Wdisabled-optimization -Wno-unused-parameter -std=c++11 -isystem/opt/openmpi/2.0/gnu/include -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3 -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/x86_64-unknown-linux-gnu -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/backward -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits -isystem/usr/local/include -isystem/usr/tce/packages/clang/clang-4.0.0/rawbin/../lib/clang/4.0.0/include -isystem/usr/include

How could I debug this further? The paths with tle flag -isystem where added from the output of echo | clang -v -E -x c++ -

UnrealQuester commented 7 years ago

Do you get the same error when you compile the file with clang and the same flags as your .color_coded file? If compiling manually does not produce the same error, can you give us a little bit more information abour your system and how you compiled color_coded?

I also noticed your gcc version is quite old. Not sure if this can cause problems.

salazardetroya commented 7 years ago

Which clang should I use? The one downloaded by color_coded during the installation? I tried doing this, but it seems difficult because I would have to recompile some of my dependencies with this new clang. I am getting these errors when running configure in the dependencies:

configure:10326: /opt/openmpi/2.0/gnu/bin/mpicxx -c -std=c++11 conftest.cpp >&5 conftest.cpp:78:25: error: no member named 'is_trivially_copyable' in namespace 'std' << std::is_trivially_copyable<char>::value // Not supported by GCC 4.6.3 with -std=c++0x

The openmpi compiler /opt/openmpi/2.0/gnu/bin/mpicxx wraps around the clang compiler downloaded by color_coded by setting the environment variable OMPI_CC. Does the above error have to do with the fact that the downloaded clang does not include the standard template library? Not sure if that is even correct.

I compiled color_coded following the instructions in the page. My system LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 7.3 (Maipo) Release: 7.3 Codename: Maipo It's a cluster, I don't have admin rights.

Question: When does color coded call those directories that throw the error? i.e. /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/

Thanks

UnrealQuester commented 7 years ago

color_coded uses libclang and does not call the clang binary directly. It does therefore not know about the additional flags that the wrapper compiler adds. The FAQ for open mpi mentions that you can get the flags by calling mpicxx --showme:compile. Are these flags also included in your .color_coded config? If not, can you add them and let us know if this works?

Question: When does color coded call those directories that throw the error? i.e. /usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/bits/

color_coded simply passes the given flags to libclang and relays any errors it gets back to you. This specific directory probably comes from your -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3 include flag.

salazardetroya commented 7 years ago

The flags given by mpicxx --showme:compile are already included. I get the same error even before adding the flag -isystem/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3. How could I go about debugging this further? Thanks.

UnrealQuester commented 7 years ago

If you have clang installed on your system (preferably 3.9.0). You could try to compile the file that is giving you problems with the exact same flags from your .color_coded file. If you get the same error, the problem is most likely one or more of the flags.

If you do not get any errors it might be a problem with libclang not finding or including the correct headers. You can view the exact arguments passed to libclang by examining the arguments passed to https://github.com/jeaye/color_coded/blob/fb0e8f920978d51905c9953d900198d4e55a30bc/include/clang/compile.hpp#L28

You could add code that writes these to a file of your choice and then recompile color_coded.

jeaye commented 7 years ago

Thanks for handling this so productively, @UnrealQuester. I agree that the most important thing to answer right now is how clang works on those sources with the exact flags you're giving color_coded.

As a shot in the dark, you might try adding -stdlib=libc++ to your .color_coded. That would be a workaround to not use your system's libstdc++ headers, which may skirt the issue.

salazardetroya commented 7 years ago

Yeah, including -stdlib=libc++ solved it. Thanks!

jeaye commented 7 years ago

Glad to hear it! Thanks for hanging in there and helping solve this.