Thread overview
64 bit linker issues
Dec 22, 2012
Benjamin Thaut
Dec 22, 2012
Rainer Schuetze
Dec 23, 2012
Benjamin Thaut
December 22, 2012
I wanted to fix http://d.puremagic.com/issues/show_bug.cgi?id=8936 and I'm currently trying to compile a little repro case in x64 on windows:

import core.stdc.stdio;
import core.sys.windows.windows;

void bar()
{
	throw new Exception("Ex");
}

void foo()
{
	bar();
}

void main(string[] args)
{
  printf("%s\n", (SetCurrentDirectoryA("C:\\") != 0) ? "true".ptr : "false".ptr);
  try
  {
    // Let's serach the whole C: drive!
	foo();
  }
  catch(Exception ex)
  {
	auto info = ex.info.toString() ~ "\0";
	printf("%s\n",info.ptr);
  }
}

I compiled with the latest git master branch versions of dmd and druntime. Druntime was build with the default win64.mak.

..\..\dmd\src\dmd.exe -m64 -g -debug -w -I..\..\druntime\import -property main.d -debuglib=..\..\druntime\lib\druntime64.lib -defaultlib=..\..\druntime\lib\druntime64.lib user32.lib -L"/LIBPATH:\"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\x64\"" -L"/LIBPATH:\"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\"" -L/NOLOGO

The error message I get is:
LIBCMT.lib(amdsecgs.obj) : fatal error LNK1103: debugging information corrupt; recompile module

Compiling in release works just fine. As soon as I add -g or -gc it breaks.

Any ideas what I could have done worng?

Kind Regards
Benjamin Thaut
December 22, 2012

On 22.12.2012 13:40, Benjamin Thaut wrote:
> I wanted to fix http://d.puremagic.com/issues/show_bug.cgi?id=8936 and
> I'm currently trying to compile a little repro case in x64 on windows:
>
[...]
> I compiled with the latest git master branch versions of dmd and
> druntime. Druntime was build with the default win64.mak.
>
> ...\..\dmd\src\dmd.exe -m64 -g -debug -w -I..\..\druntime\import
> -property main.d -debuglib=..\..\druntime\lib\druntime64.lib
> -defaultlib=..\..\druntime\lib\druntime64.lib user32.lib
> -L"/LIBPATH:\"C:\Program Files (x86)\Microsoft
> SDKs\Windows\v7.0A\lib\x64\"" -L"/LIBPATH:\"C:\Program Files
> (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\"" -L/NOLOGO
>
> The error message I get is:
> LIBCMT.lib(amdsecgs.obj) : fatal error LNK1103: debugging information
> corrupt; recompile module
>
> Compiling in release works just fine. As soon as I add -g or -gc it breaks.
>
> Any ideas what I could have done worng?
>

Could be this one: https://github.com/D-Programming-Language/dmd/pull/1315

dmd might also add some library paths, try -v to see whether they conflict with your manually specified paths.
December 23, 2012
On Saturday, 22 December 2012 at 16:41:15 UTC, Rainer Schuetze wrote:
>
> Could be this one: https://github.com/D-Programming-Language/dmd/pull/1315
>
> dmd might also add some library paths, try -v to see whether they conflict with your manually specified paths.

Thanks for the tip. Adding a sc.ini next to dmd.exe did help. Without the sc.ini the compiler would call the visual studio 2008 linker. (Because its in my PATH) And obviously that one is not compatible with the 2010 version.

Kind Regards
Benjamin Thaut