You are here

Compile Error: no template named 'vector1'

6 posts / 0 new
Last post
Compile Error: no template named 'vector1'
#1

Hi, I'm having trouble compiling rosetta 3.5 on my Mac (running El Capitan). I've run the compilation with both clang and gcc and with different versions of both, but continue to get the same error. Here's the output:

In file included from src/apps/public/AbinitioRelax.cc:20:
In file included from src/basic/options/option.hh:18:
In file included from src/utility/options/OptionCollection.hh:31:
In file included from src/utility/options/BooleanVectorOption.hh:23:
In file included from src/utility/options/VectorOption_T_.hh:27:
In file included from src/utility/vector1.hh:20:
src/utility/vector1.fwd.hh:44:41: error: no type named 'allocator' in namespace
      'std'
template< typename T, typename A = std::allocator< T > > class vector1;
                                   ~~~~~^
src/utility/vector1.fwd.hh:44:50: error: expected ',' or '>' in
      template-parameter-list
template< typename T, typename A = std::allocator< T > > class vector1;
                                                 ^
src/utility/vector1.fwd.hh:44:56: error: expected unqualified-id
template< typename T, typename A = std::allocator< T > > class vector1;
                                                       ^
src/utility/vector1.fwd.hh:48:10: error: no template named 'vector1'; did you
      mean 'std::vector'?
typedef  vector1< bool >                vector1_bool;
         ^~~~~~~
         std::vector
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1244:75: note:
      'std::vector' declared here
  ...<class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector;
                                                                  ^
In file included from src/apps/public/AbinitioRelax.cc:20:
In file included from src/basic/options/option.hh:18:
In file included from src/utility/options/OptionCollection.hh:31:
In file included from src/utility/options/BooleanVectorOption.hh:23:
In file included from src/utility/options/VectorOption_T_.hh:27:
In file included from src/utility/vector1.hh:20:
src/utility/vector1.fwd.hh:49:10: error: no template named 'vector1'; did you
      mean 'std::vector'?
typedef  vector1< short int >           vector1_short;
         ^~~~~~~
         std::vector
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1244:75: note:
      'std::vector' declared here
  ...<class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector;
                                                                  ^

 

The vector error then repeats until the error limit is reached and compilation fails. Any help would be appreciated!

Category: 
Post Situation: 
Fri, 2016-06-24 08:38
rmrao

Why are you trying to use Rosetta 3.5?  Try a more recent verison and see if it works better?  3.5 is pretty old, and El Capitan is pretty new, so it's probably a newer-compiler-than-the-code problem.

Fri, 2016-06-24 08:49
smlewis

I'm working on a project where our algorithm needs to integrate with Rosetta and it was designed to work with Rosetta 3.5. So upgrading Rosetta would probably fix this issue but could potentially break a lot of other things that we need. I was hoping that figuring out how to compile this would be easier than fixing those problems. If this is intractable though, I will probably have to upgrade.

Fri, 2016-06-24 09:00
rmrao

Failing on vector1 means that's it's compiler vomiting, not some specific bug that we can try to fix (in other words, probably the C++ libraries don't match the compiler version or something - you did say you'd tried several).

This error in particular:

src/utility/vector1.fwd.hh:44:41: error: no type named 'allocator' in namespace
      'std'

This makes me think that the C++ std library isn't getting loaded, which means that the compiler and its libaries are misconfigured (or Rosetta is viewing them in a misconfigured fashion, or both).  Otherwise std::allocator would exist.

You've tried "several compilers and versions" - with the cxx and cxx_ver arguments to scons, or by directly writing them into the main/source/tools/build settings files?

How confident are you that any given compiler version is functional (have you tested it on something else, even hello world?)

My laptop is capitan, Apple LLVM version 7.3.0 (clang-703.0.31).  I'll see how 3.5 behaves, I guess.

 

Fri, 2016-06-24 10:11
smlewis

I get an entirely different set of compiler vomits, with only one version of clang installed.  

Fri, 2016-06-24 10:34
smlewis

As Steven says, I think it's a compiler issue.

Particularly, I'm thinking it might be a libstdc++ vs libc++ issue. MacOS changed which C++ standard library is used, about the same time that Rosetta3.5 was released. That means that El Capitan is using the new library, but the settings for Rosetta are assuming the old library.

You probably want to go into rosetta-3.5/rosetta_source/tools/build/basic.settings  and make the "clang, macos" block (around line 1278) looks something like the following. 

      "clang, macos" : {                                                            
          "appends" : {                                                             
              "flags" : {                                                                                                     
                  "compile" : [ "march=native", "mtune=native", "stdlib=libc++", ], 
                  "shlink" : [ "install_name ${TARGET.abspath}", "stdlib=libc++", ],
                  "link"   : [ "stdlib=libc++"],                                    
                  "cxx" : [ "std=c++11" ],                                          
                  "warn" : ["Wno-unused-variable"],                                 
              },                                                                                                       
          },                                                                        
          "removes" : {                                                             
              "flags" : {                                                           
                  "link" : [ "$__RPATH", "stdlib=libstdc++", ],                     
                  "cxx" : [ "std=c++98", "std=c++0x", ],                            
                  "shlink" : [ "$LINKFLAGS", "stdlib=libstdc++", ],                 
                  "link"   : [ "stdlib=libstdc++", ],                               
              },                                                                                                            
          },                                                                        
      },                                                                             

 

When you run scons, you'll also want to make sure you add "cxx=clang" to the scons commandline, to tell Rosetta/scons.py that you want to use the (now default) clang compiler on MacOS, rather than trying to do something with GCC. (GCC on Macs is somewhat funky - there's versions of GCC that aren't really GCC, but rather clang pretending to be GCC for compatibility purposes.)

CAVEAT: I don't have a mac, so I can't/havne't tried the above to see if it will work.

Mon, 2016-06-27 08:32
rmoretti