KeenSoftwareHouse / SpaceEngineers

2.93k stars 896 forks source link

Trying to build the project #543

Open PlatonShubin opened 8 years ago

PlatonShubin commented 8 years ago

Hi, I'd like to try to contibute to SE, so I forked the project, set up local repository with code, changed path to game's content but project doesn't build in base configurations. x64/x86 Debug/Release. This is the trace: http://pastebin.com/csJ3PTci

It seems to be missing SharpDX.Toolkit.dll which really isn't in SharpDX folder and even not in official SDK. Also there's missing VRage.OpenVRWrapper project so it can't be accessed from the source code. Also there's no Valve.VR

UPD: If someone gets it working on 81275 revision (last one at the moment), please write here how you made it to build.

Faark commented 8 years ago

If you haven't found the dll's in your steam installation of space engineer you probably have not switch to the development branch yet. Open your steam library, right click on SE, properties, betas and select development from the drop-down. There i've found everything but RakNet (that i got rid of)

PlatonShubin commented 8 years ago

@Faark, I have switched actually and I don't think what you say really matters. The dll should be in SharpDX folder like the others SharpDX dlls. Also solution misses one project (OpenVRWrapper) which is included in some of nested projects. Do you NOW have it working?

Faark commented 8 years ago

I'm using the dlls from the game installation, since last i checked they didn't/couldn't provide many dependencies necessary to build for x64 via Github. Yes the latest github code does compile and runs fine here.

PlatonShubin commented 8 years ago

@Faark, well, thank you for your hint. Nevertheless, I still have many troubles. And accoring to csproj files problem is not on my side. I manually removed unresolved dependencies from each project in the solution and then added dependent dlls from game\Bin64 folder. They are now kinda resolved. But not all of the bad dependencies I resolved. There is no RakNet.dll in game folder nor in 3rd folder (Only x86 is present). And I can't use x86 one because I've already included x64 dlls from game folder :-) And there's no other SharpDX.Toolkit.dll, etc. for x86 anywhere.

Well, let's look on .proj files. This one asks for project which doesn't exist in my git synced folder nor in Keen's (obvious)

    <ProjectReference Include="..\VRage.OpenVRWrapper\VRage.OpenVRWrapper.csproj">
      <Project>{21865086-a876-40b0-9b2e-f20d8b0ea723}</Project>
      <Name>VRage.OpenVRWrapper</Name>
    </ProjectReference>

No dll there

    <Reference Include="SharpDX.Toolkit">
      <HintPath>..\..\3rd\SharpDX.Toolkit\x64\Release\SharpDX.Toolkit.dll</HintPath>
    </Reference>

No \x64 Folder and dll.

  <ItemGroup>
    <Reference Include="RakNet">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\3rd\RakNet\$(Configuration)\$(Platform)\RakNet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
  </ItemGroup>

So I hope it'll be fixed soon. At the moment I don't get how you have it working. Maybe you referenced x86 files from game directory?

Faark commented 8 years ago

You can get rid of RakNet. It doesn't seem to be used anymore. Only 2 unused exceptions plus 4 files fully commented out. I've deleted them and removed the dependency and the game ran fine (have only tried single player, though). Haven't tried x86.

PlatonShubin commented 8 years ago

@Faark, well, thank you a lot. I deleted 2 files from VRage.Network which used RakNet I guess, replaced libs with game folder's ones. Now it's working, though I get StackOverflowException too frequently in ReadXml() in MyAbstractXmlSerializer.cs. I hope they will fix the projects' settings so that all of the users could easily set up solution to visual studio as it idescribed in description.

N3X15 commented 7 years ago

This is still a problem, and it appears the SharpDX in the repo is horribly outdated, as well. After removing the OpenVR project and references to it, I am still getting 1,400 errors.

PlatonShubin commented 7 years ago

@N3X15, I think that just the opposite is true: it has updated here recently. If you download SharpDX from the official site, you won't find Toolkit.dll too, Maybe this is a separate project now. You have to fix dependencies by adding dlls from the game folder, except for RakNet, I had just to delete two files, using it.

Rynchodon commented 7 years ago

Instead of copying the dlls to your git folder, I recommend adding references to the dlls to csproj.user files. This batch script should do the trick. Please note, this will replace your csproj.user files. If you previously copied over dll files, you'll have to remove them or the project will not build.

PlatonShubin commented 7 years ago

Yes, I meant referencing dlls from game folder, not copiying them. Maybe we should fix .csproj files so that they could automatically reference dlls from game folder? And then make a commit?

Rynchodon commented 7 years ago

Here you go #549

andrewfenn commented 7 years ago

I got everything building.

First you need to apply #549

Then you need to add reference dlls on the projects it's complaining about. If you can't find the DLL in the 3rd folder in the git repo then you must include it from the steam folder in the bin64 folder.

Here is a non-comprehensive list from the bin64 steam game you need to add as a reference to the VRage.Render11 project

SharpDXToolkit.dll HavokWrapper.dll OpenTK.dll VRage.OpenVRWrapper.dll

andrewfenn commented 7 years ago

Latest update has some compile problems inside of VRage.Scripting so I can no longer build the game. Feeling a bit fed up that every push to github breaks the build system for no reason, so I'm going to take a break in terms of contributing to this until things get sorted out.

PlatonShubin commented 7 years ago

@andrewfenn, I'm going to create a pull request in a minute. It extends Rynchodon's fix for the current revision,

UPD: Well, I pushed changes to fix-missing-references branch in my fork, you can get it by fetching or something else. I will do a PR later when managed to change back file modes.

andrewfenn commented 7 years ago

@PlatonCraft That's great, everything is building now, just getting a complaint about my dot net version being out of date when running the game (message popup). Looks like I'm getting this because of an exception being thrown in InitIlCompiler(); This line specifically.

MyScriptCompiler.Static.IgnoredWarnings.Add("CS0105");

Not really sure what the problem is.. VS 2015 community edition, windows 10, dot net 4.6.1. The windows fix the game points to says I already have it installed.

Tried a few things but seems more things break when I try to comment the line out. Maybe it makes more sense to you guys?

Here is the error line in my log

2016-07-18 23:46:45.541 - Thread:   8 ->        Error: Error during ModAPI initialization: The type initializer for 'VRage.Scripting.MyScriptCompiler' threw an exception.

Here is the whole exception:

System.TypeInitializationException was unhandled
  HResult=-2146233036
  Message=The type initializer for 'VRage.Scripting.MyScriptCompiler' threw an exception.
  Source=SpaceEngineers.Game
  TypeName=VRage.Scripting.MyScriptCompiler
  StackTrace:
       at SpaceEngineers.Game.MySpaceGameCustomInitialization.InitIlCompiler() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\SpaceEngineers.Game\MySpaceGameCustomInitialization.cs:line 41
       at Sandbox.MySandboxGame.InitIlCompiler() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\Sandbox.Game\MySandboxGame.cs:line 1307
       at Sandbox.MySandboxGame.InitModAPI() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\Sandbox.Game\MySandboxGame.cs:line 1264
       at Sandbox.MySandboxGame.LoadData() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\Sandbox.Game\MySandboxGame.cs:line 1171
       at Sandbox.MySandboxGame.Initialize() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\Sandbox.Game\MySandboxGame.cs:line 972
       at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen) in C:\Users\andrew\Desktop\SpaceEngineers\Sources\Sandbox.Game\MySandboxGame.cs:line 338
       at SpaceEngineers.MyProgram.Main(String[] args) in C:\Users\andrew\Desktop\SpaceEngineers\Sources\SpaceEngineers\MyProgram.cs:line 103
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
       HResult=-2146233088
       Message=Duplicate registration of the whitelist key System.IEquatable<T>+*, mscorlib retrieved from System.IEquatable`1[T]
       Source=VRage.Scripting
       StackTrace:
            at VRage.Scripting.MyScriptWhitelist.Register(MyWhitelistTarget target, ITypeSymbol symbol, Type type) in C:\Users\andrew\Desktop\SpaceEngineers\Sources\VRage.Scripting\MyScriptWhitelist.cs:line 431
            at VRage.Scripting.MyScriptWhitelist.MyWhitelistBatch.AllowTypes(MyWhitelistTarget target, Type[] types) in C:\Users\andrew\Desktop\SpaceEngineers\Sources\VRage.Scripting\MyScriptWhitelist.cs:line 746
            at VRage.Scripting.MyScriptWhitelist..ctor(MyScriptCompiler scriptCompiler) in C:\Users\andrew\Desktop\SpaceEngineers\Sources\VRage.Scripting\MyScriptWhitelist.cs:line 90
            at VRage.Scripting.MyScriptCompiler..ctor() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\VRage.Scripting\MyScriptCompiler.cs:line 76
            at VRage.Scripting.MyScriptCompiler..cctor() in C:\Users\andrew\Desktop\SpaceEngineers\Sources\VRage.Scripting\MyScriptCompiler.cs:line 42
       InnerException: 
Rynchodon commented 7 years ago

@andrewfenn In MyScriptWhitelist, remove one of the typeof(System.IEquatable<>) from AllowedTypes's params, line 154 and 167.

N3X15 commented 7 years ago

Edit: DISREGARD I AM AN IDIOT

If you get errors about being unable to load some DLL, you probably screwed up App.config in the SpaceEngineers.Game project, like I did.

maconbot commented 6 years ago

RakNet open source: https://github.com/facebookarchive/RakNet