Notes from building

The place for all discussion of the Oculus Rift compatible open source 3D drivers.
Post Reply
zino
Two Eyed Hopeful
Posts: 73
Joined: Mon Jun 25, 2012 7:40 am

Notes from building

Post by zino »

I successfully built the driver and thought I'd share some notes takes as I did:

1. The DirectX June 2010 installer already sets up DXSDK_DIR, so the extra DX environment is a bit redundant.

2. The post-build step for all projects has a copy target hardcoded to "c:\Program Files (x86)\Vireo\Perception\bin\". Create that path before building and also copy libfreespace.dll there to be able to run the resulting binary.

3. The step above means that there is no one-click solution for debugging, but I'll leave it as an exercise for another day to fix that.


I set up a virtual machine with 32bit XP to compile and test, and it seems to reproduce what I think is the same problem someone else had with the crash when drawing the logo. logo_bitmap is bogus, which is to be expected since I haven't copied in any support data into the build directory. Some error handling should fix that, but I just ran out of spare time for today, so I'll eave that as an exercise for someone else. Preferably someone that enjoys the win32 API.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

Yeah, debugging was a little difficult. For simple stuff I was using DebugView and just tracing out text, but obviously that only goes so far.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

Where (and what) is "Direct3D9.h"???
zino
Two Eyed Hopeful
Posts: 73
Joined: Mon Jun 25, 2012 7:40 am

Re: Notes from building

Post by zino »

$ find . -name Direct3D9.h
./DxProxy/DxProxy/Direct3D9.h

If you are getting build errors involving that you probably haven't set up the DX_PROXY environment variable.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

@2EyeGuy: Its part of the main DxProxy project.

Like zino said you may need to set that environment variable.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

zino wrote:$ find . -name Direct3D9.h
./DxProxy/DxProxy/Direct3D9.h

If you are getting build errors involving that you probably haven't set up the DX_PROXY environment variable.
But I DID set it up. I set it to "C:\SourceControl\Perception\DxProxy\". I even restarted Visual Studio afterwards.
zino
Two Eyed Hopeful
Posts: 73
Joined: Mon Jun 25, 2012 7:40 am

Re: Notes from building

Post by zino »

2EyeGuy wrote:But I DID set it up. I set it to "C:\SourceControl\Perception\DxProxy\". I even restarted Visual Studio afterwards.
If you haven't move things around that's one level too low. Add an extra "Dxproxy/" to that. Here's mine for reference:

C:\Documents and Settings\builder\Desktop\Perception\DxProxy\DxProxy
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

And you have cloned the whole repo (all projects) into the same folder?

For example:

C:\SourceControl\Perception\DxProxy\
C:\SourceControl\Perception\DxHijack\
C:\SourceControl\Perception\Perception\

Then make sure that the DX_PROXY var leads to where the source code is, not the top folder where the solution file is.

If your case it may be:
C:\SourceControl\Perception\DxProxy\DxProxy\

Also, sometimes you may need to restart your computer for the environment variable to take effect.

Hope that helps.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

Thanks. But I'm editing the project files and adding a new solution file for the whole thing to make building it much more user friendly. Now you will only need to set one environment variable, which is FREESPACE. And I'm even making twice as much use of that variable by automatically copying freespace.dll from there to our folder. So after setting that environment variable you can just open VireioPerception.sln and click the Run button.

So now I've got it compiling easily. But the problem is... it's working. That's a problem because it shouldn't be working when it's missing all the .bmp, .xml, and .fx files. So I'll have to see what's going on there before I push my changes. Something about the registry, I think.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

It uses the registry to save the location of the app (to load dlls, xml, etc). When you open the exe it will save this automatically. It looks for the folder named 'Perception/bin' so if you saved it somewhere else it may not work. If you happen to have multiple versions on the hard-drive, it will look the folder for the last version you opened. It also uses the registry to save the current opened game, so it knows what profile to load.

Also, make sure to pull first as there was an update for the crash on start (missing break).
zino
Two Eyed Hopeful
Posts: 73
Joined: Mon Jun 25, 2012 7:40 am

Re: Notes from building

Post by zino »

2EyeGuy wrote:Thanks. But I'm editing the project files and adding a new solution file for the whole thing to make building it much more user friendly.
Please push this when you have something you are happy with. Separate solutions might be pretty, but I just find it a hindrance when trying to run project wide analysis.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

OK, I submitted a pull request: https://github.com/cybereality/Perception/pull/2
Or you can get my code from here: https://github.com/CarlKenner/Perception

I've made the solution and project files a LOT more user friendly, and improved the README.txt build instructions:
Improved README.txt wrote:Download libfreespace (libfreespace-0.6rc0-win32-vs2010.zip) from here:
http://libfreespace.hillcrestlabs.com/content/download
Extract it to a folder

Click Start, Control Panel, System (in System and Security), Advanced System Settings, Environment Variables
Create environment variables:
FREESPACE : The folder for libfreespace (Hillcrest Labs SDK).
DXSDK_DIR : Your DirectX SDK folder (already set automatically by the June 2010 DirectX SDK)

Open the VireioPerception.sln solution file. It contains all the projects with their dependencies set correctly.
Choose either Debug or Release.
Either Run or Build the solution.
It should just work.
I also fixed a problem with the registry that was requiring administrator access.
And I added line breaks to all the debug prints so you can actually read them.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

@2EyeGuy: Thanks a lot man. Wasn't able to test on this machine, but I checked the diff and it looked solid. Nice job.

Any reason why the exe and dlls aren't part of the repo? It might make sense to keep it all in one place.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

cybereality wrote:@2EyeGuy: Thanks a lot man. Wasn't able to test on this machine, but I checked the diff and it looked solid. Nice job.

Any reason why the exe and dlls aren't part of the repo? It might make sense to keep it all in one place.
Just because you build them from the source code. Except the tracker libfreespace.dll, which is copied automatically from the SDK when you build it. They end up all in one place when you build it. Normally people don't put the exe and dll files in their git repositories. But things like the shader files and the profiles and the logo image are part of the source code that people need to edit if they want to change things.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

OK, that's fine.
Baristan6
Cross Eyed!
Posts: 111
Joined: Sat Dec 15, 2012 11:33 am

Re: Notes from building

Post by Baristan6 »

Trying to compile the project isn't working for me. Opening the VireioPerception.sln project gives me the error
Solution folders are not supported in this version of the application.
I'm useing Microsoft Visual C++ 2010 version 10.0.402191.1 SP1Rel

after trying to build solution I get this output

Code: Select all

1>------ Build started: Project: DxProxy, Configuration: Debug Win32 ------
1>  C:\Users\user\Downloads\libfreespace-0.6rc0-win32-vs2010\libfreespace\lib\libfreespace.dll
1>  1 File(s) copied
1>  copying xml config from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\cfg\config.xml
1>  1 File(s) copied
1>  copying xml config from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\cfg\profiles.xml
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphGreenMagenta.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphGreenMagentaGray.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphRedCyan.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphRedCyanGray.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphYellowBlue.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\AnaglyphYellowBlueGray.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\Checkerboard.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\InterleaveHorz.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\InterleaveVert.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\OverUnder.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\SideBySide.fx
1>  1 File(s) copied
1>  copying pixel shader from Release to Debug
1>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\fx\SideBySideRift.fx
1>  1 File(s) copied
1>  StereoViewInterleave.cpp
1>  StereoViewFactory.cpp
1>  StereoView.cpp
1>  pugixml.cpp
1>  ProxyHelper.cpp
1>  MotionTrackerFactory.cpp
1>  MotionTracker.cpp
1>  Main.cpp
1>  FreeSpaceTracker.cpp
1>  Direct3DDevice9.cpp
1>  Direct3D9.cpp
1>  D3DProxyDeviceUnreal.cpp
1>  D3DProxyDeviceTest.cpp
1>  D3DProxyDeviceSource.cpp
1>  D3DProxyDeviceMono.cpp
1>  D3DProxyDeviceFixed.cpp
1>  D3DProxyDeviceFactory.cpp
1>  D3DProxyDeviceEgo.cpp
1>  D3DProxyDeviceAdv.cpp
1>  D3DProxyDevice.cpp
1>  Generating Code...
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\DxProxy\DxProxy\Debug\d3d9.dll) does not match the Linker's OutputFile property value (C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Debug\Perception\bin\d3d9.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>LINK : fatal error LNK1104: cannot open file 'd3dx9.lib'
2>------ Build started: Project: DxHijack32, Configuration: Debug Win32 ------
2>  dllmain.cpp
2>  apihijack.cpp
2>  StereoViewInterleave.cpp
2>  StereoViewFactory.cpp
2>  StereoView.cpp
2>  pugixml.cpp
2>  ProxyHelper.cpp
2>  MotionTrackerFactory.cpp
2>  MotionTracker.cpp
2>  FreeSpaceTracker.cpp
2>  Direct3DDevice9.cpp
2>  Direct3D9.cpp
2>  D3DProxyDeviceUnreal.cpp
2>  D3DProxyDeviceTest.cpp
2>  D3DProxyDeviceSource.cpp
2>  D3DProxyDeviceMono.cpp
2>  D3DProxyDeviceFixed.cpp
2>  D3DProxyDeviceFactory.cpp
2>  D3DProxyDeviceEgo.cpp
2>  D3DProxyDeviceAdv.cpp
2>  Generating Code...
2>  Compiling...
2>  D3DProxyDevice.cpp
2>  Generating Code...
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\DxHijack\DxHijack32\Debug\hijackdll.dll) does not match the Linker's OutputFile property value (C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Debug\Perception\bin\hijackdll.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
2>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\\Release\Perception\cfg\config.xml
2>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\\Release\Perception\cfg\profiles.xml
2>  2 File(s) copied
2>LINK : fatal error LNK1104: cannot open file 'd3dx9.lib'
3>------ Build started: Project: Perception, Configuration: Debug Win32 ------
3>  Copying image file from Release to Debug
3>  C:\Users\user\Documents\Visual Studio 2010\Projects\Perception-master\Release\Perception\img\logo.bmp
3>  1 File(s) copied
3>  Main.cpp
3>  pugixml.cpp
3>  ProxyHelper.cpp
3>  Generating Code...
3>LINK : fatal error LNK1104: cannot open file 'hijackdll.lib'
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
Any clue to what I'm doing wrong? Checked my environment variables and they look correct.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

Well its failing on the linker, which means you are probably missing an environment var or the linker settings are incorrect.

Let me take a closer look and see if I can replicate your problem.
mscoder610
Cross Eyed!
Posts: 131
Joined: Sat Jan 12, 2013 6:45 pm

Re: Notes from building

Post by mscoder610 »

When I build,
- I see warning that the Solution Folder is unsupported (I wonder if that's just a VC++ Express thing?). It's not really important, the only things in it are the readme / .gitignore / etc.
- I get the warning that the TargetPath doesn't match the OutputFile too. My build still succeeds though.

The main error is that d3dx9.lib can't be found. Doublecheck that your the DirectX SDK is installed, and that your DXSDK_DIR environment variable is correct. If you just installed the SDK in this Windows session, restarting Visual Studio might help.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

You did nothing wrong, except trusting me. I introduced a bug. I just fixed it in my git repository, and made a pull request.

You can get the fix now by doing pull (in Git) from https://github.com/CarlKenner/Perception.git

BTW, How did you build it if you couldn't open it?
The "solution folder" is just the build instructions readme.txt, and the git ignore and git attributes files. I can remove them if they aren't supported in some versions of visual studio.

You are getting two other warnings but they are supposed to happen.

The other error you are getting is that it can't find d3dx9.lib. Which stops the first two projects from compiling. That's my fault, I accidentally read the wrong environment variable.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

mscoder610 wrote:When I build,
- I see warning that the Solution Folder is unsupported (I wonder if that's just a VC++ Express thing?). It's not really important, the only things in it are the readme / .gitignore / etc.
You could have mentioned that. I didn't realise they were unsupported in some versions.
mscoder610 wrote: - I get the warning that the TargetPath doesn't match the OutputFile too. My build still succeeds though.
That's documented in the readme and intentional. There may be a way of getting rid of that warning somehow, but I didn't think it was worth bothering with. But if people really don't like warnings then I can try to fix it. The problem is trying to get the .lib and .exp files to be placed somewhere different from the .dll file.

Anyway, my fix for the errors is up, if cyber does the pull request. Or you can pull yourself from the address above.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: Notes from building

Post by cybereality »

OK, great that we worked this one out quick. It's been merged.
Baristan6
Cross Eyed!
Posts: 111
Joined: Sat Dec 15, 2012 11:33 am

Re: Notes from building

Post by Baristan6 »

Yea just fixed myself too by manualy adding the path to the build properties and it compiles fine. Just doesn't hook the dll for me anymore. Will download you new files and start some debugging.
2EyeGuy
Certif-Eyable!
Posts: 1139
Joined: Tue Sep 18, 2012 10:32 pm

Re: Notes from building

Post by 2EyeGuy »

You can just do a normal "pull" on Git now that it is in the official repository.
Post Reply

Return to “Development / General Discussion”