Dparser link error
Knud Soerensen
4tuu4k002 at sneakemail.com
Sat Mar 24 22:29:31 PDT 2007
On Tue, 20 Mar 2007 23:44:16 +0100, Frits van Bommel wrote:
> Knud Soerensen wrote:
>> Hi
>>
>> I am trying to link the mars.d program which come with Dparser and i
>> get the following errors.
>>
> [snip]: undefined reference to `_D22TypeInfo_B10AaAaAaAaAa6__initZ'
>> collect2: ld returned 1 exit status
>> --- errorlevel 1
>>
>> Does anybody know what the problem is ??
>
> That's the TypeInfo for a tuple(char[],char[],char[],char[],char[]),
> probably from:
>
>> .errorLoc(loc, "%s at %s conflicts with %s at %s",
>> s1.toPrettyChars(), s1.locToChars(), s2.toPrettyChars(),
>> s2.locToChars());
>
> Is that function by any chance declared as something like "void
> errorLoc(Loc, ...)"?
> (IIRC TypeInfo for tuples is used to pass varargs, and this is the only
> function call with >= 5 parameters)
>
>
Yes, it is defined like
// print an error message for a location void errorLoc( Loc loc, ... )
{
if( !global.gag )
{
doError(loc, _arguments, _argptr);
}
}
> As to why that TypeInfo doesn't get emitted, that may be a long story.
> What is your compiler command line? (including compiler please)
dmd mars.d -I../ ../dparser/dparser.*.o ArgParser.o gcc mars.o
../dparser/dparser.dmd.Aggregate.o ../dparser/dparser.dmd.Array.o
../dparser/dparser.dmd.Attrib.o ../dparser/dparser.dmd.BackEnd.o
../dparser/dparser.dmd.Class.o ../dparser/dparser.dmd.Condition.o
../dparser/dparser.dmd.Declaration.o ../dparser/dparser.dmd.Doc.o
../dparser/dparser.dmd.Dump.o ../dparser/dparser.dmd.entity.o
../dparser/dparser.dmd.Enum.o ../dparser/dparser.dmd.Expression.o
../dparser/dparser.dmd.Func.o ../dparser/dparser.dmd.globals.o
../dparser/dparser.dmd.Identifier.o ../dparser/dparser.dmd.ID.o
../dparser/dparser.dmd.impcnvtab.o ../dparser/dparser.dmd.Import.o
../dparser/dparser.dmd.Initializer.o ../dparser/dparser.dmd.Inline.o
../dparser/dparser.dmd.Keyword.o ../dparser/dparser.dmd.Lexer.o
../dparser/dparser.dmd.Macro.o ../dparser/dparser.dmd.Module.o
../dparser/dparser.dmd.OutBuffer.o ../dparser/dparser.dmd.Package.o
../dparser/dparser.dmd.Parse.o ../dparser/dparser.dmd.Root.o
../dparser/dparser.dmd.Scope.o ../dparser/dparser.dmd.ScopeSymbol.o
../dparser/dparser.dmd.Statement.o ../dparser/dparser.dmd.StaticAssert.o
../dparser/dparser.dmd.Struct.o ../dparser/dparser.dmd.Symbol.o
../dparser/dparser.dmd.Template.o ../dparser/dparser.dmd.Token.o
../dparser/dparser.dmd.Tokens.o ../dparser/dparser.dmd.TypeInfo.o
../dparser/dparser.dmd.Type.o ../dparser/dparser.dmd.Types.o
../dparser/dparser.dmd.unialpha.o ../dparser/dparser.dmd.Version.o
../dparser/dparser.DParser.o ../dparser/dparser.Error.o
../dparser/dparser.SymbolDisplay.o ../dparser/dparser.SymbolListing.o
../dparser/dparser.Visitor.o ArgParser.o -o mars -m32 -lphobos -lpthread
-lm -Xlinker -L/home/knud/dsss/lib ../dparser/dparser.dmd.Aggregate.o: In
function
`_D7dparser3dmd9Aggregate11accessCheckFS7dparser3dmd4Root3LocC7dparser3dmd5Scope5ScopeC7dparser3dmd10Expression10ExpressionC7dparser3dmd11Declaration11DeclarationZv':
../dparser/dmd/Aggregate.d:(.gnu.linkonce.t_D7dparser3dmd9Aggregate11accessCheckFS7dparser3dmd4Root3LocC7dparser3dmd5Scope5ScopeC7dparser3dmd10Expression10ExpressionC7dparser3dmd11Declaration11DeclarationZv+0xad):
undefined reference to `_D22TypeInfo_B10AaAaAaAaAa6__initZ'
../dparser/dparser.dmd.ScopeSymbol.o: In function
`_D7dparser3dmd11ScopeSymbol12ScopeDSymbol15multiplyDefinedFS7dparser3dmd4Root3LocC7dparser3dmd6Symbol7DSymbolC7dparser3dmd6Symbol7DSymbolZv':
../dparser/dmd/ScopeSymbol.d:(.gnu.linkonce.t_D7dparser3dmd11ScopeSymbol12ScopeDSymbol15multiplyDefinedFS7dparser3dmd4Root3LocC7dparser3dmd6Symbol7DSymbolC7dparser3dmd6Symbol7DSymbolZv+0x85):
undefined reference to `_D22TypeInfo_B10AaAaAaAaAa6__initZ' collect2: ld
returned 1 exit status
--- errorlevel 1
> Do you use -c to compile files one-by-one and then link or do you just
> pass all files at the same time? Whichever it is, does this error
> disappear if you switch?
no
dmd -c mars.d -I..
dmd mars.o ../dparser/dparser.*.o ArgParser.o gcc mars.o
../dparser/dparser.dmd.Aggregate.o ../dparser/dparser.dmd.Array.o
../dparser/dparser.dmd.Attrib.o ../dparser/dparser.dmd.BackEnd.o
../dparser/dparser.dmd.Class.o ../dparser/dparser.dmd.Condition.o
../dparser/dparser.dmd.Declaration.o ../dparser/dparser.dmd.Doc.o
../dparser/dparser.dmd.Dump.o ../dparser/dparser.dmd.entity.o
../dparser/dparser.dmd.Enum.o ../dparser/dparser.dmd.Expression.o
../dparser/dparser.dmd.Func.o ../dparser/dparser.dmd.globals.o
../dparser/dparser.dmd.Identifier.o ../dparser/dparser.dmd.ID.o
../dparser/dparser.dmd.impcnvtab.o ../dparser/dparser.dmd.Import.o
../dparser/dparser.dmd.Initializer.o ../dparser/dparser.dmd.Inline.o
../dparser/dparser.dmd.Keyword.o ../dparser/dparser.dmd.Lexer.o
../dparser/dparser.dmd.Macro.o ../dparser/dparser.dmd.Module.o
../dparser/dparser.dmd.OutBuffer.o ../dparser/dparser.dmd.Package.o
../dparser/dparser.dmd.Parse.o ../dparser/dparser.dmd.Root.o
../dparser/dparser.dmd.Scope.o ../dparser/dparser.dmd.ScopeSymbol.o
../dparser/dparser.dmd.Statement.o ../dparser/dparser.dmd.StaticAssert.o
../dparser/dparser.dmd.Struct.o ../dparser/dparser.dmd.Symbol.o
../dparser/dparser.dmd.Template.o ../dparser/dparser.dmd.Token.o
../dparser/dparser.dmd.Tokens.o ../dparser/dparser.dmd.TypeInfo.o
../dparser/dparser.dmd.Type.o ../dparser/dparser.dmd.Types.o
../dparser/dparser.dmd.unialpha.o ../dparser/dparser.dmd.Version.o
../dparser/dparser.DParser.o ../dparser/dparser.Error.o
../dparser/dparser.SymbolDisplay.o ../dparser/dparser.SymbolListing.o
../dparser/dparser.Visitor.o ArgParser.o -o mars -m32 -lphobos -lpthread
-lm -Xlinker -L/home/knud/dsss/lib ../dparser/dparser.dmd.Aggregate.o: In
function
`_D7dparser3dmd9Aggregate11accessCheckFS7dparser3dmd4Root3LocC7dparser3dmd5Scope5ScopeC7dparser3dmd10Expression10ExpressionC7dparser3dmd11Declaration11DeclarationZv':
../dparser/dmd/Aggregate.d:(.gnu.linkonce.t_D7dparser3dmd9Aggregate11accessCheckFS7dparser3dmd4Root3LocC7dparser3dmd5Scope5ScopeC7dparser3dmd10Expression10ExpressionC7dparser3dmd11Declaration11DeclarationZv+0xad):
undefined reference to `_D22TypeInfo_B10AaAaAaAaAa6__initZ'
../dparser/dparser.dmd.ScopeSymbol.o: In function
`_D7dparser3dmd11ScopeSymbol12ScopeDSymbol15multiplyDefinedFS7dparser3dmd4Root3LocC7dparser3dmd6Symbol7DSymbolC7dparser3dmd6Symbol7DSymbolZv':
../dparser/dmd/ScopeSymbol.d:(.gnu.linkonce.t_D7dparser3dmd11ScopeSymbol12ScopeDSymbol15multiplyDefinedFS7dparser3dmd4Root3LocC7dparser3dmd6Symbol7DSymbolC7dparser3dmd6Symbol7DSymbolZv+0x85):
undefined reference to `_D22TypeInfo_B10AaAaAaAaAa6__initZ' collect2: ld
returned 1 exit status
--- errorlevel 1
However if I do.
dmd mars.d -I../ ../dparser/DParser.d ../dparser/Error.d
../dparser/SymbolDisplay.d ../dparser/SymbolListing.d
../dparser/Visitor.d ../dparser/dmd/Aggregate.d
../dparser/dmd/entity.d ../dparser/dmd/Initializer.d
../dparser/dmd/Package.d ../dparser/dmd/Template.d ../dparser/dmd/Array.d
../dparser/dmd/Enum.d ../dparser/dmd/Inline.d
../dparser/dmd/Parse.d ../dparser/dmd/Token.d ../dparser/dmd/Attrib.d
../dparser/dmd/Expression.d ../dparser/dmd/Keyword.d
../dparser/dmd/Root.d ../dparser/dmd/Tokens.d ../dparser/dmd/BackEnd.d
../dparser/dmd/Func.d ../dparser/dmd/Lexer.d ../dparser/dmd/Scope.d
../dparser/dmd/Type.d ../dparser/dmd/Class.d
../dparser/dmd/globals.d ../dparser/dmd/Link.d
../dparser/dmd/ScopeSymbol.d ../dparser/dmd/TypeInfo.d
../dparser/dmd/Condition.d ../dparser/dmd/ID.d
../dparser/dmd/Macro.d ../dparser/dmd/Statement.d ../dparser/dmd/Types.d
../dparser/dmd/Declaration.d ../dparser/dmd/Identifier.d
../dparser/dmd/StaticAssert.d ../dparser/dmd/unialpha.d
../dparser/dmd/Doc.d ../dparser/dmd/impcnvtab.d
../dparser/dmd/Module.d ../dparser/dmd/Struct.d ../dparser/dmd/Version.d
../dparser/dmd/Dump.d ../dparser/dmd/Import.d
../dparser/dmd/OutBuffer.d ../dparser/dmd/Symbol.d ArgParser.d
everything compiles ok.
More information about the Digitalmars-d-learn
mailing list