FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Building with rdmd fails because of .di files

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
OlaA



Joined: 10 May 2008
Posts: 2

PostPosted: Sat Apr 23, 2011 1:52 am    Post subject: Building with rdmd fails because of .di files Reply with quote

My setup:
Using dmd v2.052
Derelict2 built from latest source

I have this file called test.d:
Code:
import std.stdio;

import derelict.sdl.sdl;

pragma(lib, "DerelictSDL.lib");
pragma(lib, "DerelictUtil.lib");


void main()
{
  writeln("testing");
 
  DerelictSDL.load();
}

which builds just fine with dmd test.d.

However, with rdmd test.d I get a bunch of linker errors:
Quote:
F:\source\D>rdmd --chatty test.d
dmd -v -o- "test.d" >test.d.deps
dmd -of"C:\Users\Eier\AppData\Local\Temp\.rdmd\test-d-6A2C6F6A210CEEC8EB8C2051AAFD3FE3.exe" -od"C:\Users\Eier\AppData\Local\Temp\.rdmd\rdmd-test.d-6A2C6F6A210CEEC8EB8C2051AAFD3FE3" "test.d" "f:\source\d\derelict2\import\derelict\sdl\sdltypes.di" "f:\source\d\derelict2\import\derelict\util\wintypes.di" "f:\source\d\derelict2\import\derelict\sdl\sdl.di" "f:\source\d\derelict2\import\derelict\util\sharedlib.di" "f:\source\d\derelict2\import\derelict\sdl\sdlfuncs.di" "f:\source\d\derelict2\import\derelict\util\loader.di" "f:\source\d\derelict2\import\derelict\util\exception.di" "f:\source\d\derelict2\import\derelict\util\compat.di"
OPTLINK (R) for Win32 Release 8.00.8
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
f:\source\d\derelict2\lib\DerelictSDL.lib(sdl) Offset 02577H Record Type 0091
Error 1: Previous Definition Different : _D8derelict3sdl3sdl17DerelictSDLLoader6__initZ
f:\source\d\derelict2\lib\DerelictSDL.lib(sdl) Offset 025ACH Record Type 0091
Error 1: Previous Definition Different : _D8derelict3sdl3sdl17DerelictSDLLoader7__ClassZ
f:\source\d\derelict2\lib\DerelictSDL.lib(sdl) Offset 036DEH Record Type 0091
Error 1: Previous Definition Different : _D8derelict3sdl3sdl17DerelictSDLLoader6__vtblZ
f:\source\d\derelict2\lib\DerelictSDL.lib(sdl) Offset 03B8FH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict3sdl3sdl17DerelictSDLLoader6__ctorMFZC8derelict3sdl3sdl17DerelictSDLLoader
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE2BCH Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader6__initZ
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE2F3H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader7__ClassZ
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE56CH Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader6__vtblZ
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE5C1H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader4loadMFZv
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE7B4H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader4loadMFAAyaZv
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE7EAH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader6unloadMFZv
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE80DH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader8isLoadedMFZb
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE82BH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader10loadSymbolMFAyaZPv
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE8A0H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader3libMFZC8derelict4util9sharedlib9SharedLib
f:\source\d\derelict2\lib\DerelictUtil.lib(loader) Offset AE8B5H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util6loader15SharedLibLoader8bindFuncMFPPvAyabZv
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF4C6H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib6__initZ
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF4F9H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib7__ClassZ
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF79BH Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib6__vtblZ
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF79DH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib6__ctorMFZC8derelict4util9sharedlib9SharedLib
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF7AFH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib4nameMFZAya
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF7C7H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib8isLoadedMFZb
f:\source\d\derelict2\lib\DerelictUtil.lib(sharedlib) Offset AF9B7H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9sharedlib9SharedLib10loadSymbolMFAyabZPv
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B0774H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException6__initZ
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B07B5H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException7__ClassZ
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B09F2H Record Type 0091
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException6__vtblZ
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B0D11H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException6__ctorMFAyaZC8derelict4util9exception22SharedLibLoadExcep
tion
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B0D5AH Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException6__ctorMFAyaAyaZC8derelict4util9exception22SharedLibLoadException
f:\source\d\derelict2\lib\DerelictUtil.lib(exception) Offset B0D96H Record Type 00C3
Error 1: Previous Definition Different : _D8derelict4util9exception22SharedLibLoadException13sharedLibNameMFZAya
--- errorlevel 27


The problem seems to be the second call to dmd, where rdmd adds a bunch of Derelict .di files in addition to test.d.

Remembering something about problems with .di files, I replaced those in the derelict import directory with the original .d files. That made it work!

I don't know if this is a problem with how .di files are generated or how derelict is set up, but would it be possible to just put the .d files instead of the .di files in the import directories when building derelict?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Apr 23, 2011 5:20 am    Post subject: Re: Building with rdmd fails because of .di files Reply with quote

OlaA wrote:
I don't know if this is a problem with how .di files are generated or how derelict is set up, but would it be possible to just put the .d files instead of the .di files in the import directories when building derelict?


Certainly not impossible. But it's not the way to solve your problem. You see, the whole point of rdmd is to build everything in one go without needing to link to any library files. It's passing the Derelict .di files to DMD to actually compile them into the executable, then DMD is attempting to link with DerelictSDL.lib and DerelictUtil.lib, as per the pragmas in your file. The result is that the Derelict symbols are both compiled into and then linked into the executable. Hence all of the conflicts you are getting.

In your particular case, the obvious solution is to remove the pragmas from your module. But if DMD is stripping any code out of the .di files when compiling Derelict (which should only be a potential issue with DerelictUtil ), then you could still wind up with errors. In that case, what you can do is to manually copy the DerelictSDL and DerelictUtil modules into a single import tree and use that instead. If you look in the trunk (the Derelict 1 codebase), you'll see a module called install.d. It was written for D1 and will need some work for D2, but you can use it as a starting point to create a D script that can copy the Derelict source tree into a single import directory for you with a one line command.

The entire point of .di files is that library developers should be able to use them to avoid having to ship their entire codebase with their library binaries. That's not why I use them with Derelict, but the point stands. D compilers need something to import when compiling executables, so .di files fill that need by including only the essential bits required to compile and stripping out the rest. rdmd's behavior of passing them on to DMD for compilation is, IMO, a bug in rdmd.

The whole point of generating the .di files for Derelict is to avoid having to maintain a set of copy commands in the different makefiles. And I don't intend to add any just because rdmd doesn't handle .di files properly..
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Abscissa



Joined: 23 Feb 2005
Posts: 40
Location: Cleveland, OH, US

PostPosted: Wed Oct 26, 2011 3:15 pm    Post subject: Fixed RDMD Reply with quote

FWIW, this problem should now be fixed in the RDMD that ships with DMD 2.056.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group