Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Linux support #107

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Add Linux support #107

wants to merge 21 commits into from

Conversation

pimzero
Copy link

@pimzero pimzero commented Jul 20, 2023

Hi,

Fist and foremost, thanks you for this project, very useful to understand how bg3 works.

This PR is more a proof of concept and will probably need some cleanup if we
want to merge it, but I am sending your way to know if I need to put the effort
(or if I should keep this as a fork on my side).

This PR does 2 things:

  • Allow lslib to build on Linux (Build)
  • Improve compatibility on Linux (Runtime)

The toolchain used is mono instead of dotnet, as I understand dotnet doesn't
support the framework version used in this project for Linux.

Build: what is required

The build change are the biggest part of this PR. The following changes were required:

Paths

Most Linux systems/FS are case sensitive, while windows doesn't have this
requirement. I fixed them.

Also, absolute paths start with a slash / which is considered as an option by
gplex and gppg. We use relative paths now (for Linux build, unchanged for Windows).

LSLibNative

AFAIK managed C++ is unsupported by mono or .NET Core.

CRC32 now uses the implementation from
System.IO.Hashing,
which seems to use the same polynomial.

Convert Granny2Compressor and LZ4FrameCompressor to C#. By using
DllImport, the .NET runtime will load the correct .dll or .so
accordingly, if they are in the library search path.

Misc

We added some packages and assemblies references required for build.

We updated build documentation for Linux.

Linux needs it own protoc, we provide a link to download it.

Runtime

The biggest change required for runtime was to remove the dependency on
Alphaleonis.Win32.Filesystem. It doesn't work on Linux (it expects a Windows
system).

I believe a better way to handle long paths would be to follow the instructions
in
https://learn.microsoft.com/en-us/archive/blogs/jeremykuhne/net-4-6-2-and-long-paths-on-windows-10
although I haven't tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant