Thread overview
Error Message "ModuleInfo class is incorrect"
Dec 05, 2013
Mike
Dec 05, 2013
Kai Nacke
Dec 05, 2013
Mike
Dec 05, 2013
Kai Nacke
December 05, 2013
I'm trying to port the D Runtime, incrementally, to the ARM Cortex-M (thumb2) platform.  But after bringing object.d in, I'm getting this error message:

"object.d ModuleInfo class is incorrect"

Looking through LDC's source code, I found the following in toobj.cpp

// check for patch
else
{
#if DMDV2
	unsigned sizeof_ModuleInfo = 16 * PTRSIZE;
#else
	unsigned sizeof_ModuleInfo = 14 * PTRSIZE;
#endif
	if (sizeof_ModuleInfo != moduleinfo->structsize)
	{
	error("object.d ModuleInfo class is incorrect");
	fatal();
	}
}

I'm not sure if PTRSIZE is not properly defined for my platform, or if I need to make changes to ModuleInfo, or some other problem.

Please advise.

Thanks,
Mike
December 05, 2013
Hi Mike!

On Thursday, 5 December 2013 at 01:11:13 UTC, Mike wrote:
> I'm trying to port the D Runtime, incrementally, to the ARM Cortex-M (thumb2) platform.  But after bringing object.d in, I'm getting this error message:
>
> "object.d ModuleInfo class is incorrect"
>
> Looking through LDC's source code, I found the following in toobj.cpp
>
> // check for patch
> else
> {
> #if DMDV2
> 	unsigned sizeof_ModuleInfo = 16 * PTRSIZE;
> #else
> 	unsigned sizeof_ModuleInfo = 14 * PTRSIZE;
> #endif
> 	if (sizeof_ModuleInfo != moduleinfo->structsize)
> 	{
> 	error("object.d ModuleInfo class is incorrect");
> 	fatal();
> 	}
> }

Are you sure you are looking at a LDC source file? driver/toobj.cpp does not contain this piece of code. The error message is produced in gen/module.cpp.

> I'm not sure if PTRSIZE is not properly defined for my platform, or if I need to make changes to ModuleInfo, or some other problem.
>
> Please advise.

Did you change object.d_/object.di? Is the file really read? (use -v) If you could post a command line then I could try to figure out what is happening here.

Regards,
Kai
December 05, 2013
On Thursday, 5 December 2013 at 07:06:48 UTC, Kai Nacke wrote:
> Hi Mike!
>
> On Thursday, 5 December 2013 at 01:11:13 UTC, Mike wrote:
>> I'm trying to port the D Runtime, incrementally, to the ARM Cortex-M (thumb2) platform.  But after bringing object.d in, I'm getting this error message:
>>
>> "object.d ModuleInfo class is incorrect"
>>
>> Looking through LDC's source code, I found the following in toobj.cpp
>>
>> // check for patch
>> else
>> {
>> #if DMDV2
>> 	unsigned sizeof_ModuleInfo = 16 * PTRSIZE;
>> #else
>> 	unsigned sizeof_ModuleInfo = 14 * PTRSIZE;
>> #endif
>> 	if (sizeof_ModuleInfo != moduleinfo->structsize)
>> 	{
>> 	error("object.d ModuleInfo class is incorrect");
>> 	fatal();
>> 	}
>> }
>
> Are you sure you are looking at a LDC source file? driver/toobj.cpp does not contain this piece of code. The error message is produced in gen/module.cpp.
>
>> I'm not sure if PTRSIZE is not properly defined for my platform, or if I need to make changes to ModuleInfo, or some other problem.
>>
>> Please advise.
>
> Did you change object.d_/object.di? Is the file really read? (use -v) If you could post a command line then I could try to figure out what is happening here.
>
> Regards,
> Kai

Well, I sat down today and ran the same build script I wrote last night, and the error is gone.  I can't even figure out how to get it to reappear.  I must have done something stupid.

I'm sorry for the distraction.
December 05, 2013
On Thursday, 5 December 2013 at 13:26:40 UTC, Mike wrote:
> I'm sorry for the distraction.

You're welcome.

Are you aware of this issue? https://github.com/ldc-developers/ldc/issues/551

Maybe there is potential to join forces.

Regards,
Kai