Piraxus / OrbiterSkyboltClient

Skybolt Engine graphics client for Orbiter Spaceflight Simulator
MIT License
14 stars 4 forks source link

Installation instructions for Orbiter Skybolt #1

Closed supersonic71 closed 2 years ago

supersonic71 commented 2 years ago

Hey I'm here from the orbiter forums, are there installation/compile instructions for Orbiter+Skybolt?

matthew-reid commented 2 years ago

Not yet. I'm currently working on streamlining the build steps and improving usability of the OrbiterSkybolt module, then I'll create a prebuilt release.

I'll aim to provide some official build instructions in the next few weeks, but for now the basic steps are:

To reduce the complexity of the above process I'm currently working on integrating the conan package manager, so you'll be able to do the above with just a few commands.

supersonic71 commented 2 years ago

Will try after the prebuilt releases, I don't know much about building manually. Thanks for working on this!

nikolajjensen commented 2 years ago

Any progress on the official build instructions? I can't wait for the first release! Any idea when we can expect it? Amazing work!

matthew-reid commented 2 years ago

@nikolajjensen I have a test release ready to go. It requires this orbiter PR. Once the PR is merged I'll make the release available.

matthew-reid commented 2 years ago

@nikolajjensen @supersonic71 I've pushed some updates which allow building with conan. Instructions are in README.md. Please use the OrbiterSkyboltClient master branch and Skybolt v1.2 branch.

nikolajjensen commented 2 years ago

Great. Im guessing we need this PR for it to work?

matthew-reid commented 2 years ago

@nikolajjensen you only need this PR if you build the plugin with shared library dependencies. By default the conan build will build everything as a static library, so the PR is not needed by default.

The purpose of the PR is to allow orbiter to find DLL dependencies of plugins without having to explicitly add search paths to your PATH variable. The static build has no DLL dependencies (since everything gets compiled into the one plugin DLL), so the PR is unnecessary.

nikolajjensen commented 2 years ago

Ah okay. I have not looked into the Conan process yet, I just followed the threads on the forums and saw that PR.

But this is great. I'll be trying it out in the coming weeks!

supersonic71 commented 2 years ago

@matthew-reid Thanks for the instructions!

In this step conan install OrbiterSkyboltClient --install-folder OrbiterSkyboltClientBuild --build=missing It was running for about 30 mins or so, then I got these errors : C:\Users\stubb\.conan\data\skybolt\1.2.1\_\_\source\src\Skybolt\SkyboltVis\Renderable\Planet\Tile\QuadTreeTileLoader.cp p(22,11): error C2679: binary '<<': no operator found which takes a right-hand operand of type 'const char [2]' (or the re is no acceptable conversion) [C:\Users\stubb\.conan\data\skybolt\1.2.1\_\_\build\8f392219b80e3bee08e78084e1bf89852a2 84543\src\Skybolt\SkyboltVis\SkyboltVis.vcxproj]

/some other stuff included in the gist below/

skybolt/1.2.1: ERROR: Package '8f392219b80e3bee08e78084e1bf89852a284543' build failed skybolt/1.2.1: WARN: Build folder C:\Users\stubb\.conan\data\skybolt\1.2.1\_\_\build\8f392219b80e3bee08e78084e1bf89852a284543 ERROR: skybolt/1.2.1: Error in build() method, line 63 cmake.build() ConanException: Error 1 while executing cmake --build C:\Users\stubb\.conan\data\skybolt\1.2.1\_\_\build\8f392219b80e3bee08e78084e1bf89852a284543 --config Release -- /m:8 /verbosity:minimal

Line 108 and Line 155 in https://gist.github.com/supersonic71/6394cfe77a6bde412f018ef3f1cb3fd7

supersonic71 commented 2 years ago

Okay so I don't know if this is related, but when adding cmake to PATH I accidently deleted everything else in PATH, then added the default ones, python and cmake again, this is how my PATH looks (Start -> Searched "Edit the system environment variables" -> Environment Variables Button -> Double clicking PATH)

image

Is this similar to how your PATH looks?

matthew-reid commented 2 years ago

@supersonic71 The QuadTreeTileLoader.cpp error looks like an incompatibility with your compiler. Which version of visual studio are you using? I suspect the problem is a missing include in Skybolt. I've pushed a fix to a branch called supersonic-compiler-fix. Can you please give it a try by:

  1. Checkout the supersonic-compiler-fix skybolt branch
  2. Delete existing locally compiled skybolt package by running conan remove skybolt
  3. Export new skybolt package by conan export skybolt from the skybolt repository root
  4. Recompile orbiter using conan as per README instructions

Your PATH looks ok, mine looks like yours but I have some custom things added which you shouldn't need.

matthew-reid commented 2 years ago

One thing I forgot to mention is that Skybolt has only been tested on orbiter 64bit, and I can't guarantee it will work on the pre-built orbiter 32bit release. There's a chance it will work work, but you need to configure conan to compile in 32 bit first, since 64 bit is the default. As far as I know there is no release of orbiter 64 bit yet, so you'll need to build orbiter from source until they release it.

supersonic71 commented 2 years ago

Visual studio version is 2019 Just tried supersonic-compiler-fix , Step 4 (of Readme) is successful!

For Step 5 when I doconan build --build-folder OrbiterSkyboltClientBuild I get

C:\Users\Stubb\Documents\skybolt3> conan build --build-folder OrbiterSkyboltClientBuild
usage: conan build [-h] [-b] [-bf BUILD_FOLDER] [-c] [-i] [-t] [-if INSTALL_FOLDER] [-pf PACKAGE_FOLDER]
                   [-sf SOURCE_FOLDER]
                   path
conan build: error: the following arguments are required: path
ERROR: Exiting with code: 2

Some additional info :

PS C:\Users\Stubb\Documents\skybolt3> conan --version
Conan version 1.47.0
PS C:\Users\Stubb\Documents\skybolt3> ls

    Directory: C:\Users\Stubb\Documents\skybolt3

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        29-04-2022     07:50                OrbiterSkyboltClient
d-----        29-04-2022     07:57                OrbiterSkyboltClientBuild
d-----        29-04-2022     07:49                Skybolt
matthew-reid commented 2 years ago

@supersonic71 The command in the README is incorrect, the source folder is missing. Please try this instead conan build OrbiterSkyboltClient --build-folder OrbiterSkyboltClientBuild. I'll update the README accordingly.

supersonic71 commented 2 years ago

Sorry to bother you so much, I get this when I run conan build OrbiterSkyboltClient --build-folder OrbiterSkyboltClientBuild Line 682 in https://gist.github.com/supersonic71/4647405b6f87fdcac8a4df08b5c7580e

/lot of text/ 

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE

CMake Generate step failed.  Build files cannot be regenerated correctly.
ERROR: conanfile.py (orbiter-skybolt-client/1.0.0): Error in build() method, line 28
        cmake.configure()
        ConanException: Error 1 while executing cd C:\Users\Stubb\Documents\skybolt3\OrbiterSkyboltClientBuild && cmake -G "Visual Studio 16 2019" -A "x64" -DCONAN_LINK_RUNTIME="/MD" -DCONAN_IN_LOCAL_CACHE="OFF" -DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="16" -DCONAN_CXX_FLAGS="/MP8" -DCONAN_C_FLAGS="/MP8" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="C:\Users\Stubb\Documents\skybolt3\OrbiterSkyboltClientBuild\package" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_MODULE_PATH="C:/Users/Stubb/Documents/skybolt3/OrbiterSkyboltClientBuild" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DGLEW_STATIC_LIBS="True" -DCMAKE_TOOLCHAIN_FILE="conan_paths.cmake" -Wno-dev C:\Users\Stubb\Documents\skybolt3\OrbiterSkyboltClient
matthew-reid commented 2 years ago

The actual error is a bit further up in the log:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Orbiter_INCLUDE_DIR
   used as include directory in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
   used as include directory in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
   used as include directory in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
Orbiter_LIBRARY_D
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
Orbiter_LIBRARY_R
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
Orbiter_SDK_LIBRARY_D
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
Orbiter_SDK_LIBRARY_R
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient

It's saying CMake can't find the Orbiter SDK.

Firstly make sure you've build the orbiter SDK by running the INSTALL target from the Orbiter visual studio project. Once you've done that, you need to tell CMake where to find orbiter. There are several different ways to do this, but I find the easiest way is to add the SDK directory to the CMAKE_PREFIX_PATH environment variable. CMAKE_PREFIX_PATH is a variable that CMake searches when looking for packages.

To set the environment variable you can either:

  1. Set the variable globally by adding it to your system or user environment variables in windows
  2. Set the variable locally in a cmd prompt by the set command, e.g set CMAKE_PREFIX_PATH=C\dev\orbiter\build\Install\Orbiter\Orbitersdk. I tend to use the local approach because it allows me to easily switch between different environments (the variable only exists for commands run from the same cmd prompt). When I want to do development, I run a bat script which opens a cmd prompt and sets all my environment variables. From there I can run all my tools from within that environment. You may want to do something similar, or you might want to keep it simple and do option 1.
supersonic71 commented 2 years ago

Firstly make sure you've build the orbiter SDK by running the INSTALL target from the Orbiter visual studio project.

Does the SDK get built when I build Orbiter too? Also is that the same as Build -> Install in Visual Studio? I set the SDK path to CMAKE_PREFIX_PATH, now only 2 are not set to NOTFOUND:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Orbiter_LIBRARY_D
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient
Orbiter_LIBRARY_R
    linked by target "OrbiterSkyboltClient" in directory C:/Users/stubb/Documents/skybolt3/OrbiterSkyboltClient/src/OrbiterSkyboltClient

Some weird things though, like when I build Orbiter, it does have Orbiter.exe and Orbiter_ng.exe in the output folder. But when I choose Build->Install, it only has Orbiter_ng.exe. Wish there was a pre-built OpenOrbiter :D . I'll try to re-download and re-build Orbiter.

matthew-reid commented 2 years ago

~Those errors indicate you're missing Orbiter_server.lib.~ Update: I double checked and now I don't think Orbiter_server.lib is actually needed. See my follow up comment. The remainder of this comment is still valid, i.e it explains how to ensure you're building orbiter correctly..

First make sure you're building the graphics server version of Orbiter. It should be the default CMake option for the 64 bit build:

OrbiterCMake

The Orbiter_server project should appear in your visual studio solution. The easiest way to ensure everything in orbiter is build and installed correctly is to run the ALL_BUILD target followed by the INSTALL target.

OrbiterSolution

matthew-reid commented 2 years ago

Sorry, the first part of my previous comment is incorrect. You actually don't need Orbiter_server.lib. The error is in my FindOrbiter.cmake script which requires Orbiter_server.lib to be found, but it's not actually built by the orbiter graphics server version, and it's not used. I'll fix the script tomorrow.

matthew-reid commented 2 years ago

@supersonic71 I push a fix for the Orbiter SDK issue to the v1.0.0 tag. If you want you can also try the v1.0.1 tag which requires skybolt v1.3.0 and has terrain improvements.

@supersonic71 @nikolajjensen I've made a binary release available.

supersonic71 commented 2 years ago

Ok so no more compile errors! 😄

Nowwhen I start a scenario (with Skybolt enabled), OpenOrbiter opens for a few seconds and the window is fully white. Then it closes. (Same when I use the Skybolt Client binary release). Orbiter.log - https://gist.github.com/supersonic71/902609f65ac49b9a0725bd810d62c984

I then opened it by clicking the play button in Visual Studio (select startup item).

When I open a scenario, it says void StateSet::setGlobalDefaults() ShaderPipeline disabled. in the CLI.

The error when it closed/crashed was : Unhandled exception at 0x00007FFAB88A170A (OrbiterSkyboltClient.dll) in Orbiter.exe: 0xC0000005: Access violation reading location 0x000000000000003C. in line 969 of Orbiter.cpp

HRESULT Orbiter::Render3DEnvironment () { if (gclient) { gclient->clbkRenderScene (); Output2DData (); //This is line 969 gclient->clbkDisplayFrame (); } return S_OK; }

**

My solution explorer looks quite different to yours, I don't have that folder CmakePredefinedTargets ( ALL_BUILD, INSTALL). 😅 I followed this guide : https://www.orbiter-forum.com/threads/guide-orbiter-development-in-visual-studio-2019.40144/ I am able to build and run the dx7 (32 bit) and dx9 (in 64bit).

I'll spend some time learning about CMAKE, thanks a lot for your help!

If possible, can you upload your compiled 64bit Orbiter? I'll try running the binary SkyboltClient on that and see if I still get the crash.

supersonic71 commented 2 years ago

Ignore previous comment! Was a simple mistake in setting texture directory. It works now!!! Thanks a lot 😄

matthew-reid commented 2 years ago

@supersonic71 Great news! What was the mistake with setting the texture directory? I ask because I want to update the crashing code so it gives a helpful error message instead of crashing.

supersonic71 commented 2 years ago

There was a typo in value of ORBITER_PLANET_TEXTURE_INSTALL_DIR in CMakeSettings.json
So Orbiter/Orbiter_NG.cfg had the wrong value of PlanetTexDir

supersonic71 commented 2 years ago

@matthew-reid shall I close this issue? (As readme has the instructions) Off-topic, but is there something like a log file for skybolt-client? It seems to crash on scenarios that have Venus.

matthew-reid commented 2 years ago

I'll close the issue. The skybolt log output is written to the main orbiter log (Orbiter.log). I haven't tested on Venus yet, I'll investigate.