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

Big building rework #448

Closed
wants to merge 1 commit into from

Conversation

Karolson
Copy link
Contributor

This is a big rework and splitting it into different commits would've been rather annoying, sorry if it's hard to review

Major changes:

  • Update to ubuntu:22.10
  • Bundle libc.so and some of its dependencies with the build. While this solves the problem of ancient distros, now, if system glibc is newer, Spring will fail to load GPU drivers. So spring is replaced with a shell script which first checks whether to preload the system glibc, and then launches spring-legacy
  • Remove MXE, use mingw from Ubuntu instead
  • Remove spring-static-libs and mingwlibs64, use Conan and Ubuntu repos instead (Except DevIL for windoze)
  • Don't link Linux statically, bundle libraries with the build (Linking SDL statically wasn't nearly the hard part, but dynamic linking everything still seems a better way. I still left the updated PREFER_STATIC_LIBS option in CMake)
  • Use Ninja for building
  • Use mold for linking
  • Clean up some CMake warnings
  • Rework caching on GitHub
  • Run legacy, headless and dedicated builds in parallel on GitHub

Obviously needs a ton of testing so a draft for now
Tested on Arch Linux, Wine, Ubuntu 18.04 VM, Windows 10 VM
GitHub builds don't quite work right now, I'll work on that

@Karolson Karolson marked this pull request as draft October 11, 2022 14:18
@Karolson Karolson force-pushed the build-rework branch 5 times, most recently from a59b521 to 25bd4e1 Compare October 18, 2022 05:02
@Karolson Karolson force-pushed the build-rework branch 6 times, most recently from 9fe2395 to 5f38acc Compare October 20, 2022 01:48
@lhog
Copy link
Collaborator

lhog commented Oct 20, 2022

Ok, review time.

Update to ubuntu:22.10
Bundle libc.so and some of its dependencies with the build. While this solves the problem of ancient distros, now, if system glibc is newer, Spring will fail to load GPU drivers. So spring is replaced with a shell script which first checks whether to preload the system glibc, and then launches spring-legacy

Slash that for now.

Remove MXE, use mingw from Ubuntu instead

@verybadsoldier please comment why MXE was used in the first place instead of mingw package. I don't quite remember.
Will probably need to slash this too because mingw will be too old on 18.04 unless there are uplifting PPAs

Remove spring-static-libs and mingwlibs64, use Conan and Ubuntu repos instead (Except DevIL for windoze)

Is DevIL not supplied by Conan on Windows?
I'm very much afraid we lose the compile options granularity with this one. Let's take DevIL: it has conditional compile time support for tons of image format. Some of them we need, some we don't. How do we know which options were compiled in into the Conan supplied binaries?
What kind of runtime library Conan uses on Windows? I vividly recall some of libs not working until I static compiled runtimes inside dlls. They shouldn't rely on dynamic linking to c/c++, that is a must.

Don't link Linux statically, bundle libraries with the build (Linking SDL statically wasn't nearly the hard part, but dynamic linking everything still seems a better way. I still left the updated PREFER_STATIC_LIBS option in CMake)

Yeah maybe. Does Linux guarantee to look for dynamic libs in the current directory? I was under impression it's not.

Use Ninja for building

Good change, although originally we used Ninja for building and had to fall back to make since Ninja was failing sometimes (details are lost in time)

Use mold for linking

Does it also work fine with mingw build?

Clean up some CMake warnings
Rework caching on GitHub
Run legacy, headless and dedicated builds in parallel on GitHub

Very good ones. Thanks!

@verybadsoldier you have bandwidth please have a look as well.

@Karolson
Copy link
Contributor Author

Is DevIL not supplied by Conan on Windows?

It's not supplied by Conan at all. So on Linux it's fetched from Ubuntu repos and on Windows I've put binaries in a folder.

I'm very much afraid we lose the compile options granularity with this one. Let's take DevIL: it has conditional compile time support for tons of image format. Some of them we need, some we don't.

That seems like a minor tradeoff for not having to compile everything manually.

How do we know which options were compiled in into the Conan supplied binaries?

You can look at conan.io or from command line. There are lots of binaries but they seem to have the same build options and only differ in compiler versions/settings, but I'm not sure.

What kind of runtime library Conan uses on Windows? I vividly recall some of libs not working until I static compiled runtimes inside dlls. They shouldn't rely on dynamic linking to c/c++, that is a must.

There are binaries built with /MT, so this should be ok.

Does Linux guarantee to look for dynamic libs in the current directory?

Directory can be set at compile time. I set it to (engine dir)/lib for now.

Does it also work fine with mingw build?

mold doesn't support Windows yet, so no.

@verybadsoldier
Copy link
Collaborator

verybadsoldier commented Oct 20, 2022

Remove MXE, use mingw from Ubuntu instead

@verybadsoldier please comment why MXE was used in the first place instead of mingw package. I don't quite remember.

IIRC the reason for MXE was the ability to freely choose gcc version instead of being tied to one provided by Ubuntu.

@lhog
Copy link
Collaborator

lhog commented Oct 20, 2022

That seems like a minor tradeoff for not having to compile everything manually.

That is a speculation. I don't know what formats are supported in conan build, you don't seem to know either.
Please make sure to test if the following formats are covered: IL_PNG, IL_JPG, IL_TGA, IL_DDS, IL_BMP, IL_TIF, IL_HDR, IL_EXR

There are binaries built with /MT, so this should be ok.

So it's built with MSVC runtime? In theory it should be fine with -MT. Yet.
Let's branch out conan change so it can be built autonomously so the testers could run it extensively on both Linux and Windows

@Karolson
Copy link
Contributor Author

That is a speculation. I don't know what formats are supported in conan build, you don't seem to know either.

DevIL has all formats enabled by default. I don't know how to test it, but I don't see anything in Ubuntu builds that would disable any, and I don't think Windows builds may have anything disabled either.

So it's built with MSVC runtime?

There are no mingw prebuilts actually.

Let's branch out conan change so it can be built autonomously so the testers could run it extensively on both Linux and Windows

I'll do this sometime later. There are still some small fixes needed.

@lhog
Copy link
Collaborator

lhog commented Oct 21, 2022

Sounds like a plan. If conan builds don't show any flaws, we will move to using them.

@lhog lhog force-pushed the BAR105 branch 3 times, most recently from 7d55cea to 075e577 Compare October 21, 2022 20:40
Update to ubuntu:22.10
Bundle libc.so and some of its dependencies with the build
Remove MXE, use mingw from Ubuntu instead
Remove spring-static-libs and mingwlibs64, use Conan and Ubuntu repos instead
Don't link Linux statically, bundle libraries with the build
Use Ninja for building
Use mold for linking
Clean up some CMake warnings
Rework caching on GitHub
Run legacy, headless and dedicated builds in parallel on GitHub
@badosu
Copy link
Collaborator

badosu commented Dec 20, 2022

(commenting here since no official non-proprietary channel I am aware of, you can find me at liberachat IRC server (no registration necessary) or matrix

@Karolson Do you have any plan on getting this merged? Sorry for bugging you out, it's the sanest way I have of compiling reproducible engine but if there's not timeframe I'll just drop back to whatever is being done at BAR105 (even if it means no sane debug build).

It would also help a lot into getting other things done I plan to (like rmlui and controllers) since I feel having to maintain spring-static-libs or using insane dependency management is becoming a hard blocker for me.

@Karolson
Copy link
Contributor Author

Sorry, no time frame, probably a few months until I look at it again. Afaik debug builds work on BAR105?

@lhog lhog force-pushed the BAR105 branch 2 times, most recently from 3925acd to d32df95 Compare April 17, 2023 12:47
@lhog lhog force-pushed the BAR105 branch 2 times, most recently from 41c6b2b to 1c21706 Compare July 12, 2023 17:42
@sprunk
Copy link
Collaborator

sprunk commented Oct 3, 2023

Looks like a lot of things changed underneath, there's multiple merge conflicts. Should this stay open?

@p2004a
Copy link
Collaborator

p2004a commented Oct 3, 2023

I think it's good for it to stay open for whoever might want to pick up build rework. Maybe I would only make it a draft PR.

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.

6 participants