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?

ghost commented 2 years ago

Also had segmentation fault using DepotDownloader, had to use SteamCMD in order to download TF2 properly.

melvyn2 commented 2 years ago

check the config.log, upload it here.

ghost commented 2 years ago

Thanks for the reply, here's the config.log.

config.log

melvyn2 commented 2 years ago

/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory

You’re missing 32-bit libgcc, check your repos for it and I’ll add it to the dependencies if its missing.

ghost commented 2 years ago

Yeah, I believe there was 1 initial package that wasn't able to be downloaded (libtcmalloc-minimal4:i386).

The libgcc32 bit comes from the linux tf2 install wiki: On 64-bit Debian/Ubuntu/Linux Mint run: $ sudo dpkg --add-architecture i386 $ sudo apt-get update $ sudo apt-get install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386 libsdl2-2.0-0:i386

However, this too may be outdated, as I got this following error:

Package lib32gcc1 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: lib32gcc-s1 E: Package 'lib32gcc1' has no installation candidate

I install the replacement package, and get: lib32gcc-s1 is already the newest version (12-20220319-1ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Also, I appreciate the quick responses.

melvyn2 commented 2 years ago

I’ll take a look later today when I can

ghost commented 2 years ago

Using the errors you found in config.log, I figured out I had to run this:

sudo apt install gcc-multilib

to be able to install the 32-bit binaries. This time it got much further after running ./build.sh. It errored out on the following: configure: error: in/home/trb/team-comtress-2-main/src/thirdparty/protobuf-2.6.1': configure: error: sched_yield was not found on your system`

I'll take a look through the config.log again; I hadn't looked through it properly last time, but now I know what to look for.

ghost commented 2 years ago

Getting a bit further after: sudo apt-get install gcc-multilib g++-multilib Looks like it's chugging along.

ghost commented 2 years ago

../../public/tier1/fmtstr.h: In member function 'void CNumStr::SetUint64(uint64)': ../../public/tier1/fmtstr.h:333:51: error: 'Q_snprintf' was not declared in this scope; did you mean 'V_snprintf'? 333 | inline void SetUint64( uint64 un64 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%llu", un64 ); } | ^~~~~~~~~~ | V_snprintf make: *** [Makefile:267: obj/Linux/release/exprsimplifier.o] Error 1

Seems like a duplicate of #615

ghost commented 2 years ago

Made a lot of progress, got server running, encountering client side "You are in insecure mode", so I'll troubleshoot that some more.

ghost commented 2 years ago

Started server with -insecure as a start option. Now I get

Disconnect: Server uses different class tables

ghost commented 2 years ago

Here's the Server IP for testing: 164.92.99.35

ghost commented 2 years ago

Ran login anonymous force_install_dir /hlserver/tf2 app_update 232250 validate quit

Now the TC2 Linux server says it's running on a newer version of the game. I can connect via TF2, but not TC2.

CLIENT TC2 (Windows) ] version Build Label: 4139084 # Uniquely identifies each build Network PatchVersion: 4085139 # Determines client and server compatibility Protocol version: 24 # High level network protocol version Server version: 4139084 Server AppID: 232250 Client version: 4085139 Client AppID: 440

SERVER TC2 (Linux) version Build Label: 7182415 # Uniquely identifies each build Network PatchVersion: 7182415 # Determines client and server compatibility Protocol version: 24 # High level network protocol version Server version: 7182415 Server AppID: 232250

ghost commented 2 years ago

Hrm, so I unzipped game_clean.zip again, and the versions of the client/server match, however I'm back to the error I see client side when attempting to connect to the server: Disconnect: Server uses different class tables

melvyn2 commented 2 years ago

Hi, I personally hadn’t gotten the server to run before, could you document how you built and ran it?

ghost commented 2 years ago

Will do; I want to see if I can get it working in the first place; looks like some of the symbolic links aren't created properly (extra forward slashes, etc.). I'll let you know once I've gotten something working

ghost commented 2 years ago

Still haven't managed to get it working; I've tried SteamCMD, DepotDownloader, I've even tried copying the files directly from the linux box to my windows pc, and I can't manage to get a Linux Server and Windows Client working without the server uses different class tables error. Not sure what could possibly be the issue, since I literally had identical files on both systems.

Basic Process:

  1. Download TF2 on the linux box via SteamCMD or DepotDownloader (after downloading dotnet requirements/packages)
  2. Unzip game_clean.zip, overwrite files as instructed in the github tutorial
  3. ./build.sh is still getting did you mean 'V_snprintf'? issues
  4. ./link.sh is still having issues with certain files (file already exists, or can't find file /path/to//file - seems like a typo since two consecutive forward slashes)
  5. When I run tf2.sh (https://wiki.teamfortress.com/wiki/Linux_dedicated_server) (Create a shell script to run the server), it runs, but still class tables mismatch.

I'm assuming the class tables issue is being caused by the V_snprintf or issues linking files. I'll see if I can fix that issue.

melvyn2 commented 2 years ago

oh, I see what happened: you didn’t build the server all. Rather, link.sh is linking in plain tf2, as there were no tc2 files already in the game dir.

You should cherry pick fixes from here: https://github.com/mastercomfig/team-comtress-2/pull/616

ghost commented 2 years ago

Gotcha, I see your fixes; I guess they weren't added to main? So far just changing Q_snprintf to V_snprintf in fmtstr.h. I'll update on progress. Thanks for the quick response!

ghost commented 2 years ago

Also updated min to std::min in threadtools.cpp, making more progress.

melvyn2 commented 2 years ago

You’ll see why it’s still a draft soon enough (or just read the issue :p)

Gotcha, I see your fixes; I guess they weren't added to main? So far just changing Q_snprintf to V_snprintf in fmtstr.h. I'll update on progress. Thanks for the quick response!

ghost commented 2 years ago

Hrm, so I should expect a segfault error on launch. Well glad I can help a bit on testing this out. It's still chugging along building, so hopefully it works out and I can help w/documentation.

ghost commented 2 years ago

Hrm; the Digital Ocean droplet I'm working with has a single core, and it looks like the tutorial says it took 20 minutes on a Ryzen 5 1600., which has 6 cores. I'm wondering if I should create a Linux VM locally and allocate extra cores to speed up the build process, then transfer over.

ghost commented 2 years ago

Had to build 3 times in a row, it kept catching things. Got this error: /home/trb/team-comtress-2-main/src/dedicated/console/TextConsoleUnix.cpp:16:10: fatal error: histedit.h: No such file or directory 16 | #include <histedit.h> | ^~~~~~~~~~~~ compilation terminated. make[2]: *** [dedicated_linux32.mak:505: obj_dedicated_linux32/release/TextConsoleUnix.o] Error 1 make[1]: *** [games.mak:102: dedicated] Error 2 make: *** [games.mak:65: all] Error 2 real 0m58.570s user 0m54.139s sys 0m3.836s

ghost commented 2 years ago

Fixed by using sudo apt-get install libedit-dev, apparently this resolves the issue of histedit.h missing.

ghost commented 2 years ago

Building: vtf Building: client_tf Building: datacache Building: dedicated ---- LINKING obj_dedicated_linux32/release/dedicated.so [release] ---- /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.so when searching for -ledit /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.a when searching for -ledit /usr/bin/ld: cannot find -ledit: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.so when searching for -ledit collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:583: obj_dedicated_linux32/release/dedicated.so] Error 1 make[1]: [games.mak:102: dedicated] Error 2 make: *** [games.mak:65: all] Error 2

real 0m1.008s user 0m0.770s sys 0m0.224s

ghost commented 2 years ago

Fixed with sudo apt-get install libedit-dev:i386. Now I get ---- LINKING EXE ../../game/srcds_linux [release] ---- /usr/bin/ld: cannot find -ltcmalloc_minimal: No such file or directory collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:595: ../../game/srcds_linux] Error 1 make[1]: [games.mak:106: dedicated_main] Error 2 make: *** [games.mak:65: all] Error 2

real 0m0.971s user 0m0.695s sys 0m0.262s

melvyn2 commented 2 years ago

Missing libtcmalloc-minimal4:i386 Did you run the dependencies command?

ghost commented 2 years ago

Yeah, just ran it again, got same error as before: E: Unable to locate package libtcmalloc-minimal4:i386

Edit: trb@tc2:~/team-comtress-2-main$ sudo apt-get install -y libtcmalloc-minimal4 Reading package lists... Done Building dependency tree... Done Reading state information... Done libtcmalloc-minimal4 is already the newest version (2.9.1-0ubuntu3). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

ghost commented 2 years ago

Testing removing "-ltcmalloc_minimal -Wl" from the line in source_exe_posix_base.vpc completely $GCC_ExtraLinkerFlags "-Wl,--no-as-needed -ltcmalloc_minimal -Wl,--as-needed" [$LINUXALL&&!$DEDICATED]

ghost commented 2 years ago

Got another issue with #include <AL/al.h> not being found, fixed it by installing sudo apt-get install libopenal1:i386 libopenal1, manually as well from https://packages.debian.org/stretch/i386/libopenal-dev/download

ghost commented 2 years ago

/usr/bin/ld: cannot find -lcurl-gnutls: No such file or directory

ghost commented 2 years ago

Updated this line in engine.vpc $SystemLibraries "rt;openal;curl-gnutls" [$LINUXALL] to $SystemLibraries "rt;openal;libcurl4-gnutls" [$LINUXALL]

ghost commented 2 years ago

Getting a strange related error: /usr/bin/ld: cannot find -llibcurl4-gnutls: No such file or directory. Not sure why there are 2 L's in the library now.

melvyn2 commented 2 years ago

because you shouldn't have done that change. -l<name> means "link to the library named lib<name>

melvyn2 commented 2 years ago

Ubuntu seems to have dropped a lot of needed i386 packages. Personally I'd recommend switching to something not as breaking, like debian. As for curl-gnutls: it should be from the libcurl4-gnutls-dev:i386 package

melvyn2 commented 2 years ago

Testing removing "-ltcmalloc_minimal -Wl" from the line in source_exe_posix_base.vpc completely

This is a bad idea, internal libs depend on tcmalloc's specific behavior

ghost commented 2 years ago

Gotcha, I might try another version of linux if I can't get this working. I see what you mean with -l as well. Yeah the i386 packages seem to be having more issues. I'll see about putting back -ltcmalloc_minimal.

ghost commented 2 years ago

ran sudo apt install mesa-common-dev for missing gl.h

ghost commented 2 years ago

---- tf_gcmessages.pb.cc ---- {standard input}: Assembler messages: {standard input}:2441168: Error: unknown pseudo-op: `.lvus493' g++: fatal error: Killed signal terminated program cc1plus compilation terminated. make[2]: [server_linux32_tf.mak:9644: obj_server_tf_linux32/release/tf_gcmessages.pb.o] Error 1 make[1]: [games.mak:178: server_tf] Error 2 make: *** [games.mak:65: all] Error 2

real 1m2.320s user 0m40.070s sys 0m4.880s

It seems like a few forum posts about this say it's running out of memory/RAM; not sure there's a way I can get around this.

ghost commented 2 years ago

Looks like I can make progress by building consecutively? It's not crashing where it did before, I seem to be making progress.

melvyn2 commented 2 years ago

You can always keep building the working projects... ignoring the failing ones won't get you a working build. You'll just finish building the working ones.

ghost commented 2 years ago

Hmm, seems like it's getting stuck on this now:

Building: scenefilecache Building: server_tf -P-- tf_gamerules.cpp ----

Doesn't seem to be crashing/exiting/stopping, although I can do so manually with Ctrl+C. I'll wait it out for a bit. Edit: using -dd tag shows it isn't paused, simply taking a long time.

ghost commented 2 years ago

Writing master makefile /home/trb/team-comtress-2-main/src/games.mak. virtual void CMaterialSystem::EndFrame()': /home/trb/team-comtress-2-main/src/materialsystem/cmaterialsystem.cpp:3815:42: error: 'class CThreadMutex' has no member named 'GetOwnerId'

melvyn2 commented 2 years ago

check the fixes pr again...

ghost commented 2 years ago

I'm going to just download your for-pr entirely replace what I have, that way I don't have to look around for cherry picks.

ghost commented 2 years ago

Finally finished using your for-pr, got following:

---- sys_linux.cpp ---- ---- LINKING obj_dedicated_linux32/debug/dedicated.so [debug] ---- /usr/bin/ld: ./obj_dedicated_linux32/debug/zip_utils.o: in function CWin32File::CreateTempFile(CUtlString&, CUtlString&)': /home/trb/team-comtress-2-main/src/public/zip_utils.cpp:181: warning: the use oftmpnam' is dangerous, better use mkstemp' /usr/bin/ld: ./obj_dedicated_linux32/debug/TextConsoleUnix.o: warning: relocation against_ZN23__pthread_cleanup_classD1Ev' in read-only section `.text' /usr/bin/ld: warning: creating DT_TEXTREL in a shared object ---- COPYING TO ../../game/bin/dedicated.so [debug] ---- Building: dedicated_main ---- SteamAppStartup.cpp ---- ---- main.cpp ---- ---- LINKING EXE ../../game/srcds_linux [debug] ---- /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so when searching for -ltcmalloc_minimal /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.a when searching for -ltcmalloc_minimal /usr/bin/ld: cannot find -ltcmalloc_minimal: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so when searching for -ltcmalloc_minimal collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:595: ../../game/srcds_linux] Error 1 make[1]: [games.mak:106: dedicated_main] Error 2 make: *** [games.mak:65: all] Error 2

ghost commented 2 years ago

Similar after trying again:

-P-- weapons_resource.cpp ---- -P-- weapon_selection.cpp ---- -P-- WorldDimsProxy.cpp ---- ---- LINKING obj_client_tf_linux32/release/client.so [release] ---- collect2: fatal error: ld terminated with signal 9 [Killed] compilation terminated. make[2]: [../../devtools/makefile_base_posix.mak:583: obj_client_tf_linux32/release/client.so] Error 1 make[1]: [games.mak:94: client_tf] Error 2 make: *** [games.mak:65: all] Error 2

real 60m7.444s user 52m43.418s sys 6m34.182s

ghost commented 2 years ago

I think my system may be running out of memory, I'll see if I can fix this.

ghost commented 2 years ago

Increasing swap size to 2GB (up from 0) to see if this changes anything.