View previous topic :: View next topic |
Author |
Message |
kfo
Joined: 09 Apr 2011 Posts: 8
|
Posted: Wed Jul 04, 2012 8:20 pm Post subject: Linking issues with c2d |
|
|
I am building VisualD from source for Visual Studio 2010 SP1 and running into a linker problem:
Code: |
Building ..\bin\Debug\VisualD.dll...
OPTLINK (R) for Win32 Release 8.00.5
Copyright (C) Digital Mars 1989-2009 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\Users\kfo\Projects\visuald\stdext\..\bin\Debug\stdext.lib
Warning 140: Library probably needs FIXLIB
C:\D\git\phobos\phobos.lib(object) Offset 132E7H Record Type 0091
Error 1: Previous Definition Different : _D38C:\D\git\druntime\import\object.di.16012__ModuleInfoZ
C:\D\git\phobos\phobos.lib(object) Offset 13360H Record Type 00C3
Error 1: Previous Definition Different : _D38C:\D\git\druntime\import\object.di.1607__arrayZ
C:\D\git\phobos\phobos.lib(object) Offset 1338AH Record Type 00C3
Error 1: Previous Definition Different : _D38C:\D\git\druntime\import\object.di.1608__assertFiZv
C:\D\git\phobos\phobos.lib(object) Offset 133B4H Record Type 00C3
Error 1: Previous Definition Different : _D38C:\D\git\druntime\import\object.di.16015__unittest_failFiZv
--- errorlevel 4
profiler.d(599): profiler._demangle uses compatibility mode, this won't allow disabling type info
Building ..\bin\Debug\VisualD.dll failed!
|
I have found these symbols are duplicated inside of c2d.lib. Any clues how the phobos/druntime symbols are making it into the c2d.lib? |
|
Back to top |
|
|
sagitario
Joined: 03 Mar 2007 Posts: 292
|
Posted: Sat Jul 07, 2012 6:51 am Post subject: |
|
|
Hi,
sorry for the late reply, unfortunately there is no email notification for new topics.
What dmd version are you using? From the optlink version 8.00.5 I suspect it is rather old. I don't bother keeping Visual D compilable with older versions.
Maybe there are even different versions mixed up (which would explain the error messages). I think symbols from object.d might end up in another library if it instantiates templates from this file.
Rainer |
|
Back to top |
|
|
kfo
Joined: 09 Apr 2011 Posts: 8
|
Posted: Sat Jul 07, 2012 12:00 pm Post subject: |
|
|
I am using the latest from git.
Code: |
PS C:\d\git\dmd> dmd_msc
DMD32 D Compiler v2.060
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.dlang.org/index.html
|
When compiling with the normal dmd I am running into the following:
Code: |
------ Build started: Project: parser, Configuration: Debug Win32 ------
Building ..\bin\Debug\parser.lib...
Fatal Error: Out of memoryBuilding ..\bin\Debug\parser.lib failed!
|
So I figured there must be a reason why the projects were set up to use the VC++ compiled dmd_msc. First I tried using 4gb_patch, but this had the same result. After fixing up the errors in the latest dmd_msc (files are currently out of sync and there are a couple minor compile errors) I have recompiled druntime and phobos using dmd_msc, then attempted to build VisualD with dmd_msc too. The result is linking errors in my first post.
sagitario wrote: | From the optlink version 8.00.5 I suspect it is rather old. I don't bother keeping Visual D compilable with older versions. |
I don't usually track the changes in dmc and optlink, but I have downloaded the latest. The latest optlink I can find is from the latest dm852c package at digitalmars, which is 8.00.5. Do you know of newer versions? |
|
Back to top |
|
|
sagitario
Joined: 03 Mar 2007 Posts: 292
|
Posted: Sun Jul 08, 2012 1:06 am Post subject: |
|
|
kfo wrote: | So I figured there must be a reason why the projects were set up to use the VC++ compiled dmd_msc. First I tried using 4gb_patch, but this had the same result. After fixing up the errors in the latest dmd_msc (files are currently out of sync and there are a couple minor compile errors) I have recompiled druntime and phobos using dmd_msc, then attempted to build VisualD with dmd_msc too. The result is linking errors in my first post. |
I could compile dmd_msc without problems (a pull request to fix compile issues has been merged recently).
The patch to stock dmd is necessary, but please note that you must run a 64-bit OS or boot with the /3GB switch on XP for the patch to have an effect. (I guess I should mention this in the build instructions.)
The version included in dmd distributions is 8.00.12. I tried the 8.00.5 version, but it only produced the warning about FIXLIB.
Maybe you should try a clean rebuild. Also make sure the sc.ini file is referencing your latest build of the phobos library. |
|
Back to top |
|
|
kfo
Joined: 09 Apr 2011 Posts: 8
|
Posted: Sun Jul 08, 2012 5:00 pm Post subject: |
|
|
I managed to get it to link after turning off "Generate Unittest Code" for c2d and cpp2d. It is left on for the remaining projects. I still don't fully understand this problem.
A small correction to the build from source page:
Quote: |
Put the files from trunk\nsis\extensions into the folder $(APPDATA)\Local\Microsoft\VisualStudio\10.0\Extensions\VisualD
|
They need to go into the folder that is created after creating the new settings branch, e.g:
Quote: |
Put the files from trunk\nsis\extensions into the folder $(APPDATA)\Local\Microsoft\VisualStudio\10.0D\Extensions\VisualD
|
|
|
Back to top |
|
|
sagitario
Joined: 03 Mar 2007 Posts: 292
|
Posted: Mon Jul 09, 2012 12:38 am Post subject: |
|
|
kfo wrote: | I managed to get it to link after turning off "Generate Unittest Code" for c2d and cpp2d. It is left on for the remaining projects. I still don't fully understand this problem.
|
Good to hear it builds now.
It seems the unittest code in object.di is also generated into the library (why is there a unittest in the di file anyway?).
Unittests in a library are a problem per se because they usually don't get linked into the binary anyway. There is a dirty hack in cpp2d_main.d to include them nonetheless.
Thanks, I have changed that and also added a statement about the need to patch/rebuild the compiler.
Rainer |
|
Back to top |
|
|
|