MaKiPL / OpenVIII-monogame

Open source Final Fantasy VIII engine implementation in C# working on Windows and Linux (Android and iOS planned too!) [Monogame]
MIT License
645 stars 59 forks source link

Unable to compile on Ubuntu #149

Open cmbasnett opened 4 years ago

cmbasnett commented 4 years ago

I followed the instructions to the letter on the readme, but I am getting the following error when trying to compile:

/home/colin/openviii/Core/ImGuiRenderer.cs(37,37): Error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. (CS0012) (Core)

I've tried adding the netstandard assembly as a reference to the project, but that doesn't seem to work. Any help is much appreciated!

MaKiPL commented 4 years ago

Please try getting the NuGet package for "Netstandard" of version 2- let us know if it would work

cmbasnett commented 4 years ago

I've used NuGet to add the NETStandard.Library package, but the same error occurs.

I'm reading up on other people encountering this same error (https://github.com/dotnet/standard/issues/481). Is it possible that changing the projects to use the new PackageReference style of package management could fix this error? I'm using MonoDevelop, so I don't have the option to easily convert the project to this new style, apparently this is something you can do with VS though.

Sebanisu commented 4 years ago

I found 3 code errors I made that prevents Linux from building. Though I am having trouble with the shader compiling on Ubuntu. I fiddle more today. I'm trying to get appveyor to build on Ubuntu. So I am on a VM testing terminal commands to script out the build. https://github.com/MaKiPL/OpenVIII/issues/152

Sebanisu commented 4 years ago

https://github.com/MonoGame/MonoGame/issues/4313 Shaders cannot be compiled on linux. Windows only.

Sebanisu commented 4 years ago

Okay we did some trickery so when we build the opengl shader on windows it'll be copied to the linux version and we can commit it with git. I got it to build. Here is my script https://github.com/MaKiPL/OpenVIII/blob/master/linuxAutoBuild.sh Though I still need to test the script on a clean install. And monodevelop has plugins for monogame that need to manually be installed if you want to develop in linux. But to compile you don't need monodevelop. related https://github.com/MaKiPL/OpenVIII/issues/142

cmbasnett commented 4 years ago

Making progress!

There were a few problems I encountered:

Memory.Init calls

I had to change a few lines to get the whole suite compiling: there are 4 or so calls to Memory.Init in some of the tool projects which are missing the fourth argument. They all used to be:

Memory.Init(null, null, null);

I had to change them to:

Memory.Init(null, null, null, null);

Missing FFmpeg libraries

After changing that, I was able to compile and get the program executing now, but ran into a missing DLL error:

System.DllNotFoundException has been thrown
Unable to load DLL 'avutil.56': The specified module could not be found

I had previous installed ffmpeg, so was confused as to why the libraries were not being picked up. I did a little searching, and apparently the LTS versions of Ubuntu haven't updated their ffmpeg package references to use FFmpeg 4, so it was downloading an old version.

I followed this guide to reinstall the new version of ffmpeg. I was then able to load the game into the main menu, hurray! :confetti_ball:

Shaders

Regarding shader compilation: unless I'm mis-remembering, isn't the output of shader compilation dependent on the GPU? So any compiled shaders put onto the repo would only be guaranteed to work on the GPU it was compiled on? I'd be happy to be wrong about this.

EDIT: Speak of the devil, attempting to go to the World Map shows this error:

Screenshot from 2020-03-04 12-53-26

It appears to be failing on this line:

worldShaderModel = Memory.content.Load<Effect>("testShader");

Note that turning bUseCustomShaderTest to false allows the game to run just fine.

Sebanisu commented 4 years ago

We made added a precompiled shader to the OpenGLLinux project. It will copy that to the bin folder. This is generated when we compile opengl on windows. Sadly no one has ported the Shader compiler to linux or mac. It only works on windows. https://github.com/MonoGame/MonoGame/issues/4313

Sebanisu commented 4 years ago

Though if the shader isn't working still on linux maybe we need to ignore shaders on linux. I got it compiled on my vm but I haven't ran it yet heh. I should probably do that

Frenzied-Pop commented 3 years ago

Had issues with https://github.com/MaKiPL/OpenVIII/blob/master/linuxAutoBuild.sh Tried a fresh install, no go. This is is as minimal as I could get.

sudo apt install mono-devel nuget snapd sudo snap install dotnet-sdk --classic nuget install MonoGame.Framework.DesktopGL nuget install MonoGame.Framework.DesktopGL.Core nuget install MonoGame.Framework.OpenGL git clone https://github.com/makipl/openviii cd openviii dotnet msbuild OpenVIII.sln /target:OpenGLLinux /property:Configuration=DebugLinux /property:Platform=x64

Throwing 1 error:

Sebanisu commented 3 years ago

I had updated the readme with new instructions. Back in July. https://github.com/MaKiPL/OpenVIII-monogame/commit/c419e6182332515d805135eeb853bb48d0a40b15

Monogame had moved things around so I had to update the links.

Sebanisu commented 3 years ago

https://github.com/MaKiPL/OpenVIII-monogame/issues/189 refers to this link: https://github.com/Sebanisu/CleanPNG/blob/master/.github/workflows/codeql-analysis.yml

That project uses the same version of monogame.