首先,我对此很新。 我正在尝试编译T1架构和模拟建模工具(http://www.oracle.com/technetwork/systems/opensparc/opensparc-t1-page-1444609.html),使用Sun Studio 12.3作为Solaris 10上的编译器和Sparc处理器。
我正在运行脚本“build_sas.sh”并遇到编译错误。
--- Building n1 in fw ---
/opt/solarisstudio12.3/bin/CC -G -KPIC -fast -xO5 -DNDEBUG -DRS_INLINE=inline -DRS_MPSAS_COMPATIBLE -xarch=v9a -DHOST64BIT=1 -DN1_BOOTS10 -DMEMORY_SPARSE -I../../include/fw -I../../include/mmu -I../../include/strand -I../../include/core -I../../include/cpu -I../../include/asi -I../../include/system -I../../include/trap -I/scratch/sam-t1/devtools/64/include/python2.4 -c -o obj64opt_n1/Interface/XmlTokenizer.o Interface/XmlTokenizer.cc
CC: Warning: -xarch=v9a is deprecated, use -m64 -xarch=sparcvis instead
"Interface/XmlTokenizer.cc", line 157: Error: Formal argument value of type std::string & in call to Riesling::XmlTokenizer::CallBack::notify(std::string &) requires an lvalue.
"Interface/XmlTokenizer.cc", line 162: Error: Formal argument value of type std::string & in call to Riesling::XmlTokenizer::CallBack::notify(std::string &) requires an lvalue.
"Interface/XmlTokenizer.cc", line 167: Error: Formal argument value of type std::string & in call to Riesling::XmlTokenizer::CallBack::notify(std::string &) requires an lvalue.
3 Error(s) detected.
*** Error code 2
make: Fatal error: Command failed for target `obj64opt_n1/Interface/XmlTokenizer.o'
Current working directory /scratch/sam-t1/src/riesling-cm/riesling/src/fw
*** Error code 1
make: Fatal error: Command failed for target `fw'
我不确定源代码中的错误是什么。这是源代码:
#include "Interface/XmlTokenizer.h"
#include "StdMacros.h"
#include <sstream>
using namespace std;
using namespace Riesling;
XmlTokenizer::XmlTokenizer() :
startTagHandler_(NULL),
endTagHandler_(NULL),
dataHandler_(NULL)
{}
XmlTokenizer::XmlTokenizer( string &xmlString,
CallBack *start,
CallBack *end,
CallBack *data ) :
startTagHandler_(start),
endTagHandler_(end),
dataHandler_(data)
{
tokenize( xmlString );
}
XmlTokenizer::XmlTokenizer( const XmlTokenizer & orig ) :
startTagHandler_(orig.startTagHandler_),
endTagHandler_(orig.endTagHandler_),
dataHandler_(orig.dataHandler_)
{}
XmlTokenizer::~XmlTokenizer()
{}
const XmlTokenizer &
XmlTokenizer::operator=( const XmlTokenizer & rhs )
{
startTagHandler_ = rhs.startTagHandler_;
endTagHandler_ = rhs.endTagHandler_;
dataHandler_ = rhs.dataHandler_;
return *this;
}
bool
XmlTokenizer::operator==( const XmlTokenizer & rhs ) const
{
return endTagHandler_ == rhs.endTagHandler_ &&
startTagHandler_ == rhs.startTagHandler_ &&
dataHandler_ == rhs.dataHandler_;
}
string
XmlTokenizer::toString() const
{
ostringstream os;
return os.str();
}
int
XmlTokenizer::nextToken( string::iterator &start,
string::iterator &end,
const string::iterator &endOfString )
{
int result = -1;
start = end;
while( start != endOfString && *start != '<' && *start != '>' ){
++start;
if( *start == '\\' && start != endOfString ){
++start;
}
}
if( start == endOfString ){
return END_OF_STRING;
}
end = start;
++end;
while( end != endOfString && *end != '<' && *end != '>' ){
++end;
if( *end == '\\' && end != endOfString ){
++end;
}
}
if( end == endOfString ){
return END_OF_STRING;
}
if( *start == '<' && *end == '>' ){
string::iterator i = start;
while( i != end && *i != '/' ){
++i;
}
if( i == end ){
result = START_TAG;
} else {
result = END_TAG;
}
} else if( *start == '>' && *end == '<' ) {
++start;
result = DATA;
} else {
string msg( "Invalid XML \"" );
msg.append( string( start, end ) ).append( "\"" );
RIESLING_THROW_DOMAIN_ERROR( msg );
}
return result;
}
void
XmlTokenizer::tokenize( string &xmlSt)
{
int currToken;
string::iterator start = xmlSt.begin();
string::iterator end = xmlSt.begin();
while( (currToken = nextToken(start, end, xmlSt.end())) != END_OF_STRING ) {
switch( currToken ){
case START_TAG:
if( startTagHandler_ ){
startTagHandler_->notify( string( start + 1, end ) );
}
break;
case END_TAG:
if( endTagHandler_ ){
endTagHandler_->notify( string( start + 2, end ) );
}
break;
case DATA:
if( dataHandler_ ){
dataHandler_->notify( string( start, end ) );
}
break;
default:
RIESLING_THROW_DOMAIN_ERROR( "An unknown error occured" );
}
}
}
void
XmlTokenizer::setStartTagHandler( CallBack *startTagHandler )
{
startTagHandler_ = startTagHandler;
}
void
XmlTokenizer::setEndTagHandler( CallBack *endTagHandler )
{
endTagHandler_ = endTagHandler;
}
void
XmlTokenizer::setDataHandler( CallBack *dataHandler )
{
dataHandler_ = dataHandler;
}
我非常感谢您的帮助/建议。
由于
答案 0 :(得分:0)
尝试使用编译器选项-features=rvalueref
。软件附带没有构建说明吗?
答案 1 :(得分:0)
您强制使用-xarch=sparcvis
的SPARC VIS扩展指令,这些指令未包含在T1中。 VIS和VIS +是UltraSPARC III + IV +特定的。运行isainfo -bv
以查看CPU支持的内容。如果不进行交叉编译,请使用-xarch=native
。