mastercomfig / tf2-patches

Team Fortress 2, but with a lot of fixes, QoL improvements and performance optimizations!
Other
218 stars 27 forks source link

Linux Server Issues "configure: error: C compiler cannot create executables" #619

Closed ghost closed 1 year ago

ghost commented 2 years ago

Description

While going through Linux Build Instructions, encountered error: "configure: error: C compiler cannot create executables". Still troubleshooting, although it could be helpful if the documentation were updated a bit more clearly (once I get this fixed and working, I might make a shell script to automate the entire process).

Got project working on Windows (client and server), attempting to run a TC2 server on Linux for testing/gaming purposes. I have experience with running Linux TF2 Servers, so I'm fairly familiar with the general process. Has anyone else encountered this issue?

melvyn2 commented 2 years ago

https://github.com/melvyn2/team-comtress-2/blob/for-pr/src/thirdparty/protobuf-2.6.1/configure.ac should be there, something didn't clone right

melvyn2 commented 2 years ago

second, if I change it to ./srcds_linux, I get Failed to open dedicated.so (dedicated.so: cannot open shared object file: No such file or directory)

this error is because LD_LIBRARY_PATH wasn't set. I'll work on adding the server binaries to run.sh, they're known not to work so they haven't been used much

ghost commented 2 years ago

Looks like the file exists:

/home/trb/team-comtress-2/src/thirdparty/protobuf-2.6.1# ls -l configure.ac -rw-r--r-- 1 root root 5067 May 5 03:32 configure.ac

Also, I appreciate all the help, I know this has been a lot, and you've been a great resource for progressing through this. My hope is to get a linux based TC2 server running, and then automate most of the process w/scripts.

melvyn2 commented 2 years ago

hmm, I'm able to get a full build and run the server to the DXMath segfault we get on the client. I'm not sure what the issue is on your end. What's git log -n 5 tell you?

ghost commented 2 years ago

git log -n 5 commit 689e4d7ebdeeb42da997ca76a23adfd8b974a7ba (HEAD -> main, origin/main, origin/HEAD) Author: xero-lib jonathankurtz@protonmail.com Date: Sun Feb 6 03:29:09 2022 -0600

Fixed build.sh

commit f7c8bbe65e90277dd5e659687263229d1a05c215 Author: xero-lib jonathankurtz@protonmail.com Date: Sun Feb 6 02:14:38 2022 -0600

Fixed build.sh

commit b6b2dcd852b1c8a24e5ebc1c1c374fdc4be977ed Author: melvyn2 melvyn2@brcok.tk Date: Sat Feb 5 19:16:01 2022 -0800

Comment broken assert

commit 62f9f49d0992a211fd2a8e2c54a2a37fa1083feb Author: melvyn2 melvyn2@brcok.tk Date: Sat Feb 5 19:14:32 2022 -0800

Ignore vpc generated project files

commit ac7fca6b01a8b972f1e3878ef9be12cf6c1d78d3 Author: melvyn2 melvyn2@brcok.tk Date: Sat Feb 5 17:33:59 2022 -0800

Run autoreconf on protobuf source

I ran into segfault errors before, but I believe it was a RAM issue which I solved with a 2 GB swap file. Not sure if it's related.

melvyn2 commented 2 years ago

No, I mean a segfault in the built binary. Try running git fetch --all && git reset --hard origin/for-pr

ghost commented 2 years ago

Thanks, it's looking good. This is my first time contributing / working on someone else's Git project, so I'm not that familiar with grabbing specific branches or spokes of branches. I'll let this run and see if I reach the same segfault you did.

ghost commented 2 years ago

Built correctly, testing link.sh and run.sh:

./run.sh WARNING: setlocale('en_US.UTF-8') failed, using locale:'C'. International characters may not work.

Not sure how to run the server now that it's built and linked. I'm guessing run.sh just runs the client.

ghost commented 2 years ago

I'm wondering if it'd be possible to use wine or something to run the windows TC2 server on a linux box.

ghost commented 2 years ago

Built correctly, testing link.sh and run.sh:

./run.sh WARNING: setlocale('en_US.UTF-8') failed, using locale:'C'. International characters may not work.

Not sure how to run the server now that it's built and linked. I'm guessing run.sh just runs the client.

Fixed this by uncommenting out the en_US.UTF-8 line in /etc/locale.gen, then running locale-gen

Running ./run.sh doesn't do anything (no errors, no output at all).

ghost commented 2 years ago

I think I'm running into that segmentation fault now (had to run with -s tag):

./run.sh -s ./run.sh: line 29: 736 Segmentation fault "$(pwd)/srcds_linux" ${ARGS} ${@:2}

Also, I had to run apt install libtinfo5:i386 libncurses5:i386 libcurl3-gnutls:i386 to get this tag working.

ghost commented 2 years ago

./run.sh -d (lldb) target create "/home/trb/team-comtress-2/game/hl2_linux" Current executable set to '/home/trb/team-comtress-2/game/hl2_linux' (i386). (lldb) settings set -- target.run-args "-allowdebug" "-steam" "-game" "tf" "-insecure" "-novid" "-nojoy" "-nosteamcontroller" "-nohltv" "-particles" "1" "-noborder" "-particle_fallback" "2" "-dev" "-nobreakpad" "-console" (lldb)

melvyn2 commented 2 years ago

./run.sh -s -d do r at the lldb prompt

ghost commented 2 years ago

./run.sh -s -d (lldb) target create "/home/trb/team-comtress-2/game/srcds_linux" Current executable set to '/home/trb/team-comtress-2/game/srcds_linux' (i386). (lldb) settings set -- target.run-args "-allowdebug" "-steam" "-game" "tf" "-insecure" "-novid" "-nojoy" "-nosteamcontroller" "-nohltv" "-particles" "1" "-noborder" "-particle_fallback" "2" "-dev" "-nobreakpad" "-console" (lldb) r error: 'A' packet returned an error: 8 (lldb)

melvyn2 commented 2 years ago

https://stackoverflow.com/questions/70108775/gdb-exits-immediately-process-finished-with-exit-code-1-or-lldb-a-packet-ret/70108776#70108776

ghost commented 2 years ago

Not sure where to put this; I run docker desktop on windows, run my container, then in the console I run docker exec -it container_name bash. Where would I put this exactly?

ghost commented 2 years ago

Actually, I'm going to see if I can transfer the files now that they're built properly to a debian VPS on digital ocean.

ghost commented 2 years ago

trb@tc2:~/team-comtress-2$ ./run.sh -s -d (lldb) target create "/home/trb/team-comtress-2/game/srcds_linux" Current executable set to '/home/trb/team-comtress-2/game/srcds_linux' (i386). (lldb) settings set -- target.run-args "-allowdebug" "-steam" "-game" "tf" "-insecure" "-novid" "-nojoy" "-nosteamcontroller" "-nohltv" "-particles" "1" "-noborder" "-particle_fallback" "2" "-dev" "-nobreakpad" "-console" (lldb) r Process 31275 launched: '/home/trb/team-comtress-2/game/srcds_linux' (i386)

WARNING: Failed to load 32-bit libtinfo.so.5 or libncurses.so.5. Please install (lib32tinfo5 / ncurses-libs.i686 / equivalent) to enable readline.

Process 31275 stopped

ghost commented 2 years ago

I've attempted replacing vector4d.h with various version, but all have resulted in similar signal SIGSEGV:

https://raw.githubusercontent.com/mastercomfig/team-comtress-2/main/src/public/mathlib/vector4d.h https://raw.githubusercontent.com/ValveSoftware/source-sdk-2013/master/sp/src/public/mathlib/vector4d.h https://swarm.workshop.perforce.com/files/guest/knut_wikstrom/ValveSDKCode/public/vector4d.h

melvyn2 commented 2 years ago

yeah, from the little I've looked into it so far it's not a regression in DXmath itself

ghost commented 2 years ago

Referencing the Linux Build Guide: Bug reports (crashes in game) are appreciated! Please send a full backtrace by running with LLDB and crashing - run.sh -d will launch lldb with the game. Once in LLDB at the terminal, enter r at the (lldb) prompt to run the game, then reproduce the crash. The game should freeze instead of quitting and in your terminal, LLDB should say what the error was, and be at another prompt. type bt to get a backtrace, and put it in an issue on HurricanePootis's fork with how you got there.

I ran the bt command in lldb after the SIGSEGV, and this is what I got:

(lldb) bt
* thread #1, name = 'srcds_linux', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0xf4e6a50e materialsystem.so`_GLOBAL__sub_I_mat_texture_tracking at vector4d.h:645:17
    frame #1: 0xf7fe304c ld-2.31.so`___lldb_unnamed_symbol58$$ld-2.31.so + 140
    frame #2: 0xf7fe3152 ld-2.31.so`___lldb_unnamed_symbol59$$ld-2.31.so + 130
    frame #3: 0xf7fe6457 ld-2.31.so`___lldb_unnamed_symbol88$$ld-2.31.so + 23
    frame #4: 0xf7eab694 libc.so.6`_dl_catch_exception + 244
    frame #5: 0xf7fe6f1b ld-2.31.so`___lldb_unnamed_symbol93$$ld-2.31.so + 987
    frame #6: 0xf7eab639 libc.so.6`_dl_catch_exception + 153
    frame #7: 0xf7fe6796 ld-2.31.so`___lldb_unnamed_symbol91$$ld-2.31.so + 166
    frame #8: 0xf7f782c8 libdl.so.2`___lldb_unnamed_symbol4$$libdl.so.2 + 120
    frame #9: 0xf7eab639 libc.so.6`_dl_catch_exception + 153
    frame #10: 0xf7eab700 libc.so.6`_dl_catch_error + 48
    frame #11: 0xf7f78b11 libdl.so.2`___lldb_unnamed_symbol12$$libdl.so.2 + 113
    frame #12: 0xf7f78364 libdl.so.2`dlopen + 84
    frame #13: 0xf77a1cdb dedicated.so`Sys_LoadLibrary(char const*, Sys_Flags) + 139
    frame #14: 0xf77a1e27 dedicated.so`Sys_LoadModule(char const*, Sys_Flags) + 215
    frame #15: 0xf77696c5 dedicated.so`CBaseFileSystem::LoadModule(this=<unavailable>, pFileName=<unavailable>, pPathID=<unavailable>, bValidatedDllOnly=true) at basefilesystem.cpp:5055:23
    frame #16: 0xf788a99a dedicated.so`CSteamAppSystemGroup::LoadModuleDLL(char const*) + 106
    frame #17: 0xf788b660 dedicated.so`CAppSystemGroup::LoadModule(char const*) + 144
    frame #18: 0xf788bbcd dedicated.so`CAppSystemGroup::AddSystems(AppSystemInfo_t*) + 61
    frame #19: 0xf779e560 dedicated.so`CSys::LoadModules(CDedicatedAppSystemGroup*) [inlined] CDedicatedAppSystemGroup::AddSystems(pSystems=0xffff9fd8, this=0xffffa2a8) at dedicated.h:67:42
    frame #20: 0xf779e557 dedicated.so`CSys::LoadModules(this=0xf794707c, pAppSystemGroup=0xffffa2a8) at sys_linux.cpp:272
    frame #21: 0xf779d73a dedicated.so`CDedicatedAppSystemGroup::Create() [inlined] CDedicatedAppSystemGroup::Create(this=0xffffa2a8) at sys_ded.cpp:232:23
    frame #22: 0xf779d6f0 dedicated.so`CDedicatedAppSystemGroup::Create(this=0xffffa2a8) at sys_ded.cpp:216
    frame #23: 0xf788b356 dedicated.so`CAppSystemGroup::OnStartup() + 38
    frame #24: 0xf788b4b2 dedicated.so`CAppSystemGroup::Run() + 34
    frame #25: 0xf788da9b dedicated.so`CSteamApplication::Main() + 43
    frame #26: 0xf788b4c4 dedicated.so`CAppSystemGroup::Run() + 52
    frame #27: 0xf7751cc5 dedicated.so`main at sys_ded.cpp:529:29
    frame #28: 0xf779e60d dedicated.so`::DedicatedMain(argc=18, argv=0xffffd564) at sys_linux.cpp:297:13
    frame #29: 0x5655640f srcds_linux`main(argc=18, argv=0xffffd564) at main.cpp:226:22
    frame #30: 0xf7d8ae46 libc.so.6`__libc_start_main + 262
    frame #31: 0x56556591 srcds_linux`_start + 49
melvyn2 commented 2 years ago

you should definitely use triple backtick code blocks

ghost commented 2 years ago

Gotcha, thanks for the tip (again sorry about my inexperience, hopefully it isn't too painful :))

ghost commented 2 years ago

Trying ./build.sh -dd, and using HurricanePootis's vector4d.h: https://raw.githubusercontent.com/HurricanePootis/team-comtress-2/independent/public/mathlib/vector4d.h

melvyn2 commented 2 years ago

switching out the dxmath headers won't change anything, I explained that it's not a regression in dxmath itself

ghost commented 2 years ago

Built again with ./build.sh -dd (since I had transferred from local Docker container to a Digital Ocean Debian server), and ran again, got an interesting error:

(lldb) target create "/home/trb/team-comtress-2/game/srcds_linux"
Current executable set to '/home/trb/team-comtress-2/game/srcds_linux' (i386).
(lldb) settings set -- target.run-args  "-allowdebug" "-steam" "-game" "tf" "-insecure" "-novid" "-nojoy" "-nosteamcontroller" "-nohltv" "-particles" "1" "-noborder" "-particle_fallback" "2" "-dev" "-nobreakpad" "-console"
(lldb) r
Process 62744 launched: '/home/trb/team-comtress-2/game/srcds_linux' (i386)

WARNING: Failed to load 32-bit libtinfo.so.5 or libncurses.so.5.
  Please install (lib32tinfo5 / ncurses-libs.i686 / equivalent) to enable readline.

 failed to dlopen /home/trb/team-comtress-2/game/bin/vphysics.so error=/home/trb/team-comtress-2/game/bin/vphysics.so: undefined symbol: __wrap_freopen
 failed to dlopen vphysics.so error=/home/trb/team-comtress-2/game/bin/vphysics.so: undefined symbol: __wrap_freopen
Failed to load vphysics.so: (null)
AppFramework : Unable to load module vphysics.so!
Unable to load interface VPhysics031 from vphysics.so
Process 62744 exited with status = 0 (0x00000000)
melvyn2 commented 2 years ago

I also got past the DXmath segfault with a dumb hack, how did you solve it? That problem and a couple afterwards I have queued to push later. e: Hmm, no change at all? that's really weird

ghost commented 2 years ago

I rebuilt it? ./build.sh -dd, ran into same errors with ledit and lmalloc from before. Had to fix the ldl2 link that was missing as well. Weird! I'm very excited now, this is cool we're making progress.

Edit: not sure if I solved it, or encountered a new error that's preventing me from seeing it.

melvyn2 commented 2 years ago

Pull recent commits, and install the packages it asks. Then try again

melvyn2 commented 2 years ago

The fact that it started working on your droplet makes me think that maybe this is a regression in gcc, I'll test a clang build and see where I get.

ghost commented 2 years ago

It'll be a bit; rebuilding ./build.sh -dd

ghost commented 2 years ago

Let it build overnight, got this when I try to run it:

trb@tc2:~/team-comtress-2$ ./run.sh -s -d
(lldb) target create "/home/trb/team-comtress-2/game/srcds_linux"
Current executable set to '/home/trb/team-comtress-2/game/srcds_linux' (i386).
(lldb) settings set -- target.run-args  "-allowdebug" "-steam" "-game" "tf" "-insecure" "-novid" "-nojoy" "-nosteamcontroller" "-nohltv" "-particles" "1" "-noborder" "-particle_fallback" "2" "-dev" "-nobreakpad" "-console"
(lldb) r
Process 112563 launched: '/home/trb/team-comtress-2/game/srcds_linux' (i386)

WARNING: Failed to load 32-bit libtinfo.so.5 or libncurses.so.5.
  Please install (lib32tinfo5 / ncurses-libs.i686 / equivalent) to enable readline.

System (VMaterialSystem081) failed during stage CONNECTION
Process 112563 exited with status = 0 (0x00000000)
(lldb) bt
error: invalid thread
(lldb)

I'm going to attempt replacing the vector4d.h with original: https://raw.githubusercontent.com/mastercomfig/team-comtress-2/main/src/public/mathlib/vector4d.h

ghost commented 2 years ago

Hrm, got the seg fault when using the original vector4d.h. Not sure what was causing the above issue with your latest version.

melvyn2 commented 2 years ago

the matsystem has been a bug with the dedicated server since the original port

ghost commented 2 years ago

Gotcha; ran again with your version (no changes) and got the same as above issue, failed during stage CONNECTION. Not sure where to go from here.

Edit: Fixed missing libncurses with sudo apt-get install libncurses5 libncurses5:i386. Still getting the CONNECTION issue.

melvyn2 commented 2 years ago

Hm, this does seem like a compiler bug, on my debian docker instance compiling in debug mode doesn't cause the vector4d crash. It wouldn't be the first time for tc2

ghost commented 2 years ago

Yeah, I've been running this on a Digital Ocean Droplet now, so it's no longer on Docker, getting the CONNECTION issue. Backtrace doesn't reveal anything immediate.

ghost commented 2 years ago

Not sure if this helps, but when I attempt to build with clang, I get the following:

trb@tc2:~/team-comtress-2$ ./build.sh -l
trb@tc2:~/team-comtress-2

Basically, nothing seems to happen.

ghost commented 2 years ago

Also, when I attempt to link:

cp: cannot stat '/mnt/volume_sfo3_01/TC2/tf/gamestate.txt': No such file or directory
cp: cannot stat '/mnt/volume_sfo3_01/TC2/tf/glshaders.cfg': No such file or directory
cp: cannot stat '/mnt/volume_sfo3_01/TC2/tf/videoconfig_linux.cfg': No such file or directory
ghost commented 2 years ago

Any ideas on where to look into next to fix this issue? I'm pretty much stuck, and you seem to know this project way better than myself.

melvyn2 commented 2 years ago

when I have time I will. There’s a reason the pr is still a draft

ghost commented 2 years ago

Absolutely, I appreciate the time you've spent so far. Cheers!

ghost commented 2 years ago

Hey melvyn2, don't want to bug you too much; you get a chance to take a look at this any further? It's ok if not.

ChampionCynthia commented 2 years ago

Hello,

I'm currently working on getting Team Comtress 2 running on the Mac (repo). The Source Engine version of the Mac is built with Clang.

Since Team Comtress 2 has introduced C++17 stuff in the codebase, the code cannot be built using Xcode 6.4 (based on an unspecified SVN revision of LLVM 3.6.0 during its development); this version of LLVM doesn't support C++17. Thus, I did some changes to get the code to build in Xcode 9.4.1, which is the last version of Xcode to support building for i386 architectures.

I "fixed" the SSE issue from vector4d.h by replacing the file with CS:GO's. The CS:GO code base usually has better code for most things, but compatibility must be checked for since the CS:GO engine is also quite different. EDIT: It might break models however, so changes may be needed.

srcds_osx has the same problem as srcds_linux's above:

System (VMaterialSystem081) failed during stage CONNECTION
2022-07-31 13:15:30.657339+0200 srcds_osx[38373:147142] 227:  ca_debug_string: conv == NULL
Process 38373 exited with status = 0 (0x00000000) 

Could this be caused by shaderapiempty.dylib? By default, we're not building that library, we're simply using TF2's.

EDIT: hl2_osx boots and can load a map, although without sound. But models are not positioned correctly and dynamic models are mostly broken. This may be caused by the vector4d.h change though.