Skip to content

Make base compile on linux #629

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

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

Conversation

ReplayCoding
Copy link

@ReplayCoding ReplayCoding commented Feb 17, 2023

Related Issue

TODO

Implementation

This PR fixes a number of issues with compiling TC2 on linux. It currently runs, and can load maps. It uses parts of #616, #486, #603.

Build Instructions

podman run -v $PWD:/src -it registry.gitlab.steamos.cloud/steamrt/sniper/sdk
# this enters a container shell
cd /src
./src/build.sh
# exit the container
./game_clean/link.sh
./game/start_tf2.sh

Screenshots

Checklist

  • No other PRs implement this idea.
  • This PR does not introduce any regressions.
  • I certify that this PR is my own entirely original work, or I have permission from and have attributed the relevant authors.
  • I have agreed to and signed this project's Contributor License Agreement.
  • This PR only contains changes to the engine and/or core game framework
  • This PR targets the community branch. (???)
  • This change has been filed as an issue.
  • No other PRs address this.
  • This PR is as minimal as possible.
  • This PR has been built and locally tested on at least one platform.
  • This PR has been tested on all platforms, on both a dedicated server and on a listen server.

Testing Checklist

Client Server Version
Windows
Linux Built, Tested 6.1.7-xanmod1 #1-NixOS SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980
Mac OS

This was built under the steam "scout" and "sniper" runtime.

Caveats

  • While the game does run, there is a bug that will cause a crash whenever a weapon is inspected. fixed!

Alternatives

  • Don't support linux builds at all
  • Rewrite the build system to use something like cmake

@melvyn2
Copy link

melvyn2 commented Feb 18, 2023

Mind adding the following to commits which add build.sh & other scripts?

Co-authored-by: melvyn2 <melvyn2@brcok.tk>
Co-authored-by: HurricanePootis <eatabakhsh04@protonmail.com>
Co-authored-by: interrupt <int-10h@protonmail.com>

@ReplayCoding ReplayCoding force-pushed the base branch 2 times, most recently from a390718 to 6d2b895 Compare February 18, 2023 18:36
@ReplayCoding
Copy link
Author

ReplayCoding commented Feb 18, 2023

Mind adding the following to commits which add build.sh & other scripts?

Done, I've also added credits (or cherry-picked) to a couple of other commits

@ReplayCoding ReplayCoding marked this pull request as ready for review February 18, 2023 18:48
@ReplayCoding ReplayCoding changed the title [WIP] Make base compile on linux Make base compile on linux Feb 18, 2023
Copy link
Member

@mastercoms mastercoms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with this freetype2 change?
Also there are a lot of weird Linux specific changes that don't make a lot of sense from my perspective. Please revise this patch to be less unique to TC2. Attempt to follow the current state of TF2 as closely as possible, rather than doing what may be optimal. This will reduce the possibility of regressions and allow us to test things better.

@ReplayCoding
Copy link
Author

ReplayCoding commented Feb 18, 2023

What's with this freetype2 change?

TF2 already uses the system freetype libraries, and the headers that were in common don't actually build, so I just elected to use the system headers.

@ReplayCoding ReplayCoding force-pushed the base branch 3 times, most recently from b8d1178 to 2f63fc9 Compare February 20, 2023 00:26
@ReplayCoding ReplayCoding marked this pull request as draft February 20, 2023 00:58
@ReplayCoding ReplayCoding force-pushed the base branch 8 times, most recently from 8178315 to e05bc50 Compare February 23, 2023 00:46
@ReplayCoding
Copy link
Author

Reposting from the #tf2-patches channel on discord:

If anyone wants to write a "proper" (if that even exists) fix for the target id panel crashes, feel free. I'm tired of trying to figure out what it is, and ReplayCoding@e05bc50 works fine.

@ReplayCoding ReplayCoding force-pushed the base branch 3 times, most recently from bbe6323 to 538d3d8 Compare February 24, 2023 16:01
@ReplayCoding ReplayCoding marked this pull request as ready for review February 24, 2023 16:02
Copy link
Member

@mastercoms mastercoms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some problematic changes, also why was empty ccache added?

@ReplayCoding
Copy link
Author

ReplayCoding commented Feb 24, 2023

also why was empty ccache added?

Just github being funny, it's a perms change to make it executable.

@ReplayCoding ReplayCoding requested a review from mastercoms March 19, 2023 12:53
Copy link
Author

@ReplayCoding ReplayCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*non-windows :trollface:

melvyn2 and others added 2 commits April 17, 2023 14:59
contains things that will be added in a later commit
@ReplayCoding ReplayCoding force-pushed the base branch 3 times, most recently from ababdc8 to 3dbe712 Compare April 18, 2023 01:11
ReplayCoding and others added 22 commits April 17, 2023 19:40
build.sh contains references to external libs which aren't added in this
commit.

Co-authored-by: melvyn2 <melvyn2@brcok.tk>
Co-authored-by: HurricanePootis <eatabakhsh04@protonmail.com>
Co-authored-by: interrupt <int-10h@protonmail.com>
VPC will segfault unless it's built as 32bit
linux paths are case-sensitive, some code doesn't expect this
TF2 already uses the system library, and these headers are broken
anyways.
Without this, gcc will complain with the following error:
/src/src/public/tier1/utlblockmemory.h:139:2: error: there are no arguments to 'swap' that depend on a template parameter, so a declaration of 'swap' must be available [-fpermissive]
  139 |  swap( m_nBlocks, mem.m_nBlocks );
      |  ^~~~
Use the steam runtime containers instead, they're easier to setup
removed some files, and added them to the gitignore. these files will
get regenerated automatically, and if they're in the repo, it will show
up on "git status".
I'm not sure if this will compile on windows, so *maybe* we should add a
ifdef check for linux. But, this should be correct.
/src/src/public/gcsdk/msgprotobuf.h:383:8: error: base operand of '->' has non-pointer type 'CMsgProtoBufHeader'
  383 |   Hdr()->set_client_session_id( nSessionIDClient );
      |        ^~
this is technically a problem, but it's what valve probably intended
/src/src/vgui2/vgui_surfacelib/linuxfont.cpp:505:43: error: no matching function for call to 'min(int&, unsigned int&)'
  505 |   int Width = min( rgbaWide, bitmap.width );
src/thirdparty/libedit-3.1/configure.ac is modified from the original
files, to make it work on modern autotools.
these are taken from the leaked source code
revert gendbg changes
failed to dlopen vphysics.so error=/home/user/Projects/tf2_stuff/cloned/team-comtress-2/game/bin/vphysics.so: undefined symbol: __wrap_freopen
without this, static libraries such as tier1 won't contain debugging
info, making it harder to debug.
I've honestly got no idea what the root cause is, but this fixes it
copied nearly verbatim from CSGO, thanks to ficool2 for pointing out
there was a better fix
In certain situations, gcc will remove instances of code that check if a
pointer is null, if it thinks that the pointer can never be null.
However, many of these pointers *can* be null in TF2, so this
optimization can cause crashes.
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.

4 participants