Hi guys/girls
Just to add a Prerequisites for non english devs.
When you launch the command
vcpkg install glew:x86-windows glew:x64-windows physfs:x86-windows physfs:x64-windows
The tool warn about the missing english language package
Warning: The following VS instances are excluded because the English language pack is unavailable.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
Please install the English language pack.
Add the english language to fix it and run the command again .
(https://forum.outpost2.net/index.php?action=dlattach;topic=6321.0;attach=1794;image)
I've built the OPHD project on Linux (Ubuntu 19.10). However, I did build this project also a long time ago, so some dependencies might already be on my system.
I do know I relied heavily on the Docker instructions (https://forum.outpost2.net/index.php/topic,6092.0.html) but ran them on my own machine and if it couldn't find something, I used a search engine to look for the missing apt package.
These are the steps I did to be able to build and run the "openhd.exe" (which probably shouldn't be named .exe on Linux ;) ).
git clone https://github.com/OutpostUniverse/OPHD.git
cd OPHD
git submodule init
git submodule update
cd nas2d-core
make
cd ..
make
wget -4 https://www.outpost2.net/files/ophd/data.zip
unzip data.zip -d data
./openhd.exe
Had a lot of fun trying to play on a Mars like planet, died twice already though ;D, and it's so reminiscient of the old days, only better!
(https://i.imgur.com/ZyMpLZD.png)
(https://i.imgur.com/QJybN3n.png)
Hope this helps someone!
Hi Hooman,
Well the place I looked for build instructions initially was on the GitHub page, for an INSTALL.MD or a reference on the Wiki, but couldn't find any there.
Naively I tried to do "make" in the root directory but that didn't work.
After some Googling I found the link to the docker setup.
Even though I work with git on a professional basis, I didn't know git submodules were a thing, so it took some figuring out.
This gave me the clue that the nas2d probably was a dependency, and that I should build that first.
After that I was able to compile OPHD, and then was able to launch the executable, only to be greeted with an error regarding a missing asset. :)
The data.zip is mentioned somewhere in the forum, but that too I had forgotten about.
The -4 flag in the wget command is so that it defaults to IPv4, as it seems to hang when I don't specify it.
I've now also got a debug build working in Eclipse (freshly downloaded 2020-03 version, c++ development edition):
- Import as Makefile Project (select the folder which contains the topmost makefile, this is usually the folder in which you checked out from git.)
- This should allow you to build the code based on the makefile (it will call the "all" targate by default)
- Should you require a debug build (handy if one wants to develop), we need to build our code with the debug information contained in it.
- To do so, edit the MakeFile, by adding the following target below the "all" target and its configuration:
.PHONY: debug
debug: DEPFLAGS += -g -O0
debug: $(EXE)
This appends some extra flags to the DEPFLAGS variable, the -g flag makes sure the debug info is added, and the -O0 (minus oh zero) flag makes sure no code optimizations when compiling are done so the debugger will still see everything as-is.
Save the makefile.
Then in Eclipse, in Project > Properties, select the C/C++ Build, and select the "Behavior" tab.
Here change the "Build (incremental build)" value from "all" to "debug".
Rebuild your code.
Set a breakpoint somewhere and launch the Debug configuration:
(https://i.imgur.com/slhYtHR.png)
Sorry if this reply is a little slow coming.
I was thinking about adding a debug build target to the makefile, but then I realized this can be done with the already setup make variables:
make CXXFLAGS_EXTRA="-g -O0"
Additionally, you can change the build folder so the debug build intermediate files don't interfere with release builds. That way you can switch between build configurations without having to do a clean and full rebuild.
make CXXFLAGS_EXTRA="-g -O0" BUILDDIR=".build/debug/"
I was thinking about adding additional targets to set those variables, though I realized there can be quite a few targets for some projects. It's not so noticeable for OPHD itself, but for the NAS2D dependency, there are more build targets. In particular: all, test, check, test-graphics, run-test-graphics. It seemed to make less sense to create special targets for each of them. Mind you, that's basically what was done for the instructions to build the Docker images. Guess I haven't really made up my mind about which direction to go. It does seem more user friendly to have a build target name, rather than specify the details of the build flags.
Anyway, this kind of gets me thinking the Linux side of things could use a bit more support for build configurations.
Another thought I had was to detect when the submodule is missing, inform the user, and try to automatically initialize and download the git submodule. That should reduce the potential for confusing problems for a first time install.
Been a while since I've last looked at this project, also very glad you're doing better now!
Anywho, built a new personal/gaming rig awhile back, so I don't have Visual Studio (or VCC) installed since this is a recreational box and not a work box.
Had some trouble with the initial bootstrap-vcpkg.bat, seems it calls a sub .bat, bootstrap.ps1.bat and I kept getting thrown this...
"Could not detect a Windows SDK / TargetPlatformVersion"
here's the block where that exception comes from.
# Selecting
if ($withWinSDK -ne "")
{
foreach ($instance in $validInstances)
{
if ($instance -eq $withWinSDK)
{
return $instance
}
}
throw "Could not find the requested Windows SDK version: $withWinSDK"
}
foreach ($instance in $validInstances)
{
if (!$DisableWin10SDK -and $instance -match "10.")
{
return $instance
}
if (!$DisableWin81SDK -and $instance -match "8.1")
{
return $instance
}
}
throw "Could not detect a Windows SDK / TargetPlatformVersion"
}
Had to add an OS specific SDK (in my case, Win10) to get it to work, may want to make a note of that in the "to add" list as well on the VCPkg page (since it also adds an additional ~2.7GB to the VS install download)
(http://Windows10SDK_VS2019.png) SEE ATTACHED IMAGE
Also, VCPkg sends 'anonymous' usage metric data back to Microsoft, maybe make a note to suggest including -disableMetrics parameter with the intial bootstrap-vcpkg call at the users discretion.
Several build attempts later... heh.
So, VCPkg does not natively execute from VS2019, even after installation/integration, I had to add the VCPkg directory to my %PATH% manually before the build/rebuild would attempt to run correctly.
After resolving the 'vcpkg not found' error, I was able to run a proper build, but then it, too, failed for (finally) a legitimate reason. NAS2D fails to build, so then when OPHD try, it, too, then fails due to reference errors.
VS2019 error
The command "..\Package.bat C:\Program Files (x86)\GAMES\Outpost HD\OPHD\x64\Debug\NAS2D.lib x64 Debug:VCEnd" exited with code 1.
Build output snippet
1>Compress-Archive : The path 'nas2d-1.5.0-1379-g2299b30-Windows.Files.(x86)\GAMES' either does not exist or is not a
1>valid file system path.
1>At line:1 char:1
1>+ Compress-Archive -Path 'NAS2D.lib', 'include/' -DestinationPath 'nas2 ...
1>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1> + CategoryInfo : InvalidArgument: (nas2d-1.5.0-137...les.(x86)\GAMES:String) [Compress-Archive], InvalidO
1> perationException
1> + FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Compress-Archive
1>
1>A duplicate file name exists, or the file
1>cannot be found.
The 'C:/Program Files (x86)/GAMES' reference looks like it's been truncated somehow (error'd to "nas2d-1.5.0-1379-g2299b30-Windows.Files.(x86)\GAMES").... I isolated the line from the referenced Package.bat file below
powershell -Command "Compress-Archive -Path 'NAS2D.lib', 'include/' -DestinationPath '%PackageName%' -Force"
... possible syntax error?
Oh yeah, I definitely remember the 'old' build days, haha.
I run VS in admin to avoid access error like that. I moved to a different disk but the same path, same error, renamed to a simpler path, it works, turns out pathnames with spaces is what was causing the error. Now I'm finally just getting regular old code errors it seems.
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(174,8): error C2039: 'string': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\vector(24): message : see declaration of 'std'
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(174,15): error C2065: 'string': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(174,15): error C2146: syntax error: missing ';' before identifier '_popRole'
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(174,15): error C2065: '_popRole': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(177,44): error C2065: '_popRole': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(178,46): error C2065: '_popRole': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(179,46): error C2065: '_popRole': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(183,14): error C2039: 'runtime_error': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\vector(24): message : see declaration of 'std'
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(183,98): error C2065: '_popRole': undeclared identifier
D:\GAMES\OPHD\OPHD\PopulationPool.cpp(183,27): error C3861: 'runtime_error': identifier not found
The rest of the .cpp's seem to do just fine.
Looks like someone forgot to add #include <string> and #include <stdexcept> statements before/after they were done with PopulationPool.cpp file. Thankfully an easy fix, assuming by the std:: that the standard library was indeed intended.
Edited the file on my end, and it compiled just fine.
Now it's some sort of on execution error with the .exe itself... not familiar with this one, though.
SEE ATTACHED IMAGE