GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

Long linker times on Torque3D.dll (VS2010) #72

Closed LuisAntonRebollo closed 10 years ago

LuisAntonRebollo commented 12 years ago

See this thread -> http://www.garagegames.com/community/forums/viewthread/120473/1

DavidWyand-GG commented 12 years ago

@Luis-Anton do you have an actual solution for this? That forum thread points out an issue but doesn't have a concrete resolution.

537mfb commented 12 years ago

@DavidWyand-GG If you read Tom Spillman's coment on that thread he gives you the resolution

he says and i quote: I think the problem is that how T3D is setup the game EXE and game DLL are named the same. This means you get some intermediate files that are named the same and i think it confuses the linker.

and then Devin Passage answers: Changing the names did get rid of that warning message, seems faster now... have not actually tested the speed but its good enough for now, thank you!

So as you can see, Tom Spillman gave a resolution and Devin confirmed the Tom's resolution solved the issue

It's all in that thread

dottools commented 12 years ago

The problem is that the C/C++ -> Output Files: Program Database File Name and Linker -> Debugging: Generate Program Database File paths are the exact same for the App and DLL projects so they're fighting over the same debug database file. Currently they're being set to _$(OutDir)/$(ProjectName)DEBUG.pdb but instead could probably be set to _$(IntDir)/$(ProjectName)DEBUG.pdb to fix the long linking problem for debug builds..

537mfb commented 12 years ago

@dottools Something like that should work aswell - yes

DavidWyand-GG commented 12 years ago

Hey Guys.

Sounds like a plan. So who will step up and submit a Pull Request for the fully tested fix?

LuisAntonRebollo commented 12 years ago

Change "Program Database File" to IntDir don't work for me :(

I think the problem are "Incremental Link"(.ilk) files. It's not posible to change ouput dir (see this)

The only posible solution it's change name of dll for solve conflit with file ilk of exe.

LuisAntonRebollo commented 12 years ago

A simple solution for VS2010:

 Tools/projectGenerator/templates/vc2010_dll_proj.tpl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Tools/projectGenerator/templates/vc2010_dll_proj.tpl b/Tools/projectGenerator/templates/vc2010_dll_proj.tpl
index a594615..9700eb6 100644
--- a/Tools/projectGenerator/templates/vc2010_dll_proj.tpl
+++ b/Tools/projectGenerator/templates/vc2010_dll_proj.tpl
@@ -50,15 +50,15 @@
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG_</TargetName>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">false</LinkIncremental>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG_</TargetName>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName}</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName}_</TargetName>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Midl>
@@ -96,7 +96,7 @@
     </ResourceCompile>
     <Link>
       <AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir){$projOutName}_DEBUG.dll</OutputFile>
+      <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@@ -148,7 +148,7 @@
     </ResourceCompile>
     <Link>
       <AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir){$projOutName}_OPTIMIZEDDEBUG.dll</OutputFile>
+      <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@@ -200,7 +200,7 @@
     </ResourceCompile>
     <Link>
       <AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir){$projOutName}.dll</OutputFile>
+      <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
 Engine/source/main/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Engine/source/main/main.cpp b/Engine/source/main/main.cpp
index 86907b5..4c80a83 100644
--- a/Engine/source/main/main.cpp
+++ b/Engine/source/main/main.cpp
@@ -39,7 +39,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdL

    GetModuleFileNameA(NULL, filename, 4096);
    filename[strlen(filename)-4] = 0;
-   sprintf(gameLib, "%s.dll", filename);
+   sprintf(gameLib, "%s_.dll", filename);

    HMODULE hGame = LoadLibraryA(gameLib);

Any one can test?

LuisAntonRebollo commented 12 years ago

2 posible solutions. Works on VS2008/2010 (need test)

https://github.com/LuisAntonRebollo/Torque3D/commit/18b1f4c2b895693ddedb97516fbbca4bb1126115

https://github.com/LuisAntonRebollo/Torque3D/commit/76dc60daf0550a3540a6a8c86fb7efb0afa4eb8c

crabmusket commented 10 years ago

This is cool, I'll try to test it sometime.

LuisAntonRebollo commented 10 years ago

We can close this issue, are handled on #698